diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py index 4b8ab4595cf0..452ebb0f5aaa 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py @@ -9,10 +9,6 @@ # regenerated. # -------------------------------------------------------------------------- -from .error_response import ErrorResponse, ErrorResponseException -from .resource import Resource -from .tracked_resource import TrackedResource -from .proxy_resource import ProxyResource from .sku import Sku from .automation_account import AutomationAccount from .automation_account_create_or_update_parameters import AutomationAccountCreateOrUpdateParameters @@ -24,6 +20,10 @@ from .key import Key from .key_list_result import KeyListResult from .automation_account_update_parameters import AutomationAccountUpdateParameters +from .proxy_resource import ProxyResource +from .resource import Resource +from .tracked_resource import TrackedResource +from .error_response import ErrorResponse, ErrorResponseException from .certificate_create_or_update_parameters import CertificateCreateOrUpdateParameters from .certificate import Certificate from .certificate_update_parameters import CertificateUpdateParameters @@ -63,8 +63,6 @@ from .module_create_or_update_parameters import ModuleCreateOrUpdateParameters from .module_update_parameters import ModuleUpdateParameters from .type_field import TypeField -from .job_stream import JobStream -from .job_stream_list_result import JobStreamListResult from .runbook_parameter import RunbookParameter from .runbook_draft import RunbookDraft from .runbook import Runbook @@ -75,6 +73,8 @@ from .test_job import TestJob from .runbook_create_or_update_draft_properties import RunbookCreateOrUpdateDraftProperties from .runbook_create_or_update_draft_parameters import RunbookCreateOrUpdateDraftParameters +from .job_stream import JobStream +from .job_stream_list_result import JobStreamListResult from .advanced_schedule_monthly_occurrence import AdvancedScheduleMonthlyOccurrence from .advanced_schedule import AdvancedSchedule from .schedule_create_or_update_parameters import ScheduleCreateOrUpdateParameters @@ -171,11 +171,11 @@ DscConfigurationState, GroupTypeEnum, ModuleProvisioningState, - JobStreamType, RunbookTypeEnum, RunbookState, RunbookProvisioningState, HttpStatusCode, + JobStreamType, ScheduleDay, ScheduleFrequency, OperatingSystemType, @@ -192,10 +192,6 @@ ) __all__ = [ - 'ErrorResponse', 'ErrorResponseException', - 'Resource', - 'TrackedResource', - 'ProxyResource', 'Sku', 'AutomationAccount', 'AutomationAccountCreateOrUpdateParameters', @@ -207,6 +203,10 @@ 'Key', 'KeyListResult', 'AutomationAccountUpdateParameters', + 'ProxyResource', + 'Resource', + 'TrackedResource', + 'ErrorResponse', 'ErrorResponseException', 'CertificateCreateOrUpdateParameters', 'Certificate', 'CertificateUpdateParameters', @@ -246,8 +246,6 @@ 'ModuleCreateOrUpdateParameters', 'ModuleUpdateParameters', 'TypeField', - 'JobStream', - 'JobStreamListResult', 'RunbookParameter', 'RunbookDraft', 'Runbook', @@ -258,6 +256,8 @@ 'TestJob', 'RunbookCreateOrUpdateDraftProperties', 'RunbookCreateOrUpdateDraftParameters', + 'JobStream', + 'JobStreamListResult', 'AdvancedScheduleMonthlyOccurrence', 'AdvancedSchedule', 'ScheduleCreateOrUpdateParameters', @@ -353,11 +353,11 @@ 'DscConfigurationState', 'GroupTypeEnum', 'ModuleProvisioningState', - 'JobStreamType', 'RunbookTypeEnum', 'RunbookState', 'RunbookProvisioningState', 'HttpStatusCode', + 'JobStreamType', 'ScheduleDay', 'ScheduleFrequency', 'OperatingSystemType', diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py b/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py index 867b0e7cf0ef..8bbee9d8fda3 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py @@ -81,17 +81,6 @@ class ModuleProvisioningState(Enum): updating = "Updating" -class JobStreamType(Enum): - - progress = "Progress" - output = "Output" - warning = "Warning" - error = "Error" - debug = "Debug" - verbose = "Verbose" - any = "Any" - - class RunbookTypeEnum(Enum): script = "Script" @@ -165,6 +154,17 @@ class HttpStatusCode(Enum): http_version_not_supported = "HttpVersionNotSupported" +class JobStreamType(Enum): + + progress = "Progress" + output = "Output" + warning = "Warning" + error = "Error" + debug = "Debug" + verbose = "Verbose" + any = "Any" + + class ScheduleDay(Enum): monday = "Monday" diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/job_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/job_operations.py index 238618a3e166..950bd8b46ac6 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/job_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/job_operations.py @@ -38,7 +38,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_output( - self, resource_group_name, automation_account_name, job_name, client_request_id=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, automation_account_name, job_name, client_request_id=None, custom_headers=None, raw=False, callback=None, **operation_config): """Retrieve the job output identified by job name. :param resource_group_name: Name of an Azure Resource group. @@ -52,10 +52,15 @@ def get_output( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ # Construct URL @@ -86,7 +91,7 @@ def get_output( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + response = self._client.send(request, header_parameters, stream=True, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -96,7 +101,7 @@ def get_output( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._client.stream_download(response, callback) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -106,7 +111,7 @@ def get_output( get_output.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output'} def get_runbook_content( - self, resource_group_name, automation_account_name, job_name, client_request_id=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, automation_account_name, job_name, client_request_id=None, custom_headers=None, raw=False, callback=None, **operation_config): """Retrieve the runbook content of the job identified by job name. :param resource_group_name: Name of an Azure Resource group. @@ -120,11 +125,17 @@ def get_runbook_content( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` """ # Construct URL url = self.get_runbook_content.metadata['url'] @@ -154,17 +165,15 @@ def get_runbook_content( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + response = self._client.send(request, header_parameters, stream=True, **operation_config) if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._client.stream_download(response, callback) if raw: client_raw_response = ClientRawResponse(deserialized, response) diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_draft_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_draft_operations.py index 3af4cc1547a6..edbfedeca1a3 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_draft_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_draft_operations.py @@ -40,7 +40,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_content( - self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, callback=None, **operation_config): """Retrieve the content of runbook draft identified by runbook name. :param resource_group_name: Name of an Azure Resource group. @@ -52,10 +52,15 @@ def get_content( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ # Construct URL @@ -84,7 +89,7 @@ def get_content( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + response = self._client.send(request, header_parameters, stream=True, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -94,7 +99,7 @@ def get_content( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._client.stream_download(response, callback) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -105,7 +110,7 @@ def get_content( def _replace_content_initial( - self, resource_group_name, automation_account_name, runbook_name, runbook_content, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, automation_account_name, runbook_name, runbook_content, custom_headers=None, raw=False, callback=None, **operation_config): # Construct URL url = self.replace_content.metadata['url'] path_format_arguments = { @@ -145,7 +150,7 @@ def _replace_content_initial( header_dict = {} if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('object', response) header_dict = { 'location': 'str', } @@ -161,7 +166,7 @@ def _replace_content_initial( return deserialized def replace_content( - self, resource_group_name, automation_account_name, runbook_name, runbook_content, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, automation_account_name, runbook_name, runbook_content, custom_headers=None, raw=False, callback=None, **operation_config): """Replaces the runbook draft content. :param resource_group_name: Name of an Azure Resource group. @@ -170,15 +175,15 @@ def replace_content( :type automation_account_name: str :param runbook_name: The runbook name. :type runbook_name: str - :param runbook_content: The runbook draft content. + :param runbook_content: The runbook draft content. :type runbook_content: str :param dict custom_headers: headers that 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 + :return: An instance of AzureOperationPoller that returns object or ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[str] or - ~msrest.pipeline.ClientRawResponse + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[Generator] + or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ @@ -216,7 +221,7 @@ def get_long_running_output(response): header_dict = { 'location': 'str', } - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('object', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py index f1c281095259..b6337b20008b 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py @@ -38,7 +38,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_content( - self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, callback=None, **operation_config): """Retrieve the content of runbook identified by runbook name. :param resource_group_name: Name of an Azure Resource group. @@ -50,10 +50,15 @@ def get_content( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ # Construct URL @@ -82,7 +87,7 @@ def get_content( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + response = self._client.send(request, header_parameters, stream=True, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -92,7 +97,7 @@ def get_content( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._client.stream_download(response, callback) if raw: client_raw_response = ClientRawResponse(deserialized, response)