def update_state_from_get_resource_operation(request, polling_state, custom_deserialization_block)
      result = get_async_with_custom_deserialization(request, custom_deserialization_block)

      fail AzureOperationError, 'The response from long running operation does not contain a body' if result.response.body.nil? || result.response.body.empty?

      # On non flattened resource, we should find provisioning_state inside 'properties'
      if result.body.respond_to?(:properties) && result.body.properties.respond_to?(:provisioning_state) && !result.body.properties.provisioning_state.nil?
        polling_state.status = result.body.properties.provisioning_state
      # On flattened resource, we should find provisioning_state at the top level
      elsif result.body.respond_to?(:provisioning_state) && !result.body.provisioning_state.nil?
        polling_state.status = result.body.provisioning_state
      else
        polling_state.status = AsyncOperationStatus::SUCCESS_STATUS
      end

      error_data = CloudErrorData.new
      error_data.code = polling_state.status
      error_data.message = "Long running operation failed with status #{polling_state.status}"

      polling_state.error_data = error_data
      polling_state.update_response(result.response)
      polling_state.request = result.request
      polling_state.resource = result.body
    end
def update_state_from_get_resource_operation(request, polling_state, custom_deserialization_block)
      result = get_async_with_custom_deserialization(request, custom_deserialization_block)

      fail AzureOperationError, 'The response from long running operation does not contain a body' if result.response.body.nil? || result.response.body.empty?

      # On non flattened resource, we should find provisioning_state inside 'properties'
      if result.body.respond_to?(:properties) && result.body.properties.respond_to?(:provisioning_state) && !result.body.properties.provisioning_state.nil?
        polling_state.status = result.body.properties.provisioning_state
      # On flattened resource, we should find provisioning_state at the top level
      elsif result.body.respond_to?(:provisioning_state) && !result.body.provisioning_state.nil?
        polling_state.status = result.body.provisioning_state
      else
        polling_state.status = AsyncOperationStatus::SUCCESS_STATUS
      end

      error_data = CloudErrorData.new
      error_data.code = polling_state.status
      error_data.message = "Long running operation failed with status #{polling_state.status}"

      polling_state.error_data = error_data
      polling_state.update_response(result.response)
      polling_state.request = result.request
      polling_state.resource = result.body
    end
Updates polling state based on location header for PUT HTTP requests.
 @param request [MsRest::HttpOperationRequest] The url retrieve data from.
 @param polling_state [MsRestAzure::PollingState] polling state to update.
 @param custom_deserialization_block [Proc] custom deserialization method for parsing response.