diff --git a/azure-mgmt-automation/azure/mgmt/automation/automation_client.py b/azure-mgmt-automation/azure/mgmt/automation/automation_client.py index 32c774fd50e8..e268fa781d55 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/automation_client.py +++ b/azure-mgmt-automation/azure/mgmt/automation/automation_client.py @@ -42,6 +42,7 @@ from .operations.software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations from .operations.source_control_operations import SourceControlOperations from .operations.source_control_sync_job_operations import SourceControlSyncJobOperations +from .operations.source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations from .operations.job_operations import JobOperations from .operations.job_stream_operations import JobStreamOperations from .operations.agent_registration_information_operations import AgentRegistrationInformationOperations @@ -50,6 +51,7 @@ from .operations.dsc_compilation_job_operations import DscCompilationJobOperations from .operations.dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations from .operations.dsc_node_configuration_operations import DscNodeConfigurationOperations +from .operations.watcher_operations import WatcherOperations from . import models @@ -151,6 +153,8 @@ class AutomationClient(object): :vartype source_control: azure.mgmt.automation.operations.SourceControlOperations :ivar source_control_sync_job: SourceControlSyncJob operations :vartype source_control_sync_job: azure.mgmt.automation.operations.SourceControlSyncJobOperations + :ivar source_control_sync_job_streams: SourceControlSyncJobStreams operations + :vartype source_control_sync_job_streams: azure.mgmt.automation.operations.SourceControlSyncJobStreamsOperations :ivar job: Job operations :vartype job: azure.mgmt.automation.operations.JobOperations :ivar job_stream: JobStream operations @@ -167,6 +171,8 @@ class AutomationClient(object): :vartype dsc_compilation_job_stream: azure.mgmt.automation.operations.DscCompilationJobStreamOperations :ivar dsc_node_configuration: DscNodeConfiguration operations :vartype dsc_node_configuration: azure.mgmt.automation.operations.DscNodeConfigurationOperations + :ivar watcher: Watcher operations + :vartype watcher: azure.mgmt.automation.operations.WatcherOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -246,6 +252,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.source_control_sync_job = SourceControlSyncJobOperations( self._client, self.config, self._serialize, self._deserialize) + self.source_control_sync_job_streams = SourceControlSyncJobStreamsOperations( + self._client, self.config, self._serialize, self._deserialize) self.job = JobOperations( self._client, self.config, self._serialize, self._deserialize) self.job_stream = JobStreamOperations( @@ -262,3 +270,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.dsc_node_configuration = DscNodeConfigurationOperations( self._client, self.config, self._serialize, self._deserialize) + self.watcher = WatcherOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py index 4c088216d71c..c9809647a3bd 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py @@ -26,6 +26,7 @@ from .certificate import Certificate from .proxy_resource import ProxyResource from .resource import Resource +from .watcher import Watcher from .runbook_parameter import RunbookParameter from .content_hash import ContentHash from .content_link import ContentLink @@ -65,7 +66,6 @@ from .dsc_configuration_create_or_update_parameters import DscConfigurationCreateOrUpdateParameters from .dsc_configuration_update_parameters import DscConfigurationUpdateParameters from .dsc_meta_configuration import DscMetaConfiguration -from .dsc_node_configuration_create_or_update_parameters import DscNodeConfigurationCreateOrUpdateParameters from .dsc_node_configuration_association_property import DscNodeConfigurationAssociationProperty from .dsc_node_extension_handler_association_property import DscNodeExtensionHandlerAssociationProperty from .dsc_node_update_parameters_properties import DscNodeUpdateParametersProperties @@ -106,6 +106,8 @@ from .variable_update_parameters import VariableUpdateParameters from .webhook_create_or_update_parameters import WebhookCreateOrUpdateParameters from .webhook_update_parameters import WebhookUpdateParameters +from .watcher_update_parameters import WatcherUpdateParameters +from .watcher_create_or_update_parameters import WatcherCreateOrUpdateParameters from .job_collection_item import JobCollectionItem from .windows_properties import WindowsProperties from .linux_properties import LinuxProperties @@ -126,8 +128,11 @@ from .source_control_sync_job import SourceControlSyncJob from .source_control_sync_job_create_parameters import SourceControlSyncJobCreateParameters from .source_control_sync_job_by_id import SourceControlSyncJobById +from .source_control_sync_job_stream import SourceControlSyncJobStream +from .source_control_sync_job_stream_by_id import SourceControlSyncJobStreamById from .dsc_node import DscNode from .dsc_node_configuration import DscNodeConfiguration +from .dsc_node_configuration_create_or_update_parameters import DscNodeConfigurationCreateOrUpdateParameters from .automation_account_paged import AutomationAccountPaged from .operation_paged import OperationPaged from .statistics_paged import StatisticsPaged @@ -150,11 +155,13 @@ from .webhook_paged import WebhookPaged from .source_control_paged import SourceControlPaged from .source_control_sync_job_paged import SourceControlSyncJobPaged +from .source_control_sync_job_stream_paged import SourceControlSyncJobStreamPaged from .job_collection_item_paged import JobCollectionItemPaged from .dsc_node_paged import DscNodePaged from .dsc_node_report_paged import DscNodeReportPaged from .dsc_compilation_job_paged import DscCompilationJobPaged from .dsc_node_configuration_paged import DscNodeConfigurationPaged +from .watcher_paged import WatcherPaged from .automation_client_enums import ( AutomationKeyName, AutomationKeyPermissions, @@ -180,6 +187,7 @@ SourceType, ProvisioningState, StartType, + StreamType, ) __all__ = [ @@ -200,6 +208,7 @@ 'Certificate', 'ProxyResource', 'Resource', + 'Watcher', 'RunbookParameter', 'ContentHash', 'ContentLink', @@ -239,7 +248,6 @@ 'DscConfigurationCreateOrUpdateParameters', 'DscConfigurationUpdateParameters', 'DscMetaConfiguration', - 'DscNodeConfigurationCreateOrUpdateParameters', 'DscNodeConfigurationAssociationProperty', 'DscNodeExtensionHandlerAssociationProperty', 'DscNodeUpdateParametersProperties', @@ -280,6 +288,8 @@ 'VariableUpdateParameters', 'WebhookCreateOrUpdateParameters', 'WebhookUpdateParameters', + 'WatcherUpdateParameters', + 'WatcherCreateOrUpdateParameters', 'JobCollectionItem', 'WindowsProperties', 'LinuxProperties', @@ -300,8 +310,11 @@ 'SourceControlSyncJob', 'SourceControlSyncJobCreateParameters', 'SourceControlSyncJobById', + 'SourceControlSyncJobStream', + 'SourceControlSyncJobStreamById', 'DscNode', 'DscNodeConfiguration', + 'DscNodeConfigurationCreateOrUpdateParameters', 'AutomationAccountPaged', 'OperationPaged', 'StatisticsPaged', @@ -324,11 +337,13 @@ 'WebhookPaged', 'SourceControlPaged', 'SourceControlSyncJobPaged', + 'SourceControlSyncJobStreamPaged', 'JobCollectionItemPaged', 'DscNodePaged', 'DscNodeReportPaged', 'DscCompilationJobPaged', 'DscNodeConfigurationPaged', + 'WatcherPaged', 'AutomationKeyName', 'AutomationKeyPermissions', 'JobProvisioningState', @@ -353,4 +368,5 @@ 'SourceType', 'ProvisioningState', 'StartType', + 'StreamType', ] 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 45e479c41607..3940e282675e 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 @@ -254,3 +254,9 @@ class StartType(Enum): auto_sync = "AutoSync" manual_sync = "ManualSync" + + +class StreamType(Enum): + + error = "Error" + output = "Output" diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/dsc_node_configuration_create_or_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/dsc_node_configuration_create_or_update_parameters.py index 99e5af654b6f..4a070c2e15d4 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/dsc_node_configuration_create_or_update_parameters.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/dsc_node_configuration_create_or_update_parameters.py @@ -18,57 +18,35 @@ class DscNodeConfigurationCreateOrUpdateParameters(Model): :param source: Gets or sets the source. :type source: ~azure.mgmt.automation.models.ContentSource - :param name: Name of the node configuration. - :type name: str :param configuration: Gets or sets the configuration of the node. :type configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty - :param new_node_configuration_build_version_required: If a new build - version of NodeConfiguration is required. - :type new_node_configuration_build_version_required: bool - :param source1: Gets or sets the source. - :type source1: ~azure.mgmt.automation.models.ContentSource - :param name1: Gets or sets the type of the parameter. - :type name1: str - :param configuration1: Gets or sets the configuration of the node. - :type configuration1: - ~azure.mgmt.automation.models.DscConfigurationAssociationProperty :param increment_node_configuration_build: If a new build version of NodeConfiguration is required. :type increment_node_configuration_build: bool + :param name: Name of the node configuration. + :type name: str :param tags: Gets or sets the tags attached to the resource. :type tags: dict[str, str] """ _validation = { 'source': {'required': True}, - 'name': {'required': True}, 'configuration': {'required': True}, - 'source1': {'required': True}, - 'name1': {'required': True}, - 'configuration1': {'required': True}, } _attribute_map = { - 'source': {'key': 'source', 'type': 'ContentSource'}, - 'name': {'key': 'name', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'DscConfigurationAssociationProperty'}, - 'new_node_configuration_build_version_required': {'key': 'newNodeConfigurationBuildVersionRequired', 'type': 'bool'}, - 'source1': {'key': 'properties.source', 'type': 'ContentSource'}, - 'name1': {'key': 'properties.name', 'type': 'str'}, - 'configuration1': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'}, + 'source': {'key': 'properties.source', 'type': 'ContentSource'}, + 'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'}, 'increment_node_configuration_build': {'key': 'properties.incrementNodeConfigurationBuild', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, source, name, configuration, source1, name1, configuration1, new_node_configuration_build_version_required=None, increment_node_configuration_build=None, tags=None): + def __init__(self, source, configuration, increment_node_configuration_build=None, name=None, tags=None): super(DscNodeConfigurationCreateOrUpdateParameters, self).__init__() self.source = source - self.name = name self.configuration = configuration - self.new_node_configuration_build_version_required = new_node_configuration_build_version_required - self.source1 = source1 - self.name1 = name1 - self.configuration1 = configuration1 self.increment_node_configuration_build = increment_node_configuration_build + self.name = name self.tags = tags diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream.py new file mode 100644 index 000000000000..39217f3ba71e --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream.py @@ -0,0 +1,53 @@ +# 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 SourceControlSyncJobStream(Model): + """Definition of the source control sync job stream. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource id. + :vartype id: str + :param sync_job_stream_id: Gets the sync job stream id. + :type sync_job_stream_id: str + :param summary: Gets the summary of the sync job stream. + :type summary: str + :ivar time: Gets the time of the sync job stream. + :vartype time: datetime + :param stream_type: Gets the type of the sync job stream. Possible values + include: 'Error', 'Output' + :type stream_type: str or ~azure.mgmt.automation.models.StreamType + """ + + _validation = { + 'id': {'readonly': True}, + 'time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sync_job_stream_id': {'key': 'properties.syncJobStreamId', 'type': 'str'}, + 'summary': {'key': 'properties.summary', 'type': 'str'}, + 'time': {'key': 'properties.time', 'type': 'iso-8601'}, + 'stream_type': {'key': 'properties.streamType', 'type': 'str'}, + } + + def __init__(self, sync_job_stream_id=None, summary=None, stream_type=None): + super(SourceControlSyncJobStream, self).__init__() + self.id = None + self.sync_job_stream_id = sync_job_stream_id + self.summary = summary + self.time = None + self.stream_type = stream_type diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream_by_id.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream_by_id.py new file mode 100644 index 000000000000..274dcb497047 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream_by_id.py @@ -0,0 +1,61 @@ +# 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 SourceControlSyncJobStreamById(Model): + """Definition of the source control sync job stream by id. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource id. + :vartype id: str + :param sync_job_stream_id: Gets the sync job stream id. + :type sync_job_stream_id: str + :param summary: Gets the summary of the sync job stream. + :type summary: str + :ivar time: Gets the time of the sync job stream. + :vartype time: datetime + :param stream_type: Gets the type of the sync job stream. Possible values + include: 'Error', 'Output' + :type stream_type: str or ~azure.mgmt.automation.models.StreamType + :param stream_text: Gets the text of the sync job stream. + :type stream_text: str + :param value: Gets the value of the sync job stream. + :type value: str + """ + + _validation = { + 'id': {'readonly': True}, + 'time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'sync_job_stream_id': {'key': 'properties.syncJobStreamId', 'type': 'str'}, + 'summary': {'key': 'properties.summary', 'type': 'str'}, + 'time': {'key': 'properties.time', 'type': 'iso-8601'}, + 'stream_type': {'key': 'properties.streamType', 'type': 'str'}, + 'stream_text': {'key': 'properties.streamText', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': 'str'}, + } + + def __init__(self, sync_job_stream_id=None, summary=None, stream_type=None, stream_text=None, value=None): + super(SourceControlSyncJobStreamById, self).__init__() + self.id = None + self.sync_job_stream_id = sync_job_stream_id + self.summary = summary + self.time = None + self.stream_type = stream_type + self.stream_text = stream_text + self.value = value diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream_paged.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream_paged.py new file mode 100644 index 000000000000..9f5ed80415e0 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_stream_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 SourceControlSyncJobStreamPaged(Paged): + """ + A paging container for iterating over a list of :class:`SourceControlSyncJobStream ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SourceControlSyncJobStream]'} + } + + def __init__(self, *args, **kwargs): + + super(SourceControlSyncJobStreamPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/watcher.py b/azure-mgmt-automation/azure/mgmt/automation/models/watcher.py new file mode 100644 index 000000000000..41087a58ecbd --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/watcher.py @@ -0,0 +1,92 @@ +# 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 .tracked_resource import TrackedResource + + +class Watcher(TrackedResource): + """Definition of the watcher type. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: The Azure Region where the resource lives + :type location: str + :param execution_frequency_in_seconds: Gets or sets the frequency at which + the watcher is invoked. + :type execution_frequency_in_seconds: long + :param script_name: Gets or sets the name of the script the watcher is + attached to, i.e. the name of an existing runbook. + :type script_name: str + :param script_parameters: Gets or sets the parameters of the script. + :type script_parameters: dict[str, str] + :param script_run_on: Gets or sets the name of the hybrid worker group the + watcher will run on. + :type script_run_on: str + :param status: Gets the current status of the watcher. + :type status: str + :param creation_time: Gets or sets the creation time. + :type creation_time: datetime + :param last_modified_time: Gets or sets the last modified time. + :type last_modified_time: datetime + :param last_modified_by: Details of the user who last modified the + watcher. + :type last_modified_by: str + :param description: Gets or sets the description. + :type description: str + :param etag: Gets or sets the etag of the resource. + :type etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'execution_frequency_in_seconds': {'key': 'properties.executionFrequencyInSeconds', 'type': 'long'}, + 'script_name': {'key': 'properties.scriptName', 'type': 'str'}, + 'script_parameters': {'key': 'properties.scriptParameters', 'type': '{str}'}, + 'script_run_on': {'key': 'properties.scriptRunOn', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__(self, tags=None, location=None, execution_frequency_in_seconds=None, script_name=None, script_parameters=None, script_run_on=None, status=None, creation_time=None, last_modified_time=None, last_modified_by=None, description=None, etag=None): + super(Watcher, self).__init__(tags=tags, location=location) + self.execution_frequency_in_seconds = execution_frequency_in_seconds + self.script_name = script_name + self.script_parameters = script_parameters + self.script_run_on = script_run_on + self.status = status + self.creation_time = creation_time + self.last_modified_time = last_modified_time + self.last_modified_by = last_modified_by + self.description = description + self.etag = etag diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/watcher_create_or_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/watcher_create_or_update_parameters.py new file mode 100644 index 000000000000..63fdd3f91393 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/watcher_create_or_update_parameters.py @@ -0,0 +1,55 @@ +# 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 WatcherCreateOrUpdateParameters(Model): + """The parameters supplied to the create or update watcher operation. + + :param name: Gets or sets the name of the watcher. + :type name: str + :param execution_frequency_in_seconds: Gets or sets the frequency at which + the watcher is invoked. + :type execution_frequency_in_seconds: long + :param script_name: Gets or sets the name of the script the watcher is + attached to, i.e. the name of an existing runbook. + :type script_name: str + :param script_parameters: Gets or sets the parameters of the script. + :type script_parameters: dict[str, str] + :param script_run_on: Gets or sets the name of the hybrid worker group the + webhook job will run on. + :type script_run_on: str + :param description: Gets or sets the watcher's description. + :type description: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'execution_frequency_in_seconds': {'key': 'properties.executionFrequencyInSeconds', 'type': 'long'}, + 'script_name': {'key': 'properties.scriptName', 'type': 'str'}, + 'script_parameters': {'key': 'properties.scriptParameters', 'type': '{str}'}, + 'script_run_on': {'key': 'properties.scriptRunOn', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__(self, name, execution_frequency_in_seconds=None, script_name=None, script_parameters=None, script_run_on=None, description=None): + super(WatcherCreateOrUpdateParameters, self).__init__() + self.name = name + self.execution_frequency_in_seconds = execution_frequency_in_seconds + self.script_name = script_name + self.script_parameters = script_parameters + self.script_run_on = script_run_on + self.description = description diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/watcher_paged.py b/azure-mgmt-automation/azure/mgmt/automation/models/watcher_paged.py new file mode 100644 index 000000000000..0006d246f358 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/watcher_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 WatcherPaged(Paged): + """ + A paging container for iterating over a list of :class:`Watcher ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Watcher]'} + } + + def __init__(self, *args, **kwargs): + + super(WatcherPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/watcher_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/watcher_update_parameters.py new file mode 100644 index 000000000000..d90dce900912 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/watcher_update_parameters.py @@ -0,0 +1,33 @@ +# 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 WatcherUpdateParameters(Model): + """WatcherUpdateParameters. + + :param execution_frequency_in_seconds: Gets or sets the frequency at which + the watcher is invoked. + :type execution_frequency_in_seconds: long + :param name: Gets or sets the name of the resource. + :type name: str + """ + + _attribute_map = { + 'execution_frequency_in_seconds': {'key': 'properties.executionFrequencyInSeconds', 'type': 'long'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, execution_frequency_in_seconds=None, name=None): + super(WatcherUpdateParameters, self).__init__() + self.execution_frequency_in_seconds = execution_frequency_in_seconds + self.name = name diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py index 0669ef392a1b..4abbade8737f 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py @@ -38,6 +38,7 @@ from .software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations from .source_control_operations import SourceControlOperations from .source_control_sync_job_operations import SourceControlSyncJobOperations +from .source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations from .job_operations import JobOperations from .job_stream_operations import JobStreamOperations from .agent_registration_information_operations import AgentRegistrationInformationOperations @@ -46,6 +47,7 @@ from .dsc_compilation_job_operations import DscCompilationJobOperations from .dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations from .dsc_node_configuration_operations import DscNodeConfigurationOperations +from .watcher_operations import WatcherOperations __all__ = [ 'AutomationAccountOperations', @@ -77,6 +79,7 @@ 'SoftwareUpdateConfigurationMachineRunsOperations', 'SourceControlOperations', 'SourceControlSyncJobOperations', + 'SourceControlSyncJobStreamsOperations', 'JobOperations', 'JobStreamOperations', 'AgentRegistrationInformationOperations', @@ -85,4 +88,5 @@ 'DscCompilationJobOperations', 'DscCompilationJobStreamOperations', 'DscNodeConfigurationOperations', + 'WatcherOperations', ] diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_sync_job_streams_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_sync_job_streams_operations.py new file mode 100644 index 000000000000..013ea0cb25ed --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_sync_job_streams_operations.py @@ -0,0 +1,188 @@ +# 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 .. import models + + +class SourceControlSyncJobStreamsOperations(object): + """SourceControlSyncJobStreamsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-05-15-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-05-15-preview" + + self.config = config + + def list_by_sync_job( + self, resource_group_name, automation_account_name, source_control_name, source_control_sync_job_id, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieve a list of sync job streams identified by sync job id. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. + :type automation_account_name: str + :param source_control_name: The source control name. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. + :type source_control_sync_job_id: str + :param filter: The filter to apply on the operation. + :type filter: 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 SourceControlSyncJobStream + :rtype: + ~azure.mgmt.automation.models.SourceControlSyncJobStreamPaged[~azure.mgmt.automation.models.SourceControlSyncJobStream] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_sync_job.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_name, 'str'), + 'sourceControlSyncJobId': self._serialize.url("source_control_sync_job_id", source_control_sync_job_id, '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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.SourceControlSyncJobStreamPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SourceControlSyncJobStreamPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_sync_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams'} + + def get( + self, resource_group_name, automation_account_name, source_control_name, source_control_sync_job_id, stream_id, custom_headers=None, raw=False, **operation_config): + """Retrieve a sync job stream identified by stream id. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. + :type automation_account_name: str + :param source_control_name: The source control name. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. + :type source_control_sync_job_id: str + :param stream_id: The id of the sync job stream. + :type stream_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`. + :return: SourceControlSyncJobStreamById or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_name, 'str'), + 'sourceControlSyncJobId': self._serialize.url("source_control_sync_job_id", source_control_sync_job_id, 'str'), + 'streamId': self._serialize.url("stream_id", stream_id, '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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SourceControlSyncJobStreamById', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}'} diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/watcher_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/watcher_operations.py new file mode 100644 index 000000000000..97e2cb1f3eea --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/watcher_operations.py @@ -0,0 +1,491 @@ +# 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 .. import models + + +class WatcherOperations(object): + """WatcherOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2015-10-31". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2015-10-31" + + self.config = config + + def create_or_update( + self, resource_group_name, automation_account_name, watcher_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create the watcher identified by watcher name. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param watcher_name: The watcher name. + :type watcher_name: str + :param parameters: The create or update parameters for watcher. + :type parameters: + ~azure.mgmt.automation.models.WatcherCreateOrUpdateParameters + :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: Watcher or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.Watcher or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'watcherName': self._serialize.url("watcher_name", 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, 'WatcherCreateOrUpdateParameters') + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Watcher', response) + if response.status_code == 201: + deserialized = self._deserialize('Watcher', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}'} + + def get( + self, resource_group_name, automation_account_name, watcher_name, custom_headers=None, raw=False, **operation_config): + """Retrieve the watcher identified by watcher name. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param watcher_name: The watcher name. + :type 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: Watcher or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.Watcher or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'watcherName': self._serialize.url("watcher_name", 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 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Watcher', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}'} + + def update( + self, resource_group_name, automation_account_name, watcher_name, execution_frequency_in_seconds=None, name=None, custom_headers=None, raw=False, **operation_config): + """Update the watcher identified by watcher name. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param watcher_name: The watcher name. + :type watcher_name: str + :param execution_frequency_in_seconds: Gets or sets the frequency at + which the watcher is invoked. + :type execution_frequency_in_seconds: long + :param name: Gets or sets the name of the resource. + :type name: 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: Watcher or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.Watcher or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.WatcherUpdateParameters(execution_frequency_in_seconds=execution_frequency_in_seconds, name=name) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'watcherName': self._serialize.url("watcher_name", 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, 'WatcherUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Watcher', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}'} + + def delete( + self, resource_group_name, automation_account_name, watcher_name, custom_headers=None, raw=False, **operation_config): + """Delete the watcher by name. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param watcher_name: The watcher name. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'watcherName': self._serialize.url("watcher_name", 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 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 [200]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}'} + + def start( + self, resource_group_name, automation_account_name, watcher_name, custom_headers=None, raw=False, **operation_config): + """Resume the watcher identified by watcher name. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param watcher_name: The watcher name. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.start.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'watcherName': self._serialize.url("watcher_name", 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 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]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/start'} + + def stop( + self, resource_group_name, automation_account_name, watcher_name, custom_headers=None, raw=False, **operation_config): + """Resume the watcher identified by watcher name. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param watcher_name: The watcher name. + :type 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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.stop.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'watcherName': self._serialize.url("watcher_name", 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 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]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/stop'} + + def list_by_automation_account( + self, resource_group_name, automation_account_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieve a list of watchers. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param filter: The filter to apply on the operation. + :type filter: 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 Watcher + :rtype: + ~azure.mgmt.automation.models.WatcherPaged[~azure.mgmt.automation.models.Watcher] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_automation_account.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.WatcherPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.WatcherPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_automation_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers'}