diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py index fe36311fa244..8f5d82cf0552 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py @@ -57,12 +57,11 @@ from .job_provisioning_state_property import JobProvisioningStateProperty from .dsc_compilation_job import DscCompilationJob from .dsc_configuration_create_or_update_parameters import DscConfigurationCreateOrUpdateParameters +from .dsc_configuration_update_parameters import DscConfigurationUpdateParameters from .dsc_meta_configuration import DscMetaConfiguration +from .dsc_node_configuration_create_or_update_parameters import DscNodeConfigurationCreateOrUpdateParameters from .dsc_node_configuration_association_property import DscNodeConfigurationAssociationProperty from .dsc_node_extension_handler_association_property import DscNodeExtensionHandlerAssociationProperty -from .dsc_node import DscNode -from .dsc_node_configuration_create_or_update_parameters import DscNodeConfigurationCreateOrUpdateParameters -from .dsc_node_configuration import DscNodeConfiguration from .dsc_node_update_parameters import DscNodeUpdateParameters from .dsc_report_error import DscReportError from .dsc_report_resource_navigation import DscReportResourceNavigation @@ -104,6 +103,8 @@ from .webhook_create_or_update_parameters import WebhookCreateOrUpdateParameters from .webhook import Webhook from .webhook_update_parameters import WebhookUpdateParameters +from .dsc_node import DscNode +from .dsc_node_configuration import DscNodeConfiguration from .collection_item_update_configuration import CollectionItemUpdateConfiguration from .software_update_configuration_collection_item import SoftwareUpdateConfigurationCollectionItem from .software_update_configuration_list_result import SoftwareUpdateConfigurationListResult @@ -223,12 +224,11 @@ 'JobProvisioningStateProperty', 'DscCompilationJob', 'DscConfigurationCreateOrUpdateParameters', + 'DscConfigurationUpdateParameters', 'DscMetaConfiguration', + 'DscNodeConfigurationCreateOrUpdateParameters', 'DscNodeConfigurationAssociationProperty', 'DscNodeExtensionHandlerAssociationProperty', - 'DscNode', - 'DscNodeConfigurationCreateOrUpdateParameters', - 'DscNodeConfiguration', 'DscNodeUpdateParameters', 'DscReportError', 'DscReportResourceNavigation', @@ -270,6 +270,8 @@ 'WebhookCreateOrUpdateParameters', 'Webhook', 'WebhookUpdateParameters', + 'DscNode', + 'DscNodeConfiguration', 'CollectionItemUpdateConfiguration', 'SoftwareUpdateConfigurationCollectionItem', 'SoftwareUpdateConfigurationListResult', diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/dsc_configuration_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/dsc_configuration_update_parameters.py new file mode 100644 index 000000000000..f7f86dcd3b6c --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/dsc_configuration_update_parameters.py @@ -0,0 +1,57 @@ +# 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 DscConfigurationUpdateParameters(Model): + """The parameters supplied to the create or update configuration operation. + + :param log_verbose: Gets or sets verbose log option. + :type log_verbose: bool + :param log_progress: Gets or sets progress log option. + :type log_progress: bool + :param source: Gets or sets the source. + :type source: ~azure.mgmt.automation.models.ContentSource + :param parameters: Gets or sets the configuration parameters. + :type parameters: dict[str, + ~azure.mgmt.automation.models.DscConfigurationParameter] + :param description: Gets or sets the description of the configuration. + :type description: str + :param name: Gets or sets name of the resource. + :type name: str + :param tags: Gets or sets the tags attached to the resource. + :type tags: dict[str, str] + """ + + _validation = { + 'source': {'required': True}, + } + + _attribute_map = { + 'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'}, + 'log_progress': {'key': 'properties.logProgress', 'type': 'bool'}, + 'source': {'key': 'properties.source', 'type': 'ContentSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '{DscConfigurationParameter}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, source, log_verbose=None, log_progress=None, parameters=None, description=None, name=None, tags=None): + super(DscConfigurationUpdateParameters, self).__init__() + self.log_verbose = log_verbose + self.log_progress = log_progress + self.source = source + self.parameters = parameters + self.description = description + self.name = name + self.tags = tags diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/dsc_configuration_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/dsc_configuration_operations.py index 16c68f60b46e..97210d3991eb 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/dsc_configuration_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/dsc_configuration_operations.py @@ -224,6 +224,79 @@ def create_or_update( return deserialized create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}'} + def update( + self, automation_account_name, configuration_name, parameters=None, custom_headers=None, raw=False, **operation_config): + """Create the configuration identified by configuration name. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param configuration_name: The create or update parameters for + configuration. + :type configuration_name: str + :param parameters: The create or update parameters for configuration. + :type parameters: + ~azure.mgmt.automation.models.DscConfigurationUpdateParameters + :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: DscConfiguration or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.DscConfiguration or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + 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'), + 'configurationName': self._serialize.url("configuration_name", configuration_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 + if parameters is not None: + body_content = self._serialize.body(parameters, 'DscConfigurationUpdateParameters') + else: + body_content = None + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DscConfiguration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}'} + def get_content( self, automation_account_name, configuration_name, custom_headers=None, raw=False, **operation_config): """Retrieve the configuration script identified by configuration name.