diff --git a/azure-mgmt-automation/azure/mgmt/automation/automation_client.py b/azure-mgmt-automation/azure/mgmt/automation/automation_client.py index e73c944ed38f..a03313cfec14 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/automation_client.py +++ b/azure-mgmt-automation/azure/mgmt/automation/automation_client.py @@ -30,10 +30,6 @@ from .operations.module_operations import ModuleOperations from .operations.object_data_types_operations import ObjectDataTypesOperations from .operations.fields_operations import FieldsOperations -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.schedule_operations import ScheduleOperations from .operations.variable_operations import VariableOperations from .operations.webhook_operations import WebhookOperations @@ -53,6 +49,10 @@ from .operations.dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations from .operations.dsc_node_configuration_operations import DscNodeConfigurationOperations from .operations.node_count_information_operations import NodeCountInformationOperations +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 . import models @@ -68,21 +68,16 @@ class AutomationClientConfiguration(AzureConfiguration): identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param count_type1: The type of counts to retrieve. Possible values - include: 'status', 'nodeconfiguration' - :type count_type1: str or ~azure.mgmt.automation.models.CountType :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, count_type1, base_url=None): + self, credentials, subscription_id, base_url=None): if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if count_type1 is None: - raise ValueError("Parameter 'count_type1' must not be None.") if not base_url: base_url = 'https://management.azure.com' @@ -93,7 +88,6 @@ def __init__( self.credentials = credentials self.subscription_id = subscription_id - self.count_type1 = count_type1 class AutomationClient(object): @@ -136,14 +130,6 @@ class AutomationClient(object): :vartype object_data_types: azure.mgmt.automation.operations.ObjectDataTypesOperations :ivar fields: Fields operations :vartype fields: azure.mgmt.automation.operations.FieldsOperations - :ivar runbook_draft: RunbookDraft operations - :vartype runbook_draft: azure.mgmt.automation.operations.RunbookDraftOperations - :ivar runbook: Runbook operations - :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 schedule: Schedule operations :vartype schedule: azure.mgmt.automation.operations.ScheduleOperations :ivar variable: Variable operations @@ -182,6 +168,14 @@ class AutomationClient(object): :vartype dsc_node_configuration: azure.mgmt.automation.operations.DscNodeConfigurationOperations :ivar node_count_information: NodeCountInformation operations :vartype node_count_information: azure.mgmt.automation.operations.NodeCountInformationOperations + :ivar runbook_draft: RunbookDraft operations + :vartype runbook_draft: azure.mgmt.automation.operations.RunbookDraftOperations + :ivar runbook: Runbook operations + :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 :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -190,16 +184,13 @@ class AutomationClient(object): identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param count_type1: The type of counts to retrieve. Possible values - include: 'status', 'nodeconfiguration' - :type count_type1: str or ~azure.mgmt.automation.models.CountType :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, count_type1, base_url=None): + self, credentials, subscription_id, base_url=None): - self.config = AutomationClientConfiguration(credentials, subscription_id, count_type1, base_url) + self.config = AutomationClientConfiguration(credentials, subscription_id, base_url) self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} @@ -240,14 +231,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.fields = FieldsOperations( self._client, self.config, self._serialize, self._deserialize) - self.runbook_draft = RunbookDraftOperations( - self._client, self.config, self._serialize, self._deserialize) - self.runbook = RunbookOperations( - 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.schedule = ScheduleOperations( self._client, self.config, self._serialize, self._deserialize) self.variable = VariableOperations( @@ -286,3 +269,11 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.node_count_information = NodeCountInformationOperations( self._client, self.config, self._serialize, self._deserialize) + self.runbook_draft = RunbookDraftOperations( + self._client, self.config, self._serialize, self._deserialize) + self.runbook = RunbookOperations( + 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) diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py index 72ee0e92e7cb..88bf4954863c 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py @@ -62,18 +62,6 @@ from .module_create_or_update_parameters import ModuleCreateOrUpdateParameters from .module_update_parameters import ModuleUpdateParameters from .type_field import TypeField -from .job_stream import JobStream -from .job_stream_list_result import JobStreamListResult -from .runbook_parameter import RunbookParameter -from .runbook_draft import RunbookDraft -from .runbook import Runbook -from .runbook_create_or_update_parameters import RunbookCreateOrUpdateParameters -from .runbook_update_parameters import RunbookUpdateParameters -from .runbook_draft_undo_edit_result import RunbookDraftUndoEditResult -from .test_job_create_parameters import TestJobCreateParameters -from .test_job import TestJob -from .runbook_create_or_update_draft_properties import RunbookCreateOrUpdateDraftProperties -from .runbook_create_or_update_draft_parameters import RunbookCreateOrUpdateDraftParameters from .advanced_schedule_monthly_occurrence import AdvancedScheduleMonthlyOccurrence from .advanced_schedule import AdvancedSchedule from .schedule_create_or_update_parameters import ScheduleCreateOrUpdateParameters @@ -109,6 +97,8 @@ from .source_control_sync_job_by_id import SourceControlSyncJobById from .source_control_sync_job_stream import SourceControlSyncJobStream from .source_control_sync_job_stream_by_id import SourceControlSyncJobStreamById +from .job_stream import JobStream +from .job_stream_list_result import JobStreamListResult from .job import Job from .job_collection_item import JobCollectionItem from .job_create_parameters import JobCreateParameters @@ -132,6 +122,16 @@ from .node_count_properties import NodeCountProperties from .node_count import NodeCount from .node_counts import NodeCounts +from .runbook_parameter import RunbookParameter +from .runbook_draft import RunbookDraft +from .runbook import Runbook +from .runbook_create_or_update_parameters import RunbookCreateOrUpdateParameters +from .runbook_update_parameters import RunbookUpdateParameters +from .runbook_draft_undo_edit_result import RunbookDraftUndoEditResult +from .test_job_create_parameters import TestJobCreateParameters +from .test_job import TestJob +from .runbook_create_or_update_draft_properties import RunbookCreateOrUpdateDraftProperties +from .runbook_create_or_update_draft_parameters import RunbookCreateOrUpdateDraftParameters from .automation_account_paged import AutomationAccountPaged from .operation_paged import OperationPaged from .statistics_paged import StatisticsPaged @@ -146,8 +146,6 @@ 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 @@ -156,10 +154,12 @@ from .source_control_sync_job_paged import SourceControlSyncJobPaged from .source_control_sync_job_stream_paged import SourceControlSyncJobStreamPaged from .job_collection_item_paged import JobCollectionItemPaged +from .job_stream_paged import JobStreamPaged from .dsc_node_paged import DscNodePaged from .dsc_node_report_paged import DscNodeReportPaged from .dsc_compilation_job_paged import DscCompilationJobPaged from .dsc_node_configuration_paged import DscNodeConfigurationPaged +from .runbook_paged import RunbookPaged from .automation_client_enums import ( SkuNameEnum, AutomationAccountState, @@ -170,11 +170,6 @@ DscConfigurationState, GroupTypeEnum, ModuleProvisioningState, - JobStreamType, - RunbookTypeEnum, - RunbookState, - RunbookProvisioningState, - HttpStatusCode, ScheduleDay, ScheduleFrequency, OperatingSystemType, @@ -184,9 +179,14 @@ ProvisioningState, StartType, StreamType, + JobStreamType, JobStatus, JobProvisioningState, AgentRegistrationKeyName, + RunbookTypeEnum, + RunbookState, + RunbookProvisioningState, + HttpStatusCode, CountType, ) @@ -244,18 +244,6 @@ 'ModuleCreateOrUpdateParameters', 'ModuleUpdateParameters', 'TypeField', - 'JobStream', - 'JobStreamListResult', - 'RunbookParameter', - 'RunbookDraft', - 'Runbook', - 'RunbookCreateOrUpdateParameters', - 'RunbookUpdateParameters', - 'RunbookDraftUndoEditResult', - 'TestJobCreateParameters', - 'TestJob', - 'RunbookCreateOrUpdateDraftProperties', - 'RunbookCreateOrUpdateDraftParameters', 'AdvancedScheduleMonthlyOccurrence', 'AdvancedSchedule', 'ScheduleCreateOrUpdateParameters', @@ -291,6 +279,8 @@ 'SourceControlSyncJobById', 'SourceControlSyncJobStream', 'SourceControlSyncJobStreamById', + 'JobStream', + 'JobStreamListResult', 'Job', 'JobCollectionItem', 'JobCreateParameters', @@ -314,6 +304,16 @@ 'NodeCountProperties', 'NodeCount', 'NodeCounts', + 'RunbookParameter', + 'RunbookDraft', + 'Runbook', + 'RunbookCreateOrUpdateParameters', + 'RunbookUpdateParameters', + 'RunbookDraftUndoEditResult', + 'TestJobCreateParameters', + 'TestJob', + 'RunbookCreateOrUpdateDraftProperties', + 'RunbookCreateOrUpdateDraftParameters', 'AutomationAccountPaged', 'OperationPaged', 'StatisticsPaged', @@ -328,8 +328,6 @@ 'ActivityPaged', 'ModulePaged', 'TypeFieldPaged', - 'RunbookPaged', - 'JobStreamPaged', 'SchedulePaged', 'VariablePaged', 'WebhookPaged', @@ -338,10 +336,12 @@ 'SourceControlSyncJobPaged', 'SourceControlSyncJobStreamPaged', 'JobCollectionItemPaged', + 'JobStreamPaged', 'DscNodePaged', 'DscNodeReportPaged', 'DscCompilationJobPaged', 'DscNodeConfigurationPaged', + 'RunbookPaged', 'SkuNameEnum', 'AutomationAccountState', 'AutomationKeyName', @@ -351,11 +351,6 @@ 'DscConfigurationState', 'GroupTypeEnum', 'ModuleProvisioningState', - 'JobStreamType', - 'RunbookTypeEnum', - 'RunbookState', - 'RunbookProvisioningState', - 'HttpStatusCode', 'ScheduleDay', 'ScheduleFrequency', 'OperatingSystemType', @@ -365,8 +360,13 @@ 'ProvisioningState', 'StartType', 'StreamType', + 'JobStreamType', 'JobStatus', 'JobProvisioningState', 'AgentRegistrationKeyName', + 'RunbookTypeEnum', + 'RunbookState', + 'RunbookProvisioningState', + 'HttpStatusCode', 'CountType', ] diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py b/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py index 867b0e7cf0ef..24e2513882a6 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py @@ -81,90 +81,6 @@ class ModuleProvisioningState(Enum): updating = "Updating" -class JobStreamType(Enum): - - progress = "Progress" - output = "Output" - warning = "Warning" - error = "Error" - debug = "Debug" - verbose = "Verbose" - any = "Any" - - -class RunbookTypeEnum(Enum): - - script = "Script" - graph = "Graph" - power_shell_workflow = "PowerShellWorkflow" - power_shell = "PowerShell" - graph_power_shell_workflow = "GraphPowerShellWorkflow" - graph_power_shell = "GraphPowerShell" - - -class RunbookState(Enum): - - new = "New" - edit = "Edit" - published = "Published" - - -class RunbookProvisioningState(Enum): - - succeeded = "Succeeded" - - -class HttpStatusCode(Enum): - - continue_enum = "Continue" - switching_protocols = "SwitchingProtocols" - ok = "OK" - created = "Created" - accepted = "Accepted" - non_authoritative_information = "NonAuthoritativeInformation" - no_content = "NoContent" - reset_content = "ResetContent" - partial_content = "PartialContent" - multiple_choices = "MultipleChoices" - ambiguous = "Ambiguous" - moved_permanently = "MovedPermanently" - moved = "Moved" - found = "Found" - redirect = "Redirect" - see_other = "SeeOther" - redirect_method = "RedirectMethod" - not_modified = "NotModified" - use_proxy = "UseProxy" - unused = "Unused" - temporary_redirect = "TemporaryRedirect" - redirect_keep_verb = "RedirectKeepVerb" - bad_request = "BadRequest" - unauthorized = "Unauthorized" - payment_required = "PaymentRequired" - forbidden = "Forbidden" - not_found = "NotFound" - method_not_allowed = "MethodNotAllowed" - not_acceptable = "NotAcceptable" - proxy_authentication_required = "ProxyAuthenticationRequired" - request_timeout = "RequestTimeout" - conflict = "Conflict" - gone = "Gone" - length_required = "LengthRequired" - precondition_failed = "PreconditionFailed" - request_entity_too_large = "RequestEntityTooLarge" - request_uri_too_long = "RequestUriTooLong" - unsupported_media_type = "UnsupportedMediaType" - requested_range_not_satisfiable = "RequestedRangeNotSatisfiable" - expectation_failed = "ExpectationFailed" - upgrade_required = "UpgradeRequired" - internal_server_error = "InternalServerError" - not_implemented = "NotImplemented" - bad_gateway = "BadGateway" - service_unavailable = "ServiceUnavailable" - gateway_timeout = "GatewayTimeout" - http_version_not_supported = "HttpVersionNotSupported" - - class ScheduleDay(Enum): monday = "Monday" @@ -238,6 +154,17 @@ class StreamType(Enum): output = "Output" +class JobStreamType(Enum): + + progress = "Progress" + output = "Output" + warning = "Warning" + error = "Error" + debug = "Debug" + verbose = "Verbose" + any = "Any" + + class JobStatus(Enum): new = "New" @@ -269,6 +196,79 @@ class AgentRegistrationKeyName(Enum): secondary = "secondary" +class RunbookTypeEnum(Enum): + + script = "Script" + graph = "Graph" + power_shell_workflow = "PowerShellWorkflow" + power_shell = "PowerShell" + graph_power_shell_workflow = "GraphPowerShellWorkflow" + graph_power_shell = "GraphPowerShell" + + +class RunbookState(Enum): + + new = "New" + edit = "Edit" + published = "Published" + + +class RunbookProvisioningState(Enum): + + succeeded = "Succeeded" + + +class HttpStatusCode(Enum): + + continue_enum = "Continue" + switching_protocols = "SwitchingProtocols" + ok = "OK" + created = "Created" + accepted = "Accepted" + non_authoritative_information = "NonAuthoritativeInformation" + no_content = "NoContent" + reset_content = "ResetContent" + partial_content = "PartialContent" + multiple_choices = "MultipleChoices" + ambiguous = "Ambiguous" + moved_permanently = "MovedPermanently" + moved = "Moved" + found = "Found" + redirect = "Redirect" + see_other = "SeeOther" + redirect_method = "RedirectMethod" + not_modified = "NotModified" + use_proxy = "UseProxy" + unused = "Unused" + temporary_redirect = "TemporaryRedirect" + redirect_keep_verb = "RedirectKeepVerb" + bad_request = "BadRequest" + unauthorized = "Unauthorized" + payment_required = "PaymentRequired" + forbidden = "Forbidden" + not_found = "NotFound" + method_not_allowed = "MethodNotAllowed" + not_acceptable = "NotAcceptable" + proxy_authentication_required = "ProxyAuthenticationRequired" + request_timeout = "RequestTimeout" + conflict = "Conflict" + gone = "Gone" + length_required = "LengthRequired" + precondition_failed = "PreconditionFailed" + request_entity_too_large = "RequestEntityTooLarge" + request_uri_too_long = "RequestUriTooLong" + unsupported_media_type = "UnsupportedMediaType" + requested_range_not_satisfiable = "RequestedRangeNotSatisfiable" + expectation_failed = "ExpectationFailed" + upgrade_required = "UpgradeRequired" + internal_server_error = "InternalServerError" + not_implemented = "NotImplemented" + bad_gateway = "BadGateway" + service_unavailable = "ServiceUnavailable" + gateway_timeout = "GatewayTimeout" + http_version_not_supported = "HttpVersionNotSupported" + + class CountType(Enum): status = "status" diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py index 89b6b666b52b..25f505bff5fc 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py @@ -26,10 +26,6 @@ from .module_operations import ModuleOperations from .object_data_types_operations import ObjectDataTypesOperations from .fields_operations import FieldsOperations -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 .schedule_operations import ScheduleOperations from .variable_operations import VariableOperations from .webhook_operations import WebhookOperations @@ -49,6 +45,10 @@ from .dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations from .dsc_node_configuration_operations import DscNodeConfigurationOperations from .node_count_information_operations import NodeCountInformationOperations +from .runbook_draft_operations import RunbookDraftOperations +from .runbook_operations import RunbookOperations +from .test_job_streams_operations import TestJobStreamsOperations +from .test_job_operations import TestJobOperations __all__ = [ 'AutomationAccountOperations', @@ -68,10 +68,6 @@ 'ModuleOperations', 'ObjectDataTypesOperations', 'FieldsOperations', - 'RunbookDraftOperations', - 'RunbookOperations', - 'TestJobStreamsOperations', - 'TestJobOperations', 'ScheduleOperations', 'VariableOperations', 'WebhookOperations', @@ -91,4 +87,8 @@ 'DscCompilationJobStreamOperations', 'DscNodeConfigurationOperations', 'NodeCountInformationOperations', + 'RunbookDraftOperations', + 'RunbookOperations', + 'TestJobStreamsOperations', + 'TestJobOperations', ] diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/node_count_information_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/node_count_information_operations.py index 34fa6a57a1fc..8895e2ec4c73 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/node_count_information_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/node_count_information_operations.py @@ -37,13 +37,16 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get( - self, resource_group_name, automation_account_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, automation_account_name, count_type, custom_headers=None, raw=False, **operation_config): """Retrieve counts for Dsc Nodes. :param resource_group_name: Name of an Azure Resource group. :type resource_group_name: str :param automation_account_name: The name of the automation account. :type automation_account_name: str + :param count_type: The type of counts to retrieve. Possible values + include: 'status', 'nodeconfiguration' + :type count_type: str or ~azure.mgmt.automation.models.CountType :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -60,7 +63,7 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - 'countType': self._serialize.url("self.config.count_type", self.config.count_type, 'str'), + 'countType': self._serialize.url("count_type", count_type, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_draft_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_draft_operations.py index 3af4cc1547a6..9f2bee258a82 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 @@ -297,114 +297,6 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft'} - - def _publish_initial( - self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.publish.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), - 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), - '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 [202]: - raise models.ErrorResponseException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - header_dict = { - 'location': 'str', - } - client_raw_response.add_headers(header_dict) - return client_raw_response - - def publish( - self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): - """Publish runbook draft. - - :param resource_group_name: Name of an Azure Resource group. - :type resource_group_name: str - :param automation_account_name: The name of the automation account. - :type automation_account_name: str - :param runbook_name: The parameters supplied to the publish runbook - operation. - :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 - :return: An instance of AzureOperationPoller that returns None or - ClientRawResponse if raw=true - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - raw_result = self._publish_initial( - resource_group_name=resource_group_name, - automation_account_name=automation_account_name, - runbook_name=runbook_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - if raw: - return raw_result - - # Construct and send request - def long_running_send(): - return raw_result.response - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - header_parameters = {} - header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] - return self._client.send( - request, header_parameters, stream=False, **operation_config) - - def get_long_running_output(response): - - if response.status_code not in [202]: - raise models.ErrorResponseException(self._deserialize, 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( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - publish.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/publish'} - def undo_edit( self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): """Undo draft edit to last known published state identified by runbook diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py index f1c281095259..8d3c0ddf034f 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/runbook_operations.py @@ -12,6 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.exceptions import DeserializationError +from msrestazure.azure_operation import AzureOperationPoller from .. import models @@ -37,6 +39,114 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + + def _publish_initial( + self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.publish.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._]+$'), + 'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'), + '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 [202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + header_dict = { + 'location': 'str', + } + client_raw_response.add_headers(header_dict) + return client_raw_response + + def publish( + self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): + """Publish runbook draft. + + :param resource_group_name: Name of an Azure Resource group. + :type resource_group_name: str + :param automation_account_name: The name of the automation account. + :type automation_account_name: str + :param runbook_name: The parameters supplied to the publish runbook + operation. + :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 + :return: An instance of AzureOperationPoller that returns None or + ClientRawResponse if raw=true + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._publish_initial( + resource_group_name=resource_group_name, + automation_account_name=automation_account_name, + runbook_name=runbook_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + if raw: + return raw_result + + # Construct and send request + def long_running_send(): + return raw_result.response + + def get_long_running_status(status_link, headers=None): + + request = self._client.get(status_link) + if headers: + request.headers.update(headers) + header_parameters = {} + header_parameters['x-ms-client-request-id'] = raw_result.response.request.headers['x-ms-client-request-id'] + return self._client.send( + request, header_parameters, stream=False, **operation_config) + + def get_long_running_output(response): + + if response.status_code not in [202]: + raise models.ErrorResponseException(self._deserialize, 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( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + return AzureOperationPoller( + long_running_send, get_long_running_output, + get_long_running_status, long_running_operation_timeout) + publish.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish'} + def get_content( self, resource_group_name, automation_account_name, runbook_name, custom_headers=None, raw=False, **operation_config): """Retrieve the content of runbook identified by runbook name.