From 8fa5bb1eeaec7eb7443c19df1fd481fe16d5f30c Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Fri, 4 Oct 2019 08:04:41 +0000 Subject: [PATCH 1/3] regenerated --- .../resources/v2019_07_01/models/__init__.py | 24 ++ .../resources/v2019_07_01/models/_models.py | 227 +++++++++++++++++ .../v2019_07_01/models/_models_py3.py | 227 +++++++++++++++++ .../_resource_management_client_enums.py | 24 ++ .../operations/_deployments_operations.py | 233 ++++++++++++++++++ .../resources/v2019_08_01/models/__init__.py | 24 ++ .../resources/v2019_08_01/models/_models.py | 227 +++++++++++++++++ .../v2019_08_01/models/_models_py3.py | 227 +++++++++++++++++ .../_resource_management_client_enums.py | 24 ++ .../operations/_deployments_operations.py | 233 ++++++++++++++++++ 10 files changed, 1470 insertions(+) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/__init__.py index f37d22a86f2d..7f71f20a961b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/__init__.py @@ -24,6 +24,9 @@ from ._models_py3 import DeploymentProperties from ._models_py3 import DeploymentPropertiesExtended from ._models_py3 import DeploymentValidateResult + from ._models_py3 import DeploymentWhatIf + from ._models_py3 import DeploymentWhatIfProperties + from ._models_py3 import DeploymentWhatIfSettings from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorResponse from ._models_py3 import ExportTemplateRequest @@ -56,6 +59,9 @@ from ._models_py3 import TargetResource from ._models_py3 import TemplateHashResult from ._models_py3 import TemplateLink + from ._models_py3 import WhatIfChange + from ._models_py3 import WhatIfOperationResult + from ._models_py3 import WhatIfPropertyChange except (SyntaxError, ImportError): from ._models import AliasPathType from ._models import AliasType @@ -71,6 +77,9 @@ from ._models import DeploymentProperties from ._models import DeploymentPropertiesExtended from ._models import DeploymentValidateResult + from ._models import DeploymentWhatIf + from ._models import DeploymentWhatIfProperties + from ._models import DeploymentWhatIfSettings from ._models import ErrorAdditionalInfo from ._models import ErrorResponse from ._models import ExportTemplateRequest @@ -103,6 +112,9 @@ from ._models import TargetResource from ._models import TemplateHashResult from ._models import TemplateLink + from ._models import WhatIfChange + from ._models import WhatIfOperationResult + from ._models import WhatIfPropertyChange from ._paged_models import DeploymentExtendedPaged from ._paged_models import DeploymentOperationPaged from ._paged_models import GenericResourcePaged @@ -113,7 +125,10 @@ from ._resource_management_client_enums import ( DeploymentMode, OnErrorDeploymentType, + WhatIfResultFormat, ResourceIdentityType, + PropertyChangeType, + ChangeType, ) __all__ = [ @@ -131,6 +146,9 @@ 'DeploymentProperties', 'DeploymentPropertiesExtended', 'DeploymentValidateResult', + 'DeploymentWhatIf', + 'DeploymentWhatIfProperties', + 'DeploymentWhatIfSettings', 'ErrorAdditionalInfo', 'ErrorResponse', 'ExportTemplateRequest', @@ -163,6 +181,9 @@ 'TargetResource', 'TemplateHashResult', 'TemplateLink', + 'WhatIfChange', + 'WhatIfOperationResult', + 'WhatIfPropertyChange', 'OperationPaged', 'DeploymentExtendedPaged', 'ProviderPaged', @@ -172,5 +193,8 @@ 'DeploymentOperationPaged', 'DeploymentMode', 'OnErrorDeploymentType', + 'WhatIfResultFormat', 'ResourceIdentityType', + 'PropertyChangeType', + 'ChangeType', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py index 0d5ff078f1de..677e68e9faa5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py @@ -540,6 +540,118 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) +class DeploymentWhatIf(Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__(self, **kwargs): + super(DeploymentWhatIf, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want + to pass the template syntax directly in the request rather than link to an + existing template. It can be a JObject or well-formed JSON string. Use + either the templateLink property or the template property, but not both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink + property or the template property, but not both. + :type template_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment + parameters for the template. You use this element when you want to provide + the parameter values directly in the request rather than link to an + existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed + JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element + to link to an existing parameters file. Use either the parametersLink + property or the parameters property, but not both. + :type parameters_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This + value can be either Incremental or Complete. In Incremental mode, + resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the + template are deleted. Be careful when using Complete mode as you may + unintentionally delete resources. Possible values include: 'Incremental', + 'Complete' + :type mode: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: + ~azure.mgmt.resource.resources.v2019_07_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeployment + :param what_if_settings: Optional What-If operation settings. + :type what_if_settings: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIfSettings + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, + } + + def __init__(self, **kwargs): + super(DeploymentWhatIfProperties, self).__init__(**kwargs) + self.what_if_settings = kwargs.get('what_if_settings', None) + + +class DeploymentWhatIfSettings(Model): + """Deployment What-If operation settings. + + :param result_format: The format of the What-If results. Possible values + include: 'ResourceIdOnly', 'FullResourcePayloads' + :type result_format: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfResultFormat + """ + + _attribute_map = { + 'result_format': {'key': 'resultFormat', 'type': 'WhatIfResultFormat'}, + } + + def __init__(self, **kwargs): + super(DeploymentWhatIfSettings, self).__init__(**kwargs) + self.result_format = kwargs.get('result_format', None) + + class ErrorAdditionalInfo(Model): """The resource management error additional info. @@ -1512,3 +1624,118 @@ def __init__(self, **kwargs): super(TemplateLink, self).__init__(**kwargs) self.uri = kwargs.get('uri', None) self.content_version = kwargs.get('content_version', None) + + +class WhatIfChange(Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Resource ID + :type resource_id: str + :param change_type: Required. Type of change that will be made to the + resource when the deployment is executed. Possible values include: + 'Create', 'Delete', 'Ignore', 'Deploy', 'NoChange', 'Modify' + :type change_type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.ChangeType + :param before: The snapshot of the resource before the deployment is + executed. + :type before: object + :param after: The predicted snapshot of the resource after the deployment + is executed. + :type after: object + :param delta: The predicted changes to resource properties. + :type delta: + list[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_type': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'ChangeType'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'delta': {'key': 'delta', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__(self, **kwargs): + super(WhatIfChange, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.change_type = kwargs.get('change_type', None) + self.before = kwargs.get('before', None) + self.after = kwargs.get('after', None) + self.delta = kwargs.get('delta', None) + + +class WhatIfOperationResult(Model): + """Result of the What-If operation. Contains a list of predicted changes and a + URL link to get to the next set of results. + + :param status: Status of the What-If operation. + :type status: str + :param changes: List of resource changes predicted by What-If operation. + :type changes: + list[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfChange] + :param error: Error when What-If operation fails. + :type error: + ~azure.mgmt.resource.resources.v2019_07_01.models.ErrorResponse + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'changes': {'key': 'properties.changes', 'type': '[WhatIfChange]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(WhatIfOperationResult, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.changes = kwargs.get('changes', None) + self.error = kwargs.get('error', None) + + +class WhatIfPropertyChange(Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. The path of the property. + :type path: str + :param property_change_type: Required. The type of property change. + Possible values include: 'Create', 'Delete', 'Modify', 'Array' + :type property_change_type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.PropertyChangeType + :param before: The value of the property before the deployment is + executed. + :type before: object + :param after: The value of the property after the deployment is executed. + :type after: object + :param children: Nested property changes. + :type children: + list[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'path': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'PropertyChangeType'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'children': {'key': 'children', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__(self, **kwargs): + super(WhatIfPropertyChange, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.property_change_type = kwargs.get('property_change_type', None) + self.before = kwargs.get('before', None) + self.after = kwargs.get('after', None) + self.children = kwargs.get('children', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py index 8be134dba931..0b166a7fb6bb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py @@ -540,6 +540,118 @@ def __init__(self, *, error=None, properties=None, **kwargs) -> None: self.properties = properties +class DeploymentWhatIf(Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__(self, *, properties, location: str=None, **kwargs) -> None: + super(DeploymentWhatIf, self).__init__(**kwargs) + self.location = location + self.properties = properties + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want + to pass the template syntax directly in the request rather than link to an + existing template. It can be a JObject or well-formed JSON string. Use + either the templateLink property or the template property, but not both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink + property or the template property, but not both. + :type template_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment + parameters for the template. You use this element when you want to provide + the parameter values directly in the request rather than link to an + existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed + JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element + to link to an existing parameters file. Use either the parametersLink + property or the parameters property, but not both. + :type parameters_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This + value can be either Incremental or Complete. In Incremental mode, + resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the + template are deleted. Be careful when using Complete mode as you may + unintentionally delete resources. Possible values include: 'Incremental', + 'Complete' + :type mode: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: + ~azure.mgmt.resource.resources.v2019_07_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeployment + :param what_if_settings: Optional What-If operation settings. + :type what_if_settings: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIfSettings + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, + } + + def __init__(self, *, mode, template=None, template_link=None, parameters=None, parameters_link=None, debug_setting=None, on_error_deployment=None, what_if_settings=None, **kwargs) -> None: + super(DeploymentWhatIfProperties, self).__init__(template=template, template_link=template_link, parameters=parameters, parameters_link=parameters_link, mode=mode, debug_setting=debug_setting, on_error_deployment=on_error_deployment, **kwargs) + self.what_if_settings = what_if_settings + + +class DeploymentWhatIfSettings(Model): + """Deployment What-If operation settings. + + :param result_format: The format of the What-If results. Possible values + include: 'ResourceIdOnly', 'FullResourcePayloads' + :type result_format: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfResultFormat + """ + + _attribute_map = { + 'result_format': {'key': 'resultFormat', 'type': 'WhatIfResultFormat'}, + } + + def __init__(self, *, result_format=None, **kwargs) -> None: + super(DeploymentWhatIfSettings, self).__init__(**kwargs) + self.result_format = result_format + + class ErrorAdditionalInfo(Model): """The resource management error additional info. @@ -1512,3 +1624,118 @@ def __init__(self, *, uri: str, content_version: str=None, **kwargs) -> None: super(TemplateLink, self).__init__(**kwargs) self.uri = uri self.content_version = content_version + + +class WhatIfChange(Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Resource ID + :type resource_id: str + :param change_type: Required. Type of change that will be made to the + resource when the deployment is executed. Possible values include: + 'Create', 'Delete', 'Ignore', 'Deploy', 'NoChange', 'Modify' + :type change_type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.ChangeType + :param before: The snapshot of the resource before the deployment is + executed. + :type before: object + :param after: The predicted snapshot of the resource after the deployment + is executed. + :type after: object + :param delta: The predicted changes to resource properties. + :type delta: + list[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_type': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'ChangeType'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'delta': {'key': 'delta', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__(self, *, resource_id: str, change_type, before=None, after=None, delta=None, **kwargs) -> None: + super(WhatIfChange, self).__init__(**kwargs) + self.resource_id = resource_id + self.change_type = change_type + self.before = before + self.after = after + self.delta = delta + + +class WhatIfOperationResult(Model): + """Result of the What-If operation. Contains a list of predicted changes and a + URL link to get to the next set of results. + + :param status: Status of the What-If operation. + :type status: str + :param changes: List of resource changes predicted by What-If operation. + :type changes: + list[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfChange] + :param error: Error when What-If operation fails. + :type error: + ~azure.mgmt.resource.resources.v2019_07_01.models.ErrorResponse + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'changes': {'key': 'properties.changes', 'type': '[WhatIfChange]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, status: str=None, changes=None, error=None, **kwargs) -> None: + super(WhatIfOperationResult, self).__init__(**kwargs) + self.status = status + self.changes = changes + self.error = error + + +class WhatIfPropertyChange(Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. The path of the property. + :type path: str + :param property_change_type: Required. The type of property change. + Possible values include: 'Create', 'Delete', 'Modify', 'Array' + :type property_change_type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.PropertyChangeType + :param before: The value of the property before the deployment is + executed. + :type before: object + :param after: The value of the property after the deployment is executed. + :type after: object + :param children: Nested property changes. + :type children: + list[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'path': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'PropertyChangeType'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'children': {'key': 'children', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__(self, *, path: str, property_change_type, before=None, after=None, children=None, **kwargs) -> None: + super(WhatIfPropertyChange, self).__init__(**kwargs) + self.path = path + self.property_change_type = property_change_type + self.before = before + self.after = after + self.children = children diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py index 9fd73ca1de47..7306f86842bf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py @@ -24,9 +24,33 @@ class OnErrorDeploymentType(str, Enum): specific_deployment = "SpecificDeployment" +class WhatIfResultFormat(str, Enum): + + resource_id_only = "ResourceIdOnly" + full_resource_payloads = "FullResourcePayloads" + + class ResourceIdentityType(str, Enum): system_assigned = "SystemAssigned" user_assigned = "UserAssigned" system_assigned_user_assigned = "SystemAssigned, UserAssigned" none = "None" + + +class PropertyChangeType(str, Enum): + + create = "Create" #: The property does not exist in the current state but is present in the desired state. The property will be created when the deployment is executed. + delete = "Delete" #: The property exists in the current state and is missing from the desired state. It will be deleted when the deployment is executed. + modify = "Modify" #: The property exists in both current and desired state and is different. The value of the property will change when the deployment is executed. + array = "Array" #: The property is an array and contains nested changes. + + +class ChangeType(str, Enum): + + create = "Create" #: The resource does not exist in the current state but is present in the desired state. The resource will be created when the deployment is executed. + delete = "Delete" #: The resource exists in the current state and is missing from the desired state. The resource will be deleted when the deployment is executed. + ignore = "Ignore" #: The resource exists in the current state and is missing from the desired state. The resource will not be deployed or modified when the deployment is executed. + deploy = "Deploy" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. + no_change = "NoChange" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. + modify = "Modify" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py index 2a588985122d..cce48e2940ff 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py @@ -2203,6 +2203,120 @@ def validate_at_subscription_scope( return deserialized validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def _what_if_at_subscription_scope_initial( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.DeploymentWhatIf(location=location, properties=properties) + + # Construct URL + url = self.what_if_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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['Accept'] = 'application/json' + 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, 'DeploymentWhatIf') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def what_if_at_subscription_scope( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Returns changes that will be made by the deployment if executed at the + scope of the subscription. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIfProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns WhatIfOperationResult + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfOperationResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfOperationResult]] + :raises: :class:`CloudError` + """ + raw_result = self._what_if_at_subscription_scope_initial( + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + deserialized = self._deserialize('WhatIfOperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + what_if_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} + def export_template_at_subscription_scope( self, deployment_name, custom_headers=None, raw=False, **operation_config): """Exports the template used for specified deployment. @@ -2799,6 +2913,125 @@ def validate( return deserialized validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def _what_if_initial( + self, resource_group_name, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.DeploymentWhatIf(location=location, properties=properties) + + # Construct URL + url = self.what_if.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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['Accept'] = 'application/json' + 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, 'DeploymentWhatIf') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def what_if( + self, resource_group_name, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Returns changes that will be made by the deployment if executed at the + scope of the resource group. + + :param resource_group_name: The name of the resource group the + template will be deployed to. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentWhatIfProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns WhatIfOperationResult + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfOperationResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.WhatIfOperationResult]] + :raises: :class:`CloudError` + """ + raw_result = self._what_if_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + deserialized = self._deserialize('WhatIfOperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + what_if.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} + def export_template( self, resource_group_name, deployment_name, custom_headers=None, raw=False, **operation_config): """Exports the template used for specified deployment. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/__init__.py index f37d22a86f2d..7f71f20a961b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/__init__.py @@ -24,6 +24,9 @@ from ._models_py3 import DeploymentProperties from ._models_py3 import DeploymentPropertiesExtended from ._models_py3 import DeploymentValidateResult + from ._models_py3 import DeploymentWhatIf + from ._models_py3 import DeploymentWhatIfProperties + from ._models_py3 import DeploymentWhatIfSettings from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorResponse from ._models_py3 import ExportTemplateRequest @@ -56,6 +59,9 @@ from ._models_py3 import TargetResource from ._models_py3 import TemplateHashResult from ._models_py3 import TemplateLink + from ._models_py3 import WhatIfChange + from ._models_py3 import WhatIfOperationResult + from ._models_py3 import WhatIfPropertyChange except (SyntaxError, ImportError): from ._models import AliasPathType from ._models import AliasType @@ -71,6 +77,9 @@ from ._models import DeploymentProperties from ._models import DeploymentPropertiesExtended from ._models import DeploymentValidateResult + from ._models import DeploymentWhatIf + from ._models import DeploymentWhatIfProperties + from ._models import DeploymentWhatIfSettings from ._models import ErrorAdditionalInfo from ._models import ErrorResponse from ._models import ExportTemplateRequest @@ -103,6 +112,9 @@ from ._models import TargetResource from ._models import TemplateHashResult from ._models import TemplateLink + from ._models import WhatIfChange + from ._models import WhatIfOperationResult + from ._models import WhatIfPropertyChange from ._paged_models import DeploymentExtendedPaged from ._paged_models import DeploymentOperationPaged from ._paged_models import GenericResourcePaged @@ -113,7 +125,10 @@ from ._resource_management_client_enums import ( DeploymentMode, OnErrorDeploymentType, + WhatIfResultFormat, ResourceIdentityType, + PropertyChangeType, + ChangeType, ) __all__ = [ @@ -131,6 +146,9 @@ 'DeploymentProperties', 'DeploymentPropertiesExtended', 'DeploymentValidateResult', + 'DeploymentWhatIf', + 'DeploymentWhatIfProperties', + 'DeploymentWhatIfSettings', 'ErrorAdditionalInfo', 'ErrorResponse', 'ExportTemplateRequest', @@ -163,6 +181,9 @@ 'TargetResource', 'TemplateHashResult', 'TemplateLink', + 'WhatIfChange', + 'WhatIfOperationResult', + 'WhatIfPropertyChange', 'OperationPaged', 'DeploymentExtendedPaged', 'ProviderPaged', @@ -172,5 +193,8 @@ 'DeploymentOperationPaged', 'DeploymentMode', 'OnErrorDeploymentType', + 'WhatIfResultFormat', 'ResourceIdentityType', + 'PropertyChangeType', + 'ChangeType', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models.py index 7001247f9d53..525c93fe0bad 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models.py @@ -540,6 +540,118 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) +class DeploymentWhatIf(Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__(self, **kwargs): + super(DeploymentWhatIf, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want + to pass the template syntax directly in the request rather than link to an + existing template. It can be a JObject or well-formed JSON string. Use + either the templateLink property or the template property, but not both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink + property or the template property, but not both. + :type template_link: + ~azure.mgmt.resource.resources.v2019_08_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment + parameters for the template. You use this element when you want to provide + the parameter values directly in the request rather than link to an + existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed + JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element + to link to an existing parameters file. Use either the parametersLink + property or the parameters property, but not both. + :type parameters_link: + ~azure.mgmt.resource.resources.v2019_08_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This + value can be either Incremental or Complete. In Incremental mode, + resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the + template are deleted. Be careful when using Complete mode as you may + unintentionally delete resources. Possible values include: 'Incremental', + 'Complete' + :type mode: str or + ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: + ~azure.mgmt.resource.resources.v2019_08_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_08_01.models.OnErrorDeployment + :param what_if_settings: Optional What-If operation settings. + :type what_if_settings: + ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIfSettings + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, + } + + def __init__(self, **kwargs): + super(DeploymentWhatIfProperties, self).__init__(**kwargs) + self.what_if_settings = kwargs.get('what_if_settings', None) + + +class DeploymentWhatIfSettings(Model): + """Deployment What-If operation settings. + + :param result_format: The format of the What-If results. Possible values + include: 'ResourceIdOnly', 'FullResourcePayloads' + :type result_format: str or + ~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfResultFormat + """ + + _attribute_map = { + 'result_format': {'key': 'resultFormat', 'type': 'WhatIfResultFormat'}, + } + + def __init__(self, **kwargs): + super(DeploymentWhatIfSettings, self).__init__(**kwargs) + self.result_format = kwargs.get('result_format', None) + + class ErrorAdditionalInfo(Model): """The resource management error additional info. @@ -1512,3 +1624,118 @@ def __init__(self, **kwargs): super(TemplateLink, self).__init__(**kwargs) self.uri = kwargs.get('uri', None) self.content_version = kwargs.get('content_version', None) + + +class WhatIfChange(Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Resource ID + :type resource_id: str + :param change_type: Required. Type of change that will be made to the + resource when the deployment is executed. Possible values include: + 'Create', 'Delete', 'Ignore', 'Deploy', 'NoChange', 'Modify' + :type change_type: str or + ~azure.mgmt.resource.resources.v2019_08_01.models.ChangeType + :param before: The snapshot of the resource before the deployment is + executed. + :type before: object + :param after: The predicted snapshot of the resource after the deployment + is executed. + :type after: object + :param delta: The predicted changes to resource properties. + :type delta: + list[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_type': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'ChangeType'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'delta': {'key': 'delta', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__(self, **kwargs): + super(WhatIfChange, self).__init__(**kwargs) + self.resource_id = kwargs.get('resource_id', None) + self.change_type = kwargs.get('change_type', None) + self.before = kwargs.get('before', None) + self.after = kwargs.get('after', None) + self.delta = kwargs.get('delta', None) + + +class WhatIfOperationResult(Model): + """Result of the What-If operation. Contains a list of predicted changes and a + URL link to get to the next set of results. + + :param status: Status of the What-If operation. + :type status: str + :param changes: List of resource changes predicted by What-If operation. + :type changes: + list[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfChange] + :param error: Error when What-If operation fails. + :type error: + ~azure.mgmt.resource.resources.v2019_08_01.models.ErrorResponse + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'changes': {'key': 'properties.changes', 'type': '[WhatIfChange]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(WhatIfOperationResult, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.changes = kwargs.get('changes', None) + self.error = kwargs.get('error', None) + + +class WhatIfPropertyChange(Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. The path of the property. + :type path: str + :param property_change_type: Required. The type of property change. + Possible values include: 'Create', 'Delete', 'Modify', 'Array' + :type property_change_type: str or + ~azure.mgmt.resource.resources.v2019_08_01.models.PropertyChangeType + :param before: The value of the property before the deployment is + executed. + :type before: object + :param after: The value of the property after the deployment is executed. + :type after: object + :param children: Nested property changes. + :type children: + list[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'path': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'PropertyChangeType'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'children': {'key': 'children', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__(self, **kwargs): + super(WhatIfPropertyChange, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.property_change_type = kwargs.get('property_change_type', None) + self.before = kwargs.get('before', None) + self.after = kwargs.get('after', None) + self.children = kwargs.get('children', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py index cb39eb78a770..9ed400df10a7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py @@ -540,6 +540,118 @@ def __init__(self, *, error=None, properties=None, **kwargs) -> None: self.properties = properties +class DeploymentWhatIf(Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIfProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentWhatIfProperties'}, + } + + def __init__(self, *, properties, location: str=None, **kwargs) -> None: + super(DeploymentWhatIf, self).__init__(**kwargs) + self.location = location + self.properties = properties + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want + to pass the template syntax directly in the request rather than link to an + existing template. It can be a JObject or well-formed JSON string. Use + either the templateLink property or the template property, but not both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink + property or the template property, but not both. + :type template_link: + ~azure.mgmt.resource.resources.v2019_08_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment + parameters for the template. You use this element when you want to provide + the parameter values directly in the request rather than link to an + existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed + JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element + to link to an existing parameters file. Use either the parametersLink + property or the parameters property, but not both. + :type parameters_link: + ~azure.mgmt.resource.resources.v2019_08_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This + value can be either Incremental or Complete. In Incremental mode, + resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the + template are deleted. Be careful when using Complete mode as you may + unintentionally delete resources. Possible values include: 'Incremental', + 'Complete' + :type mode: str or + ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: + ~azure.mgmt.resource.resources.v2019_08_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_08_01.models.OnErrorDeployment + :param what_if_settings: Optional What-If operation settings. + :type what_if_settings: + ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIfSettings + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + 'what_if_settings': {'key': 'whatIfSettings', 'type': 'DeploymentWhatIfSettings'}, + } + + def __init__(self, *, mode, template=None, template_link=None, parameters=None, parameters_link=None, debug_setting=None, on_error_deployment=None, what_if_settings=None, **kwargs) -> None: + super(DeploymentWhatIfProperties, self).__init__(template=template, template_link=template_link, parameters=parameters, parameters_link=parameters_link, mode=mode, debug_setting=debug_setting, on_error_deployment=on_error_deployment, **kwargs) + self.what_if_settings = what_if_settings + + +class DeploymentWhatIfSettings(Model): + """Deployment What-If operation settings. + + :param result_format: The format of the What-If results. Possible values + include: 'ResourceIdOnly', 'FullResourcePayloads' + :type result_format: str or + ~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfResultFormat + """ + + _attribute_map = { + 'result_format': {'key': 'resultFormat', 'type': 'WhatIfResultFormat'}, + } + + def __init__(self, *, result_format=None, **kwargs) -> None: + super(DeploymentWhatIfSettings, self).__init__(**kwargs) + self.result_format = result_format + + class ErrorAdditionalInfo(Model): """The resource management error additional info. @@ -1512,3 +1624,118 @@ def __init__(self, *, uri: str, content_version: str=None, **kwargs) -> None: super(TemplateLink, self).__init__(**kwargs) self.uri = uri self.content_version = content_version + + +class WhatIfChange(Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to Azure. + + :param resource_id: Required. Resource ID + :type resource_id: str + :param change_type: Required. Type of change that will be made to the + resource when the deployment is executed. Possible values include: + 'Create', 'Delete', 'Ignore', 'Deploy', 'NoChange', 'Modify' + :type change_type: str or + ~azure.mgmt.resource.resources.v2019_08_01.models.ChangeType + :param before: The snapshot of the resource before the deployment is + executed. + :type before: object + :param after: The predicted snapshot of the resource after the deployment + is executed. + :type after: object + :param delta: The predicted changes to resource properties. + :type delta: + list[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'resource_id': {'required': True}, + 'change_type': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'ChangeType'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'delta': {'key': 'delta', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__(self, *, resource_id: str, change_type, before=None, after=None, delta=None, **kwargs) -> None: + super(WhatIfChange, self).__init__(**kwargs) + self.resource_id = resource_id + self.change_type = change_type + self.before = before + self.after = after + self.delta = delta + + +class WhatIfOperationResult(Model): + """Result of the What-If operation. Contains a list of predicted changes and a + URL link to get to the next set of results. + + :param status: Status of the What-If operation. + :type status: str + :param changes: List of resource changes predicted by What-If operation. + :type changes: + list[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfChange] + :param error: Error when What-If operation fails. + :type error: + ~azure.mgmt.resource.resources.v2019_08_01.models.ErrorResponse + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'changes': {'key': 'properties.changes', 'type': '[WhatIfChange]'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, status: str=None, changes=None, error=None, **kwargs) -> None: + super(WhatIfOperationResult, self).__init__(**kwargs) + self.status = status + self.changes = changes + self.error = error + + +class WhatIfPropertyChange(Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. The path of the property. + :type path: str + :param property_change_type: Required. The type of property change. + Possible values include: 'Create', 'Delete', 'Modify', 'Array' + :type property_change_type: str or + ~azure.mgmt.resource.resources.v2019_08_01.models.PropertyChangeType + :param before: The value of the property before the deployment is + executed. + :type before: object + :param after: The value of the property after the deployment is executed. + :type after: object + :param children: Nested property changes. + :type children: + list[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfPropertyChange] + """ + + _validation = { + 'path': {'required': True}, + 'property_change_type': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'property_change_type': {'key': 'propertyChangeType', 'type': 'PropertyChangeType'}, + 'before': {'key': 'before', 'type': 'object'}, + 'after': {'key': 'after', 'type': 'object'}, + 'children': {'key': 'children', 'type': '[WhatIfPropertyChange]'}, + } + + def __init__(self, *, path: str, property_change_type, before=None, after=None, children=None, **kwargs) -> None: + super(WhatIfPropertyChange, self).__init__(**kwargs) + self.path = path + self.property_change_type = property_change_type + self.before = before + self.after = after + self.children = children diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_resource_management_client_enums.py index 9fd73ca1de47..7306f86842bf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_resource_management_client_enums.py @@ -24,9 +24,33 @@ class OnErrorDeploymentType(str, Enum): specific_deployment = "SpecificDeployment" +class WhatIfResultFormat(str, Enum): + + resource_id_only = "ResourceIdOnly" + full_resource_payloads = "FullResourcePayloads" + + class ResourceIdentityType(str, Enum): system_assigned = "SystemAssigned" user_assigned = "UserAssigned" system_assigned_user_assigned = "SystemAssigned, UserAssigned" none = "None" + + +class PropertyChangeType(str, Enum): + + create = "Create" #: The property does not exist in the current state but is present in the desired state. The property will be created when the deployment is executed. + delete = "Delete" #: The property exists in the current state and is missing from the desired state. It will be deleted when the deployment is executed. + modify = "Modify" #: The property exists in both current and desired state and is different. The value of the property will change when the deployment is executed. + array = "Array" #: The property is an array and contains nested changes. + + +class ChangeType(str, Enum): + + create = "Create" #: The resource does not exist in the current state but is present in the desired state. The resource will be created when the deployment is executed. + delete = "Delete" #: The resource exists in the current state and is missing from the desired state. The resource will be deleted when the deployment is executed. + ignore = "Ignore" #: The resource exists in the current state and is missing from the desired state. The resource will not be deployed or modified when the deployment is executed. + deploy = "Deploy" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. + no_change = "NoChange" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. + modify = "Modify" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py index d49b475689b0..26406e6a8e31 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_deployments_operations.py @@ -2203,6 +2203,120 @@ def validate_at_subscription_scope( return deserialized validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def _what_if_at_subscription_scope_initial( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.DeploymentWhatIf(location=location, properties=properties) + + # Construct URL + url = self.what_if_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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['Accept'] = 'application/json' + 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, 'DeploymentWhatIf') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def what_if_at_subscription_scope( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Returns changes that will be made by the deployment if executed at the + scope of the subscription. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIfProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns WhatIfOperationResult + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfOperationResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfOperationResult]] + :raises: :class:`CloudError` + """ + raw_result = self._what_if_at_subscription_scope_initial( + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + deserialized = self._deserialize('WhatIfOperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + what_if_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} + def export_template_at_subscription_scope( self, deployment_name, custom_headers=None, raw=False, **operation_config): """Exports the template used for specified deployment. @@ -2799,6 +2913,125 @@ def validate( return deserialized validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def _what_if_initial( + self, resource_group_name, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.DeploymentWhatIf(location=location, properties=properties) + + # Construct URL + url = self.what_if.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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['Accept'] = 'application/json' + 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, 'DeploymentWhatIf') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('WhatIfOperationResult', response) + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def what_if( + self, resource_group_name, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Returns changes that will be made by the deployment if executed at the + scope of the resource group. + + :param resource_group_name: The name of the resource group the + template will be deployed to. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentWhatIfProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns WhatIfOperationResult + or ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfOperationResult] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_08_01.models.WhatIfOperationResult]] + :raises: :class:`CloudError` + """ + raw_result = self._what_if_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Location': 'str', + 'Retry-After': 'str', + } + deserialized = self._deserialize('WhatIfOperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + what_if.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'} + def export_template( self, resource_group_name, deployment_name, custom_headers=None, raw=False, **operation_config): """Exports the template used for specified deployment. From f1265f4dafd7be7198897c9c62cc5df262bbd499 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Fri, 4 Oct 2019 16:11:44 +0800 Subject: [PATCH 2/3] updated history and version --- sdk/resources/azure-mgmt-resource/HISTORY.rst | 8 ++++++++ .../azure-mgmt-resource/azure/mgmt/resource/version.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sdk/resources/azure-mgmt-resource/HISTORY.rst b/sdk/resources/azure-mgmt-resource/HISTORY.rst index 1cb68927b937..f70aad3d59f1 100644 --- a/sdk/resources/azure-mgmt-resource/HISTORY.rst +++ b/sdk/resources/azure-mgmt-resource/HISTORY.rst @@ -3,6 +3,14 @@ Release History =============== +5.1.0 (2019-09-22) +++++++++++++++++++ + +**Features** + +- Added operation DeploymentsOperations.what_if +- Added operation DeploymentsOperations.what_if_at_subscription_scope + 5.0.0 (2019-09-22) ++++++++++++++++++ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/version.py index fbf12e61f12c..8edb4b7f70f8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "5.1.0" From d8e41e14b60a40306b3fa4b7adb2130b1cd08265 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Fri, 4 Oct 2019 16:12:00 +0800 Subject: [PATCH 3/3] updated date --- sdk/resources/azure-mgmt-resource/HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/resources/azure-mgmt-resource/HISTORY.rst b/sdk/resources/azure-mgmt-resource/HISTORY.rst index f70aad3d59f1..ba0ab74a225f 100644 --- a/sdk/resources/azure-mgmt-resource/HISTORY.rst +++ b/sdk/resources/azure-mgmt-resource/HISTORY.rst @@ -3,7 +3,7 @@ Release History =============== -5.1.0 (2019-09-22) +5.1.0 (2019-10-04) ++++++++++++++++++ **Features**