Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Generated from a3db9ba57ede1858830cee525cf8f2bb9124e143
Remove wrong tag
  • Loading branch information
AutorestCI committed Jun 16, 2018
commit dfd32deb9981785e549b4d551c8fb119722af4b1
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling

from .. import models

Expand Down Expand Up @@ -93,9 +91,25 @@ def generate(
return client_raw_response
generate.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations'}


def _get_generate_status_initial(
def get_generate_status(
self, operation_id, custom_headers=None, raw=False, **operation_config):
"""Retrieves the status of the recommendation computation or generation
process. Invoke this API after calling the generation recommendation.
The URI of this API is returned in the Location field of the response
header.

:param operation_id: The operation ID, which can be found from the
Location field in the generate recommendation response header.
:type operation_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
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get_generate_status.metadata['url']
path_format_arguments = {
Expand Down Expand Up @@ -130,47 +144,6 @@ def _get_generate_status_initial(
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response

def get_generate_status(
self, operation_id, custom_headers=None, raw=False, polling=True, **operation_config):
"""Retrieves the status of the recommendation computation or generation
process. Invoke this API after calling the generation recommendation.
The URI of this API is returned in the Location field of the response
header.

:param operation_id: The operation ID, which can be found from the
Location field in the generate recommendation response header.
:type operation_id: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of LROPoller that returns None or
ClientRawResponse<None> if raw==True
:rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
raw_result = self._get_generate_status_initial(
operation_id=operation_id,
custom_headers=custom_headers,
raw=True,
**operation_config
)

def get_long_running_output(response):
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response

lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
get_generate_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}'}

def list(
Expand Down