async def test_long_running_negative(): global LOCATION_BODY global POLLING_STATUS # Test LRO PUT throws for invalid json LOCATION_BODY = '{' response = TestArmPolling.mock_send('POST', 202, {'location': LOCATION_URL}) poll = async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) with pytest.raises(DeserializationError): await poll LOCATION_BODY = '{\'"}' response = TestArmPolling.mock_send('POST', 202, {'location': LOCATION_URL}) poll = async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) with pytest.raises(DeserializationError): await poll LOCATION_BODY = '{' POLLING_STATUS = 203 response = TestArmPolling.mock_send('POST', 202, {'location': LOCATION_URL}) poll = async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) with pytest.raises(CloudError): # TODO: Node.js raises on deserialization await poll LOCATION_BODY = json.dumps({'name': TEST_NAME}) POLLING_STATUS = 200
async def test_long_running_post(): # Test throw on non LRO related status code response = TestArmPolling.mock_send('POST', 201, {}) op = LongRunningOperation(response, lambda x:None) with pytest.raises(BadStatus): op.set_initial_status(response) with pytest.raises(CloudError): await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( 'POST', 202, {'azure-asyncoperation': ASYNC_URL}, body={'properties':{'provisioningState': 'Succeeded'}}) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) #self.assertIsNone(poll) assert polling_method._response.randomFieldFromPollAsyncOpHeader is None # Test polling from location header response = TestArmPolling.mock_send( 'POST', 202, {'location': LOCATION_URL}, body={'properties':{'provisioningState': 'Succeeded'}}) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._response.randomFieldFromPollLocationHeader is None # Test fail to poll from azure-asyncoperation header response = TestArmPolling.mock_send( 'POST', 202, {'azure-asyncoperation': ERROR}) with pytest.raises(BadEndpointError): await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test fail to poll from location header response = TestArmPolling.mock_send( 'POST', 202, {'location': ERROR}) with pytest.raises(BadEndpointError): await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0))
async def create_or_update(self, resource_group_name, cluster_name, parameters, *, custom_headers=None, raw=False, polling=True, **operation_config): """Create or update a Log Analytics cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param cluster_name: The name of the Log Analytics cluster. :type cluster_name: str :param parameters: The parameters required to create or update a Log Analytics cluster. :type parameters: ~azure.mgmt.loganalytics.models.Cluster :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for AsyncARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of Cluster or ClientRawResponse<Cluster> if raw==True :rtype: ~~azure.mgmt.loganalytics.models.Cluster or ~msrest.pipeline.ClientRawResponse[~azure.mgmt.loganalytics.models.Cluster] :raises: :class:`ClusterErrorResponseException<azure.mgmt.loganalytics.models.ClusterErrorResponseException>` """ raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, custom_headers=custom_headers, raw=True, **operation_config) def get_long_running_output(response): deserialized = self._deserialize('Cluster', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
async def put_async_retry_succeeded(self, product=None, *, custom_headers=None, raw=False, polling=True, **operation_config): """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. :param product: Product to put :type product: ~lro.models.Product :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for AsyncARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of Product or ClientRawResponse<Product> if raw==True :rtype: ~~lro.models.Product or ~msrest.pipeline.ClientRawResponse[~lro.models.Product] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = await self._put_async_retry_succeeded_initial( product=product, custom_headers=custom_headers, raw=True, **operation_config) def get_long_running_output(response): header_dict = { 'Azure-AsyncOperation': 'str', 'Location': 'str', 'Retry-After': 'int', } deserialized = self._deserialize('Product', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) client_raw_response.add_headers(header_dict) return client_raw_response return deserialized lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
async def delete(self, resource_group_name, workspace_name, linked_service_name, *, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a linked service instance. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str :param linked_service_name: Name of the linked service. :type linked_service_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for AsyncARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of LinkedService or ClientRawResponse<LinkedService> if raw==True :rtype: ~~azure.mgmt.loganalytics.models.LinkedService or ~msrest.pipeline.ClientRawResponse[~azure.mgmt.loganalytics.models.LinkedService] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, linked_service_name=linked_service_name, custom_headers=custom_headers, raw=True, **operation_config) def get_long_running_output(response): deserialized = self._deserialize('LinkedService', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
async def delete(self, resource_group_name, workspace_name, force=None, *, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str :param force: Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. :type force: bool :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for AsyncARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of None or ClientRawResponse<None> if raw==True :rtype: ~None or ~msrest.pipeline.ClientRawResponse[None] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, force=force, custom_headers=custom_headers, raw=True, **operation_config) def get_long_running_output(response): if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
async def test_long_running_delete(): # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send('DELETE', 202, {'azure-asyncoperation': ASYNC_URL}, body="") polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll is None assert polling_method._response.randomFieldFromPollAsyncOpHeader is None
async def post202_retry200(self, product=None, *, custom_headers=None, raw=False, polling=True, **operation_config): """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. :param product: Product to put :type product: ~lro.models.Product :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for AsyncARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of None or ClientRawResponse<None> if raw==True :rtype: ~None or ~msrest.pipeline.ClientRawResponse[None] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = await self._post202_retry200_initial( product=product, custom_headers=custom_headers, raw=True, **operation_config) def get_long_running_output(response): if raw: client_raw_response = ClientRawResponse(None, response) client_raw_response.add_headers({ 'Location': 'str', 'Retry-After': 'int', }) return client_raw_response lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
async def delete(self, resource_group_name, resource_name, *, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. Deletes a OpenShift cluster with the specified subscription, resource group and resource name. The operation returns nothing. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param resource_name: The name of the OpenShift cluster resource. :type resource_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for AsyncARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of None or ClientRawResponse<None> if raw==True :rtype: ~None or ~msrest.pipeline.ClientRawResponse[None] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_name=resource_name, custom_headers=custom_headers, raw=True, **operation_config) def get_long_running_output(response): if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
async def get_multiple_pages_lro( self, client_request_id=None, paging_get_multiple_pages_lro_options=None, *, custom_headers=None, raw=False, polling=True, **operation_config): """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: :type client_request_id: str :param paging_get_multiple_pages_lro_options: Additional parameters for the operation :type paging_get_multiple_pages_lro_options: ~paging.models.PagingGetMultiplePagesLroOptions :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for AsyncARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of ProductResult or ClientRawResponse<ProductResult> if raw==True :rtype: ~~paging.models.ProductResult or ~msrest.pipeline.ClientRawResponse[~paging.models.ProductResult] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = await self._get_multiple_pages_lro_initial( client_request_id=client_request_id, paging_get_multiple_pages_lro_options=paging_get_multiple_pages_lro_options, custom_headers=custom_headers, raw=True, **operation_config ) def get_long_running_output(response): deserialized = self._deserialize('ProductResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
async def test_long_running_patch(): # Test polling from location header response = TestArmPolling.mock_send( 'PATCH', 202, {'location': LOCATION_URL}, body={'properties':{'provisioningState': 'Succeeded'}}) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._response.randomFieldFromPollLocationHeader is None # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( 'PATCH', 202, {'azure-asyncoperation': ASYNC_URL}, body={'properties':{'provisioningState': 'Succeeded'}}) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert not hasattr(polling_method._response, 'randomFieldFromPollAsyncOpHeader') # Test polling from location header response = TestArmPolling.mock_send( 'PATCH', 200, {'location': LOCATION_URL}, body={'properties':{'provisioningState': 'Succeeded'}}) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._response.randomFieldFromPollLocationHeader is None # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( 'PATCH', 200, {'azure-asyncoperation': ASYNC_URL}, body={'properties':{'provisioningState': 'Succeeded'}}) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert not hasattr(polling_method._response, 'randomFieldFromPollAsyncOpHeader') # Test fail to poll from azure-asyncoperation header response = TestArmPolling.mock_send( 'PATCH', 202, {'azure-asyncoperation': ERROR}) with pytest.raises(BadEndpointError): poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test fail to poll from location header response = TestArmPolling.mock_send( 'PATCH', 202, {'location': ERROR}) with pytest.raises(BadEndpointError): poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0))
async def test_long_running_put(): #TODO: Test custom header field # Test throw on non LRO related status code response = TestArmPolling.mock_send('PUT', 1000, {}) op = LongRunningOperation(response, lambda x:None) with pytest.raises(BadStatus): op.set_initial_status(response) with pytest.raises(CloudError): await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test with no polling necessary response_body = { 'properties':{'provisioningState': 'Succeeded'}, 'name': TEST_NAME } response = TestArmPolling.mock_send( 'PUT', 201, {}, response_body ) def no_update_allowed(url, headers=None): raise ValueError("Should not try to update") polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method ) assert poll.name == TEST_NAME assert not hasattr(polling_method._response, 'randomFieldFromPollAsyncOpHeader') # Test polling from azure-asyncoperation header response = TestArmPolling.mock_send( 'PUT', 201, {'azure-asyncoperation': ASYNC_URL}) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert not hasattr(polling_method._response, 'randomFieldFromPollAsyncOpHeader') # Test polling location header response = TestArmPolling.mock_send( 'PUT', 201, {'location': LOCATION_URL}) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._response.randomFieldFromPollLocationHeader is None # Test polling initial payload invalid (SQLDb) response_body = {} # Empty will raise response = TestArmPolling.mock_send( 'PUT', 201, {'location': LOCATION_URL}, response_body) polling_method = AsyncARMPolling(0) poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, polling_method) assert poll.name == TEST_NAME assert polling_method._response.randomFieldFromPollLocationHeader is None # Test fail to poll from azure-asyncoperation header response = TestArmPolling.mock_send( 'PUT', 201, {'azure-asyncoperation': ERROR}) with pytest.raises(BadEndpointError): poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0)) # Test fail to poll from location header response = TestArmPolling.mock_send( 'PUT', 201, {'location': ERROR}) with pytest.raises(BadEndpointError): poll = await async_poller(CLIENT, response, TestArmPolling.mock_outputs, AsyncARMPolling(0))
async def create(self, resource_group_name, account_name, parameters, *, custom_headers=None, raw=False, polling=True, **operation_config): """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. . :param resource_group_name: The name of the resource group within the user’s subscription. :type resource_group_name: str :param account_name: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. :type account_name: str :param parameters: The parameters to provide for the created account. :type parameters: ~storage.models.StorageAccountCreateParameters :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for AsyncARMPolling, False for no polling, or a polling object for personal polling strategy :return: An instance of StorageAccount or ClientRawResponse<StorageAccount> if raw==True :rtype: ~~storage.models.StorageAccount or ~msrest.pipeline.ClientRawResponse[~storage.models.StorageAccount] :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` """ raw_result = await self._create_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, custom_headers=custom_headers, raw=True, **operation_config) def get_long_running_output(response): deserialized = self._deserialize('StorageAccount', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
async def test_lro_happy_paths(self, special_client): client = special_client product = Product(location="West US") # Test manual poller raw_process = await client.lr_os.put201_creating_succeeded200(product, raw=True, polling=False) process = await async_poller(client, raw_process, Product, AsyncARMPolling(timeout=0)) assert "Succeeded" == process.provisioning_state process = await self.lro_result(client.lr_os.put201_creating_succeeded200, product) assert "Succeeded" == process.provisioning_state await self.assertRaisesWithMessage("Operation failed with status: 200. Details: Resource state Failed", client.lr_os.put201_creating_failed200, product) process = await self.lro_result(client.lr_os.put200_updating_succeeded204, product) assert "Succeeded" == process.provisioning_state await self.assertRaisesWithMessage("Operation failed with status: 200. Details: Resource state Canceled", client.lr_os.put200_acceptedcanceled200, product) # Testing nopolling process = await self.lro_result(client.lr_os.put201_creating_succeeded200, product, polling=False) assert "Creating" == process.provisioning_state process = await self.lro_result(client.lr_os.put201_creating_failed200, product, polling=False) assert "Created" == process.provisioning_state process = await self.lro_result(client.lr_os.put200_updating_succeeded204, product, polling=False) assert "Updating" == process.provisioning_state process = await self.lro_result(client.lr_os.put200_acceptedcanceled200, product, polling=False) assert "Accepted" == process.provisioning_state # Testing nopolling and raw at the same time process = await self.lro_result(client.lr_os.put201_creating_succeeded200, product, raw=True, polling=False) assert "Creating" == process.output.provisioning_state process = await self.lro_result(client.lr_os.put201_creating_failed200, product, raw=True, polling=False) assert "Created" == process.output.provisioning_state process = await self.lro_result(client.lr_os.put200_updating_succeeded204, product, raw=True, polling=False) assert "Updating" == process.output.provisioning_state process = await self.lro_result(client.lr_os.put200_acceptedcanceled200, product, raw=True, polling=False) assert "Accepted" == process.output.provisioning_state process = await self.lro_result(client.lr_os.put_no_header_in_retry, product) assert "Succeeded" == process.provisioning_state process = await self.lro_result(client.lr_os.put_no_header_in_retry, product) assert "Succeeded" == process.provisioning_state process = await self.lro_result(client.lr_os.put_sub_resource, SubProduct()) assert "Succeeded" == process.provisioning_state process = await self.lro_result(client.lr_os.put_sub_resource, SubProduct()) assert "Succeeded" == process.provisioning_state process = await self.lro_result(client.lr_os.put_non_resource, Sku()) assert "100" == process.id process = await self.lro_result(client.lr_os.put_non_resource, Sku()) assert "100" == process.id process = await self.lro_result(client.lr_os.post202_retry200, product) assert process is None process = await self.lro_result(client.lr_os.put200_succeeded, product) assert "Succeeded" == process.provisioning_state process = await self.lro_result(client.lr_os.put200_succeeded_no_state, product) assert "100" == process.id process = await self.lro_result(client.lr_os.put202_retry200, product) assert "100" == process.id process = await self.lro_result(client.lr_os.put_async_retry_succeeded, product) assert "Succeeded" == process.provisioning_state process = await self.lro_result(client.lr_os.put_async_no_retry_succeeded, product) assert "Succeeded" == process.provisioning_state await self.assertRaisesWithMessage("Operation failed with status: 200. Details: Resource state Failed", client.lr_os.put_async_retry_failed, product) await self.assertRaisesWithMessage("Operation failed with status: 200. Details: Resource state Canceled", client.lr_os.put_async_no_retrycanceled, product) assert await self.lro_result(client.lr_os.delete204_succeeded) is None assert await self.lro_result(client.lr_os.delete202_retry200) is None assert await self.lro_result(client.lr_os.delete202_no_retry204) is None assert await self.lro_result(client.lr_os.delete_async_no_retry_succeeded) is None assert await self.lro_result(client.lr_os.delete_no_header_in_retry) is None assert await self.lro_result(client.lr_os.delete_async_no_header_in_retry) is None await self.assertRaisesWithMessage("Operation failed with status: 200. Details: Resource state Canceled", client.lr_os.delete_async_retrycanceled) await self.assertRaisesWithMessage("Operation failed with status: 200. Details: Resource state Failed", client.lr_os.delete_async_retry_failed) assert await self.lro_result(client.lr_os.delete_async_retry_succeeded) is None process = await self.lro_result(client.lr_os.delete_provisioning202_accepted200_succeeded) assert "Succeeded" == process.provisioning_state result = await self.lro_result(client.lr_os.delete_provisioning202_deletingcanceled200) assert result.provisioning_state == 'Canceled' result = await self.lro_result(client.lr_os.delete_provisioning202_deleting_failed200) assert result.provisioning_state == 'Failed' assert await self.lro_result(client.lr_os.post202_no_retry204, product) is None await self.assertRaisesWithMessage("Internal Server Error", client.lr_os.post_async_retry_failed) await self.assertRaisesWithMessage("Operation failed with status: 200. Details: Resource state Canceled", client.lr_os.post_async_retrycanceled) prod = await self.lro_result(client.lr_os.post_async_retry_succeeded) assert prod.id == "100" prod = await self.lro_result(client.lr_os.post_async_no_retry_succeeded) assert prod.id == "100" sku = await self.lro_result(client.lr_os.post200_with_payload) assert sku.id == '1' process = await self.lro_result(client.lro_retrys.put201_creating_succeeded200, product) assert 'Succeeded' == process.provisioning_state process = await self.lro_result(client.lro_retrys.put_async_relative_retry_succeeded, product) assert 'Succeeded' == process.provisioning_state process = await self.lro_result(client.lro_retrys.delete_provisioning202_accepted200_succeeded) assert 'Succeeded' == process.provisioning_state assert await self.lro_result(client.lro_retrys.delete202_retry200) is None assert await self.lro_result(client.lro_retrys.delete_async_relative_retry_succeeded) is None assert await self.lro_result(client.lro_retrys.post202_retry200, product) is None assert await self.lro_result(client.lro_retrys.post_async_relative_retry_succeeded, product) is None custom_headers = {"x-ms-client-request-id": '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'} process = await self.lro_result(client.lr_os_custom_header.put_async_retry_succeeded, product, custom_headers=custom_headers) assert process is not None process = await self.lro_result(client.lr_os_custom_header.post_async_retry_succeeded, product, custom_headers=custom_headers) assert process is None process = await self.lro_result(client.lr_os_custom_header.put201_creating_succeeded200, product, custom_headers=custom_headers) assert process is not None process = await self.lro_result(client.lr_os_custom_header.post202_retry200, product, custom_headers=custom_headers) assert process is None