diff --git a/azure-mgmt-automation/azure/mgmt/automation/automation_client.py b/azure-mgmt-automation/azure/mgmt/automation/automation_client.py index 4a18da92a74f..640a4f5bc95f 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/automation_client.py +++ b/azure-mgmt-automation/azure/mgmt/automation/automation_client.py @@ -28,8 +28,6 @@ from .operations.node_reports_operations import NodeReportsOperations from .operations.dsc_node_configuration_operations import DscNodeConfigurationOperations from .operations.hybrid_runbook_worker_group_operations import HybridRunbookWorkerGroupOperations -from .operations.job_operations import JobOperations -from .operations.job_stream_operations import JobStreamOperations from .operations.job_schedule_operations import JobScheduleOperations from .operations.activity_operations import ActivityOperations from .operations.module_operations import ModuleOperations @@ -38,6 +36,7 @@ from .operations.runbook_draft_operations import RunbookDraftOperations from .operations.runbook_operations import RunbookOperations from .operations.test_job_streams_operations import TestJobStreamsOperations +from .operations.test_job_operations import TestJobOperations from .operations.test_jobs_operations import TestJobsOperations from .operations.schedule_operations import ScheduleOperations from .operations.variable_operations import VariableOperations @@ -47,6 +46,8 @@ 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.job_operations import JobOperations +from .operations.job_stream_operations import JobStreamOperations from . import models @@ -133,10 +134,6 @@ class AutomationClient(object): :vartype dsc_node_configuration: azure.mgmt.automation.operations.DscNodeConfigurationOperations :ivar hybrid_runbook_worker_group: HybridRunbookWorkerGroup operations :vartype hybrid_runbook_worker_group: azure.mgmt.automation.operations.HybridRunbookWorkerGroupOperations - :ivar job: Job operations - :vartype job: azure.mgmt.automation.operations.JobOperations - :ivar job_stream: JobStream operations - :vartype job_stream: azure.mgmt.automation.operations.JobStreamOperations :ivar job_schedule: JobSchedule operations :vartype job_schedule: azure.mgmt.automation.operations.JobScheduleOperations :ivar activity: Activity operations @@ -153,6 +150,8 @@ class AutomationClient(object): :vartype runbook: azure.mgmt.automation.operations.RunbookOperations :ivar test_job_streams: TestJobStreams operations :vartype test_job_streams: azure.mgmt.automation.operations.TestJobStreamsOperations + :ivar test_job: TestJob operations + :vartype test_job: azure.mgmt.automation.operations.TestJobOperations :ivar test_jobs: TestJobs operations :vartype test_jobs: azure.mgmt.automation.operations.TestJobsOperations :ivar schedule: Schedule operations @@ -171,6 +170,10 @@ 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 job: Job operations + :vartype job: azure.mgmt.automation.operations.JobOperations + :ivar job_stream: JobStream operations + :vartype job_stream: azure.mgmt.automation.operations.JobStreamOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -228,10 +231,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.hybrid_runbook_worker_group = HybridRunbookWorkerGroupOperations( self._client, self.config, self._serialize, self._deserialize) - self.job = JobOperations( - self._client, self.config, self._serialize, self._deserialize) - self.job_stream = JobStreamOperations( - self._client, self.config, self._serialize, self._deserialize) self.job_schedule = JobScheduleOperations( self._client, self.config, self._serialize, self._deserialize) self.activity = ActivityOperations( @@ -248,6 +247,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.test_job_streams = TestJobStreamsOperations( self._client, self.config, self._serialize, self._deserialize) + self.test_job = TestJobOperations( + self._client, self.config, self._serialize, self._deserialize) self.test_jobs = TestJobsOperations( self._client, self.config, self._serialize, self._deserialize) self.schedule = ScheduleOperations( @@ -266,3 +267,7 @@ 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.job = JobOperations( + self._client, self.config, self._serialize, self._deserialize) + self.job_stream = JobStreamOperations( + 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 8f07551154df..0a980e4f2c12 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py @@ -72,14 +72,17 @@ from .hybrid_runbook_worker_group import HybridRunbookWorkerGroup from .hybrid_runbook_worker_group_update_parameters import HybridRunbookWorkerGroupUpdateParameters from .runbook_association_property import RunbookAssociationProperty +from .provisioning_state_property import ProvisioningStateProperty from .job import Job from .job_create_parameters import JobCreateParameters +from .job_list_result import JobListResult from .schedule_association_property import ScheduleAssociationProperty from .job_schedule_create_parameters import JobScheduleCreateParameters from .job_schedule import JobSchedule from .job_stream import JobStream from .module_create_or_update_parameters import ModuleCreateOrUpdateParameters from .module_update_parameters import ModuleUpdateParameters +from .proxy_resource import ProxyResource from .runbook_draft_undo_edit_result import RunbookDraftUndoEditResult from .runbook_create_or_update_parameters import RunbookCreateOrUpdateParameters from .runbook_create_or_update_draft_properties import RunbookCreateOrUpdateDraftProperties @@ -118,6 +121,7 @@ from .source_control_sync_job import SourceControlSyncJob from .source_control_sync_job_by_id_errors import SourceControlSyncJobByIdErrors from .source_control_sync_job_by_id import SourceControlSyncJobById +from .job_collection_item import JobCollectionItem from .automation_account_paged import AutomationAccountPaged from .operation_paged import OperationPaged from .statistics_paged import StatisticsPaged @@ -132,18 +136,18 @@ from .dsc_node_report_paged import DscNodeReportPaged from .dsc_node_configuration_paged import DscNodeConfigurationPaged from .hybrid_runbook_worker_group_paged import HybridRunbookWorkerGroupPaged -from .job_paged import JobPaged -from .job_stream_paged import JobStreamPaged from .job_schedule_paged import JobSchedulePaged from .activity_paged import ActivityPaged from .module_paged import ModulePaged from .type_field_paged import TypeFieldPaged from .runbook_paged import RunbookPaged +from .job_stream_paged import JobStreamPaged from .schedule_paged import SchedulePaged from .variable_paged import VariablePaged from .webhook_paged import WebhookPaged from .source_control_paged import SourceControlPaged from .source_control_sync_job_paged import SourceControlSyncJobPaged +from .job_collection_item_paged import JobCollectionItemPaged from .automation_client_enums import ( RunbookTypeEnum, RunbookState, @@ -231,14 +235,17 @@ 'HybridRunbookWorkerGroup', 'HybridRunbookWorkerGroupUpdateParameters', 'RunbookAssociationProperty', + 'ProvisioningStateProperty', 'Job', 'JobCreateParameters', + 'JobListResult', 'ScheduleAssociationProperty', 'JobScheduleCreateParameters', 'JobSchedule', 'JobStream', 'ModuleCreateOrUpdateParameters', 'ModuleUpdateParameters', + 'ProxyResource', 'RunbookDraftUndoEditResult', 'RunbookCreateOrUpdateParameters', 'RunbookCreateOrUpdateDraftProperties', @@ -277,6 +284,7 @@ 'SourceControlSyncJob', 'SourceControlSyncJobByIdErrors', 'SourceControlSyncJobById', + 'JobCollectionItem', 'AutomationAccountPaged', 'OperationPaged', 'StatisticsPaged', @@ -291,18 +299,18 @@ 'DscNodeReportPaged', 'DscNodeConfigurationPaged', 'HybridRunbookWorkerGroupPaged', - 'JobPaged', - 'JobStreamPaged', 'JobSchedulePaged', 'ActivityPaged', 'ModulePaged', 'TypeFieldPaged', 'RunbookPaged', + 'JobStreamPaged', 'SchedulePaged', 'VariablePaged', 'WebhookPaged', 'SourceControlPaged', 'SourceControlSyncJobPaged', + 'JobCollectionItemPaged', 'RunbookTypeEnum', 'RunbookState', 'RunbookProvisioningState', diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/job.py b/azure-mgmt-automation/azure/mgmt/automation/models/job.py index 5433e56ea2c0..b8f0a99423e4 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/job.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/job.py @@ -9,14 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .proxy_resource import ProxyResource -class Job(Model): +class Job(ProxyResource): """Definition of the job. - :param id: Gets or sets the id of the resource. - :type id: str + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str :param runbook: Gets or sets the runbook. :type runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty :param started_by: Gets or sets the job started by. @@ -48,10 +55,21 @@ class Job(Model): :type last_status_modified_time: datetime :param parameters: Gets or sets the parameters of the job. :type parameters: dict[str, str] + :param provisioning_state: The provisioning state of a resource. + :type provisioning_state: + ~azure.mgmt.automation.models.ProvisioningStateProperty """ + _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'}, 'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'}, 'started_by': {'key': 'properties.startedBy', 'type': 'str'}, 'run_on': {'key': 'properties.runOn', 'type': 'str'}, @@ -65,11 +83,11 @@ class Job(Model): 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, 'last_status_modified_time': {'key': 'properties.lastStatusModifiedTime', 'type': 'iso-8601'}, 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningStateProperty'}, } - def __init__(self, id=None, runbook=None, started_by=None, run_on=None, job_id=None, creation_time=None, status=None, status_details=None, start_time=None, end_time=None, exception=None, last_modified_time=None, last_status_modified_time=None, parameters=None): + def __init__(self, runbook=None, started_by=None, run_on=None, job_id=None, creation_time=None, status=None, status_details=None, start_time=None, end_time=None, exception=None, last_modified_time=None, last_status_modified_time=None, parameters=None, provisioning_state=None): super(Job, self).__init__() - self.id = id self.runbook = runbook self.started_by = started_by self.run_on = run_on @@ -83,3 +101,4 @@ def __init__(self, id=None, runbook=None, started_by=None, run_on=None, job_id=N self.last_modified_time = last_modified_time self.last_status_modified_time = last_status_modified_time self.parameters = parameters + self.provisioning_state = provisioning_state diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/job_collection_item.py b/azure-mgmt-automation/azure/mgmt/automation/models/job_collection_item.py new file mode 100644 index 000000000000..4e92fb388ea2 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/job_collection_item.py @@ -0,0 +1,78 @@ +# 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 .proxy_resource import ProxyResource + + +class JobCollectionItem(ProxyResource): + """Job collection item properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param runbook: The runbook association. + :type runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty + :param job_id: The id of the job. + :type job_id: str + :param creation_time: The creation time of the job. + :type creation_time: datetime + :param status: The status of the job. Possible values include: 'New', + 'Activating', 'Running', 'Completed', 'Failed', 'Stopped', 'Blocked', + 'Suspended', 'Disconnected', 'Suspending', 'Stopping', 'Resuming', + 'Removing' + :type status: str or ~azure.mgmt.automation.models.JobStatus + :param start_time: The start time of the job. + :type start_time: datetime + :param end_time: The end time of the job. + :type end_time: datetime + :param last_modified_time: The last modified time of the job. + :type last_modified_time: datetime + :param provisioning_state: The current provisioning state of the job. + :type provisioning_state: + ~azure.mgmt.automation.models.ProvisioningStateProperty + """ + + _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'}, + 'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'}, + 'job_id': {'key': 'properties.jobId', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningStateProperty'}, + } + + def __init__(self, runbook=None, job_id=None, creation_time=None, status=None, start_time=None, end_time=None, last_modified_time=None, provisioning_state=None): + super(JobCollectionItem, self).__init__() + self.runbook = runbook + self.job_id = job_id + self.creation_time = creation_time + self.status = status + self.start_time = start_time + self.end_time = end_time + self.last_modified_time = last_modified_time + self.provisioning_state = provisioning_state diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/job_paged.py b/azure-mgmt-automation/azure/mgmt/automation/models/job_collection_item_paged.py similarity index 67% rename from azure-mgmt-automation/azure/mgmt/automation/models/job_paged.py rename to azure-mgmt-automation/azure/mgmt/automation/models/job_collection_item_paged.py index 9e9730212179..caa9d0b73f80 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/job_paged.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/job_collection_item_paged.py @@ -12,16 +12,16 @@ from msrest.paging import Paged -class JobPaged(Paged): +class JobCollectionItemPaged(Paged): """ - A paging container for iterating over a list of :class:`Job ` object + A paging container for iterating over a list of :class:`JobCollectionItem ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Job]'} + 'current_page': {'key': 'value', 'type': '[JobCollectionItem]'} } def __init__(self, *args, **kwargs): - super(JobPaged, self).__init__(*args, **kwargs) + super(JobCollectionItemPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/job_create_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/job_create_parameters.py index 52879fee68ab..0af43145f55c 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/job_create_parameters.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/job_create_parameters.py @@ -22,12 +22,6 @@ class JobCreateParameters(Model): :param run_on: Gets or sets the runOn which specifies the group name where the job is to be executed. :type run_on: str - :param name: Gets or sets name of the resource. - :type name: str - :param location: Gets or sets the location of the resource. - :type location: str - :param tags: Gets or sets the tags attached to the resource. - :type tags: dict[str, str] """ _validation = { @@ -38,16 +32,10 @@ class JobCreateParameters(Model): 'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'}, 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, 'run_on': {'key': 'properties.runOn', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, runbook, parameters=None, run_on=None, name=None, location=None, tags=None): + def __init__(self, runbook, parameters=None, run_on=None): super(JobCreateParameters, self).__init__() self.runbook = runbook self.parameters = parameters self.run_on = run_on - self.name = name - self.location = location - self.tags = tags diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/job_list_result.py b/azure-mgmt-automation/azure/mgmt/automation/models/job_list_result.py new file mode 100644 index 000000000000..d7421c478d72 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/job_list_result.py @@ -0,0 +1,32 @@ +# 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 JobListResult(Model): + """The response model for the list job operation. + + :param value: Gets or sets a list of jobs. + :type value: list[~azure.mgmt.automation.models.Job] + :param next_link: Gets or sets the next link. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Job]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, value=None, next_link=None): + super(JobListResult, self).__init__() + self.value = value + self.next_link = next_link diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/provisioning_state_property.py b/azure-mgmt-automation/azure/mgmt/automation/models/provisioning_state_property.py new file mode 100644 index 000000000000..6f747c4a3649 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/provisioning_state_property.py @@ -0,0 +1,35 @@ +# 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 ProvisioningStateProperty(Model): + """The provisioning state property. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The provisioning state of the resource. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self): + super(ProvisioningStateProperty, self).__init__() + self.provisioning_state = None diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/proxy_resource.py b/azure-mgmt-automation/azure/mgmt/automation/models/proxy_resource.py new file mode 100644 index 000000000000..74aae2dcfdd7 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/proxy_resource.py @@ -0,0 +1,45 @@ +# 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 ProxyResource(Model): + """The Resource definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: 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'}, + } + + def __init__(self): + super(ProxyResource, self).__init__() + self.id = None + self.name = None + self.type = None diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/webhook.py b/azure-mgmt-automation/azure/mgmt/automation/models/webhook.py index de6e7e5ea78d..dd6acce1d8b7 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/webhook.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/webhook.py @@ -15,10 +15,15 @@ class Webhook(Model): """Definition of the webhook type. - :param id: Gets or sets the id of the resource. - :type id: str - :param name: Gets or sets the name of the webhook. - :type name: str + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Gets the id of the resource. + :vartype id: str + :ivar name: Gets the name of the webhook. + :vartype name: str + :ivar type: Gets the type of the resource. + :vartype type: str :param is_enabled: Gets or sets the value of the enabled flag of the webhook. Default value: False . :type is_enabled: bool @@ -44,9 +49,16 @@ class Webhook(Model): :type description: 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'}, 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, 'uri': {'key': 'properties.uri', 'type': 'str'}, 'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'}, @@ -59,10 +71,11 @@ class Webhook(Model): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, id=None, name=None, is_enabled=False, uri=None, expiry_time=None, last_invoked_time=None, parameters=None, runbook=None, run_on=None, creation_time=None, last_modified_time=None, description=None): + def __init__(self, is_enabled=False, uri=None, expiry_time=None, last_invoked_time=None, parameters=None, runbook=None, run_on=None, creation_time=None, last_modified_time=None, description=None): super(Webhook, self).__init__() - self.id = id - self.name = name + self.id = None + self.name = None + self.type = None self.is_enabled = is_enabled self.uri = uri self.expiry_time = expiry_time diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py index 915e99f7c5ba..53e2806557b3 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py @@ -24,8 +24,6 @@ from .node_reports_operations import NodeReportsOperations from .dsc_node_configuration_operations import DscNodeConfigurationOperations from .hybrid_runbook_worker_group_operations import HybridRunbookWorkerGroupOperations -from .job_operations import JobOperations -from .job_stream_operations import JobStreamOperations from .job_schedule_operations import JobScheduleOperations from .activity_operations import ActivityOperations from .module_operations import ModuleOperations @@ -34,6 +32,7 @@ from .runbook_draft_operations import RunbookDraftOperations from .runbook_operations import RunbookOperations from .test_job_streams_operations import TestJobStreamsOperations +from .test_job_operations import TestJobOperations from .test_jobs_operations import TestJobsOperations from .schedule_operations import ScheduleOperations from .variable_operations import VariableOperations @@ -43,6 +42,8 @@ from .software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations from .source_control_operations import SourceControlOperations from .source_control_sync_job_operations import SourceControlSyncJobOperations +from .job_operations import JobOperations +from .job_stream_operations import JobStreamOperations __all__ = [ 'AutomationAccountOperations', @@ -60,8 +61,6 @@ 'NodeReportsOperations', 'DscNodeConfigurationOperations', 'HybridRunbookWorkerGroupOperations', - 'JobOperations', - 'JobStreamOperations', 'JobScheduleOperations', 'ActivityOperations', 'ModuleOperations', @@ -70,6 +69,7 @@ 'RunbookDraftOperations', 'RunbookOperations', 'TestJobStreamsOperations', + 'TestJobOperations', 'TestJobsOperations', 'ScheduleOperations', 'VariableOperations', @@ -79,4 +79,6 @@ 'SoftwareUpdateConfigurationMachineRunsOperations', 'SourceControlOperations', 'SourceControlSyncJobOperations', + 'JobOperations', + 'JobStreamOperations', ] 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 46366634de75..a23407ad6f80 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/job_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/job_operations.py @@ -11,6 +11,7 @@ import uuid from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError from .. import models @@ -22,7 +23,7 @@ class JobOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserializer. - :ivar api_version: Client Api Version. Constant value: "2015-10-31". + :ivar api_version: Client Api Version. Constant value: "2017-05-15-preview". """ models = models @@ -32,40 +33,32 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-10-31" + self.api_version = "2017-05-15-preview" self.config = config def get_output( - self, automation_account_name, job_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Retrieve the job output identified by job id. + self, job_name, custom_headers=None, raw=False, **operation_config): + """Retrieve the job output identified by job name. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job id. - :type job_id: str + :param job_name: The name of the job to be created. + :type job_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 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: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :return: str or ClientRawResponse if raw=true + :rtype: str or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/output' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -80,20 +73,24 @@ def get_output( header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') 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=True, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: - deserialized = self._client.stream_download(response, callback) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -102,35 +99,27 @@ def get_output( return deserialized def get_runbook_content( - self, automation_account_name, job_id, custom_headers=None, raw=False, callback=None, **operation_config): - """Retrieve the runbook content of the job identified by job id. + self, job_name, custom_headers=None, raw=False, **operation_config): + """Retrieve the runbook content of the job identified by job name. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job id. - :type job_id: str + :param job_name: The job name. + :type job_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 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: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :return: str or ClientRawResponse if raw=true + :rtype: str or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/runbookContent' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -145,20 +134,24 @@ def get_runbook_content( header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') 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=True, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: - deserialized = self._client.stream_download(response, callback) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -167,13 +160,11 @@ def get_runbook_content( return deserialized def suspend( - self, automation_account_name, job_id, custom_headers=None, raw=False, **operation_config): - """Suspend the job identified by jobId. + self, job_name, custom_headers=None, raw=False, **operation_config): + """Suspend the job identified by job name. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job id. - :type job_id: str + :param job_name: The job name. + :type job_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 @@ -185,12 +176,12 @@ def suspend( :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/suspend' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -205,6 +196,8 @@ def suspend( header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') @@ -220,13 +213,11 @@ def suspend( return client_raw_response def stop( - self, automation_account_name, job_id, custom_headers=None, raw=False, **operation_config): - """Stop the job identified by jobId. + self, job_name, custom_headers=None, raw=False, **operation_config): + """Stop the job identified by jobName. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job id. - :type job_id: str + :param job_name: The job name. + :type job_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 @@ -238,11 +229,11 @@ def stop( :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/stop' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop' path_format_arguments = { 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -258,6 +249,8 @@ def stop( header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') @@ -273,13 +266,11 @@ def stop( return client_raw_response def get( - self, automation_account_name, job_id, custom_headers=None, raw=False, **operation_config): - """Retrieve the job identified by job id. + self, job_name, custom_headers=None, raw=False, **operation_config): + """Retrieve the job identified by job name. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job id. - :type job_id: str + :param job_name: The job name. + :type job_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 @@ -292,12 +283,12 @@ def get( :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -312,6 +303,8 @@ def get( header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') @@ -334,13 +327,11 @@ def get( return deserialized def create( - self, automation_account_name, job_id, parameters, custom_headers=None, raw=False, **operation_config): + self, job_name, parameters, custom_headers=None, raw=False, **operation_config): """Create a job of the runbook. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job id. - :type job_id: str + :param job_name: The job name. + :type job_name: str :param parameters: The parameters supplied to the create job operation. :type parameters: ~azure.mgmt.automation.models.JobCreateParameters @@ -356,12 +347,12 @@ def create( :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -376,6 +367,8 @@ def create( header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') @@ -402,11 +395,9 @@ def create( return deserialized def list_by_automation_account( - self, automation_account_name, filter=None, custom_headers=None, raw=False, **operation_config): + self, filter=None, custom_headers=None, raw=False, **operation_config): """Retrieve a list of jobs. - :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 @@ -414,9 +405,9 @@ def list_by_automation_account( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of Job + :return: An iterator like instance of JobCollectionItem :rtype: - ~azure.mgmt.automation.models.JobPaged[~azure.mgmt.automation.models.Job] + ~azure.mgmt.automation.models.JobCollectionItemPaged[~azure.mgmt.automation.models.JobCollectionItem] :raises: :class:`ErrorResponseException` """ @@ -427,7 +418,7 @@ def internal_paging(next_link=None, raw=False): url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs' path_format_arguments = { 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.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) @@ -449,6 +440,8 @@ def internal_paging(next_link=None, raw=False): header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') @@ -463,23 +456,21 @@ def internal_paging(next_link=None, raw=False): return response # Deserialize response - deserialized = models.JobPaged(internal_paging, self._deserialize.dependencies) + deserialized = models.JobCollectionItemPaged(internal_paging, self._deserialize.dependencies) if raw: header_dict = {} - client_raw_response = models.JobPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = models.JobCollectionItemPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized def resume( - self, automation_account_name, job_id, custom_headers=None, raw=False, **operation_config): - """Resume the job identified by jobId. + self, job_name, custom_headers=None, raw=False, **operation_config): + """Resume the job identified by jobName. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job id. - :type job_id: str + :param job_name: The job name. + :type job_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 @@ -491,11 +482,11 @@ def resume( :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/resume' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume' path_format_arguments = { 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -511,6 +502,8 @@ def resume( header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/job_stream_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/job_stream_operations.py index e4c612c5c9ec..efcd08b95c1a 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/job_stream_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/job_stream_operations.py @@ -22,7 +22,7 @@ class JobStreamOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An objec model deserializer. - :ivar api_version: Client Api Version. Constant value: "2015-10-31". + :ivar api_version: Client Api Version. Constant value: "2017-05-15-preview". """ models = models @@ -32,18 +32,16 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-10-31" + self.api_version = "2017-05-15-preview" self.config = config def get( - self, automation_account_name, job_id, job_stream_id, custom_headers=None, raw=False, **operation_config): + self, job_name, job_stream_id, custom_headers=None, raw=False, **operation_config): """Retrieve the job stream identified by job stream id. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job id. - :type job_id: str + :param job_name: The job name. + :type job_name: str :param job_stream_id: The job stream id. :type job_stream_id: str :param dict custom_headers: headers that will be added to the request @@ -58,13 +56,13 @@ def get( :class:`ErrorResponseException` """ # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/streams/{jobStreamId}' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), - 'jobStreamId': self._serialize.url("job_stream_id", job_stream_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str'), + 'jobStreamId': self._serialize.url("job_stream_id", job_stream_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -79,6 +77,8 @@ def get( header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') @@ -101,13 +101,11 @@ def get( return deserialized def list_by_job( - self, automation_account_name, job_id, filter=None, custom_headers=None, raw=False, **operation_config): - """Retrieve a list of jobs streams identified by job id. + self, job_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieve a list of jobs streams identified by job name. - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param job_id: The job Id. - :type job_id: str + :param job_name: The job name. + :type job_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 @@ -125,11 +123,11 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/streams' + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams' path_format_arguments = { 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'jobId': self._serialize.url("job_id", job_id, 'str'), + 'automationAccountName': self._serialize.url("self.config.automation_account_name", self.config.automation_account_name, 'str'), + 'jobName': self._serialize.url("job_name", job_name, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -151,6 +149,8 @@ def internal_paging(next_link=None, raw=False): header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: header_parameters.update(custom_headers) + if self.config.client_request_id is not None: + header_parameters['clientRequestId'] = self._serialize.header("self.config.client_request_id", self.config.client_request_id, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') 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 413c1cb8b35b..724c2ccf3edd 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 @@ -11,6 +11,7 @@ import uuid from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller @@ -39,7 +40,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_content( - self, automation_account_name, runbook_name, custom_headers=None, raw=False, callback=None, **operation_config): + self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): """Retrieve the content of runbook draft identified by runbook name. :param automation_account_name: The automation account name. @@ -49,25 +50,19 @@ 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: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :return: str or ClientRawResponse if raw=true + :rtype: str or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` """ # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -87,15 +82,17 @@ def get_content( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=True, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: - deserialized = self._client.stream_download(response, callback) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -104,15 +101,15 @@ def get_content( return deserialized - def _create_or_update_initial( - self, automation_account_name, runbook_name, runbook_content, custom_headers=None, raw=False, callback=None, **operation_config): + def _replace_content_initial( + self, automation_account_name, runbook_name, runbook_content, custom_headers=None, raw=False, **operation_config): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -122,7 +119,7 @@ def _create_or_update_initial( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Content-Type'] = 'text/powershell' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -131,7 +128,7 @@ def _create_or_update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = upload_gen(runbook_content) + body_content = self._serialize.body(runbook_content, 'str') # Construct and send request request = self._client.put(url, query_parameters) @@ -143,18 +140,22 @@ def _create_or_update_initial( if raw: client_raw_response = ClientRawResponse(None, response) + header_dict = { + 'location': 'str', + } + client_raw_response.add_headers(header_dict) return client_raw_response - def create_or_update( - self, automation_account_name, runbook_name, runbook_content, custom_headers=None, raw=False, callback=None, **operation_config): - """Updates the runbook draft with runbookStream as its content. + def replace_content( + self, automation_account_name, runbook_name, runbook_content, custom_headers=None, raw=False, **operation_config): + """Replaces the runbook draft content. :param automation_account_name: The automation account name. :type automation_account_name: str :param runbook_name: The runbook name. :type runbook_name: str :param runbook_content: The runbook draft content. - :type runbook_content: Generator + :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 @@ -165,7 +166,7 @@ def create_or_update( :raises: :class:`ErrorResponseException` """ - raw_result = self._create_or_update_initial( + raw_result = self._replace_content_initial( automation_account_name=automation_account_name, runbook_name=runbook_name, runbook_content=runbook_content, @@ -197,6 +198,9 @@ def get_long_running_output(response): if raw: client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'location': 'str', + }) return client_raw_response long_running_operation_timeout = operation_config.get( @@ -228,10 +232,10 @@ def get( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -273,10 +277,10 @@ def _publish_initial( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/publish' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -301,17 +305,14 @@ def _publish_initial( if response.status_code not in [200, 202]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Runbook', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) + header_dict = { + 'location': 'str', + } + client_raw_response.add_headers(header_dict) return client_raw_response - return deserialized - def publish( self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): """Publish runbook draft. @@ -324,11 +325,10 @@ def publish( :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 Runbook or + :return: An instance of AzureOperationPoller that returns None or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.automation.models.Runbook] - or ~msrest.pipeline.ClientRawResponse + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ @@ -361,14 +361,13 @@ def get_long_running_output(response): if response.status_code not in [200, 202]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = self._deserialize('Runbook', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'location': 'str', + }) return client_raw_response - return deserialized - long_running_operation_timeout = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) @@ -378,7 +377,8 @@ def get_long_running_output(response): def undo_edit( self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): - """Retrieve the runbook identified by runbook name. + """Undo draft edit to last known published state identified by runbook + name. :param automation_account_name: The automation account name. :type automation_account_name: str @@ -398,10 +398,10 @@ def undo_edit( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) 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 8b2a10292eee..5fb5e3611db0 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py @@ -11,6 +11,7 @@ import uuid from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError from .. import models @@ -37,7 +38,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_content( - self, automation_account_name, runbook_name, custom_headers=None, raw=False, callback=None, **operation_config): + self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): """Retrieve the content of runbook identified by runbook name. :param automation_account_name: The automation account name. @@ -47,25 +48,19 @@ 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: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` + :return: str or ClientRawResponse if raw=true + :rtype: str or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` """ # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -85,15 +80,17 @@ def get_content( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=True, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp deserialized = None if response.status_code == 200: - deserialized = self._client.stream_download(response, callback) + deserialized = self._deserialize('str', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -123,10 +120,10 @@ def get( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -188,10 +185,10 @@ def create_or_update( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -249,10 +246,10 @@ def update( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -313,10 +310,10 @@ def delete( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -338,7 +335,7 @@ def delete( 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]: + if response.status_code not in [200, 204]: raise models.ErrorResponseException(self._deserialize, response) if raw: @@ -368,9 +365,9 @@ def internal_paging(next_link=None, raw=False): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', 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') + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str') } url = self._client.format_url(url, **path_format_arguments) diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/test_job_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/test_job_operations.py new file mode 100644 index 000000000000..2451d40fd484 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/test_job_operations.py @@ -0,0 +1,266 @@ +# 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 TestJobOperations(object): + """TestJobOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec 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( + self, automation_account_name, runbook_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create a test job of the runbook. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param runbook_name: The parameters supplied to the create test job + operation. + :type runbook_name: str + :param parameters: The parameters supplied to the create test job + operation. + :type parameters: + ~azure.mgmt.automation.models.TestJobCreateParameters + :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: TestJob or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.TestJob or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'runbookName': self._serialize.url("runbook_name", runbook_name, '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, 'TestJobCreateParameters') + + # 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 [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('TestJob', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def resume( + self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): + """Resume the test job. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param runbook_name: The runbook name. + :type runbook_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 = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'runbookName': self._serialize.url("runbook_name", runbook_name, '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 + + def stop( + self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): + """Stop the test job. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param runbook_name: The runbook name. + :type runbook_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 = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/stop' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'runbookName': self._serialize.url("runbook_name", runbook_name, '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 + + def suspend( + self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): + """Suspend the test job. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param runbook_name: The runbook name. + :type runbook_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 = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend' + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + 'runbookName': self._serialize.url("runbook_name", runbook_name, '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 diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/test_job_streams_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/test_job_streams_operations.py index c6c8b73898bc..6c5319616ddc 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/test_job_streams_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/test_job_streams_operations.py @@ -38,7 +38,8 @@ def __init__(self, client, config, serializer, deserializer): def get( self, automation_account_name, runbook_name, job_stream_id, custom_headers=None, raw=False, **operation_config): - """Retrieve a test job streams identified by runbook name and stream id. + """Retrieve a test job stream of the test job identified by runbook name + and stream id. :param automation_account_name: The automation account name. :type automation_account_name: str @@ -60,11 +61,11 @@ def get( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'jobStreamId': self._serialize.url("job_stream_id", job_stream_id, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'jobStreamId': self._serialize.url("job_stream_id", job_stream_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -127,10 +128,10 @@ def internal_paging(next_link=None, raw=False): # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/test_jobs_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/test_jobs_operations.py index ab88a50f25b3..4dbb2422a6a6 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/test_jobs_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/test_jobs_operations.py @@ -36,76 +36,6 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def create( - self, automation_account_name, runbook_name, parameters, custom_headers=None, raw=False, **operation_config): - """Create a test job of the runbook. - - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the create test job - operation. - :type runbook_name: str - :param parameters: The parameters supplied to the create test job - operation. - :type parameters: - ~azure.mgmt.automation.models.TestJobCreateParameters - :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: TestJob or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.automation.models.TestJob or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob' - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_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, 'TestJobCreateParameters') - - # 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 [201]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - - if response.status_code == 201: - deserialized = self._deserialize('TestJob', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - def get( self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): """Retrieve the test job for the specified runbook. @@ -128,10 +58,10 @@ def get( # Construct URL url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob' path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'runbookName': self._serialize.url("runbook_name", runbook_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -166,162 +96,3 @@ def get( return client_raw_response return deserialized - - def resume( - self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): - """Resume the test job. - - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param runbook_name: The runbook name. - :type runbook_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 = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume' - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_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 - - def stop( - self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): - """Stop the test job. - - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param runbook_name: The runbook name. - :type runbook_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 = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/stop' - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_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 - - def suspend( - self, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): - """Suspend the test job. - - :param automation_account_name: The automation account name. - :type automation_account_name: str - :param runbook_name: The runbook name. - :type runbook_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 = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend' - path_format_arguments = { - 'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'runbookName': self._serialize.url("runbook_name", runbook_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 diff --git a/azure-mgmt-automation/azure/mgmt/automation/version.py b/azure-mgmt-automation/azure/mgmt/automation/version.py index e0ec669828cb..53a203f32aaf 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/version.py +++ b/azure-mgmt-automation/azure/mgmt/automation/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" +VERSION = ""