diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py index 8d0d5df1bd7c..3d5fd1d7b7db 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models.py @@ -150,7 +150,8 @@ class AzureCliScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -187,7 +188,7 @@ class AzureCliScript(DeploymentScript): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta :param az_cli_version: Required. Azure CLI module version to be used. :type az_cli_version: str @@ -239,7 +240,7 @@ def __init__(self, **kwargs): super(AzureCliScript, self).__init__(**kwargs) self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -250,7 +251,7 @@ def __init__(self, **kwargs): self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs.get('retention_interval', None) - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_cli_version = kwargs.get('az_cli_version', None) self.kind = 'AzureCLI' @@ -291,7 +292,8 @@ class AzurePowerShellScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -328,7 +330,7 @@ class AzurePowerShellScript(DeploymentScript): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta :param az_power_shell_version: Required. Azure PowerShell module version to be used. @@ -381,7 +383,7 @@ def __init__(self, **kwargs): super(AzurePowerShellScript, self).__init__(**kwargs) self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -392,7 +394,7 @@ def __init__(self, **kwargs): self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs.get('retention_interval', None) - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_power_shell_version = kwargs.get('az_power_shell_version', None) self.kind = 'AzurePowerShell' @@ -450,7 +452,8 @@ class DeploymentScriptPropertiesBase(Model): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -484,7 +487,7 @@ def __init__(self, **kwargs): super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -719,7 +722,7 @@ class ScriptConfigurationBase(Model): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta """ @@ -748,7 +751,7 @@ def __init__(self, **kwargs): self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs.get('retention_interval', None) - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") class ScriptLog(AzureResourceBase): @@ -890,8 +893,7 @@ class SystemData(Model): 'ManagedIdentity', 'Key' :type last_modified_by_type: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the - resource. + :param last_modified_at: The timestamp of resource last modification (UTC) :type last_modified_at: datetime """ @@ -917,13 +919,21 @@ def __init__(self, **kwargs): class UserAssignedIdentity(Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, @@ -931,5 +941,5 @@ class UserAssignedIdentity(Model): def __init__(self, **kwargs): super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) + self.principal_id = None + self.client_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py index 3c133d7de123..bcfc72cf970a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py @@ -150,7 +150,8 @@ class AzureCliScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -187,7 +188,7 @@ class AzureCliScript(DeploymentScript): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta :param az_cli_version: Required. Azure CLI module version to be used. :type az_cli_version: str @@ -235,7 +236,7 @@ class AzureCliScript(DeploymentScript): 'az_cli_version': {'key': 'properties.azCliVersion', 'type': 'str'}, } - def __init__(self, *, identity, location: str, retention_interval, az_cli_version: str, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference=None, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + def __init__(self, *, identity, location: str, retention_interval, az_cli_version: str, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference="Always", primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout="P1D", **kwargs) -> None: super(AzureCliScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) self.container_settings = container_settings self.storage_account_settings = storage_account_settings @@ -291,7 +292,8 @@ class AzurePowerShellScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -328,7 +330,7 @@ class AzurePowerShellScript(DeploymentScript): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta :param az_power_shell_version: Required. Azure PowerShell module version to be used. @@ -377,7 +379,7 @@ class AzurePowerShellScript(DeploymentScript): 'az_power_shell_version': {'key': 'properties.azPowerShellVersion', 'type': 'str'}, } - def __init__(self, *, identity, location: str, retention_interval, az_power_shell_version: str, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference=None, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + def __init__(self, *, identity, location: str, retention_interval, az_power_shell_version: str, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference="Always", primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout="P1D", **kwargs) -> None: super(AzurePowerShellScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) self.container_settings = container_settings self.storage_account_settings = storage_account_settings @@ -450,7 +452,8 @@ class DeploymentScriptPropertiesBase(Model): ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -480,7 +483,7 @@ class DeploymentScriptPropertiesBase(Model): 'outputs': {'key': 'outputs', 'type': '{object}'}, } - def __init__(self, *, container_settings=None, storage_account_settings=None, cleanup_preference=None, **kwargs) -> None: + def __init__(self, *, container_settings=None, storage_account_settings=None, cleanup_preference="Always", **kwargs) -> None: super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) self.container_settings = container_settings self.storage_account_settings = storage_account_settings @@ -719,7 +722,7 @@ class ScriptConfigurationBase(Model): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta """ @@ -739,7 +742,7 @@ class ScriptConfigurationBase(Model): 'timeout': {'key': 'timeout', 'type': 'duration'}, } - def __init__(self, *, retention_interval, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + def __init__(self, *, retention_interval, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout="P1D", **kwargs) -> None: super(ScriptConfigurationBase, self).__init__(**kwargs) self.primary_script_uri = primary_script_uri self.supporting_script_uris = supporting_script_uris @@ -890,8 +893,7 @@ class SystemData(Model): 'ManagedIdentity', 'Key' :type last_modified_by_type: str or ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the - resource. + :param last_modified_at: The timestamp of resource last modification (UTC) :type last_modified_at: datetime """ @@ -917,19 +919,27 @@ def __init__(self, *, created_by: str=None, created_by_type=None, created_at=Non class UserAssignedIdentity(Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, } - def __init__(self, *, principal_id: str=None, client_id: str=None, **kwargs) -> None: + def __init__(self, **kwargs) -> None: super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = principal_id - self.client_id = client_id + self.principal_id = None + self.client_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py index 2dcb68147f19..a4b3831437f7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models.py @@ -149,7 +149,8 @@ class AzureCliScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -186,7 +187,7 @@ class AzureCliScript(DeploymentScript): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta :param az_cli_version: Required. Azure CLI module version to be used. :type az_cli_version: str @@ -237,7 +238,7 @@ def __init__(self, **kwargs): super(AzureCliScript, self).__init__(**kwargs) self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -248,7 +249,7 @@ def __init__(self, **kwargs): self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs.get('retention_interval', None) - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_cli_version = kwargs.get('az_cli_version', None) self.kind = 'AzureCLI' @@ -289,7 +290,8 @@ class AzurePowerShellScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -326,7 +328,7 @@ class AzurePowerShellScript(DeploymentScript): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta :param az_power_shell_version: Required. Azure PowerShell module version to be used. @@ -378,7 +380,7 @@ def __init__(self, **kwargs): super(AzurePowerShellScript, self).__init__(**kwargs) self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -389,7 +391,7 @@ def __init__(self, **kwargs): self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs.get('retention_interval', None) - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") self.az_power_shell_version = kwargs.get('az_power_shell_version', None) self.kind = 'AzurePowerShell' @@ -447,7 +449,8 @@ class DeploymentScriptPropertiesBase(Model): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -481,7 +484,7 @@ def __init__(self, **kwargs): super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) self.container_settings = kwargs.get('container_settings', None) self.storage_account_settings = kwargs.get('storage_account_settings', None) - self.cleanup_preference = kwargs.get('cleanup_preference', None) + self.cleanup_preference = kwargs.get('cleanup_preference', "Always") self.provisioning_state = None self.status = None self.outputs = None @@ -712,7 +715,7 @@ class ScriptConfigurationBase(Model): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta """ @@ -741,7 +744,7 @@ def __init__(self, **kwargs): self.environment_variables = kwargs.get('environment_variables', None) self.force_update_tag = kwargs.get('force_update_tag', None) self.retention_interval = kwargs.get('retention_interval', None) - self.timeout = kwargs.get('timeout', None) + self.timeout = kwargs.get('timeout', "P1D") class ScriptLog(AzureResourceBase): @@ -883,8 +886,7 @@ class SystemData(Model): 'ManagedIdentity', 'Key' :type last_modified_by_type: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CreatedByType - :param last_modified_at: The type of identity that last modified the - resource. + :param last_modified_at: The timestamp of resource last modification (UTC) :type last_modified_at: datetime """ @@ -910,13 +912,21 @@ def __init__(self, **kwargs): class UserAssignedIdentity(Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, @@ -924,5 +934,5 @@ class UserAssignedIdentity(Model): def __init__(self, **kwargs): super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) + self.principal_id = None + self.client_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py index dd8dea762ea9..70cdbb28ac5f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py @@ -149,7 +149,8 @@ class AzureCliScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -186,7 +187,7 @@ class AzureCliScript(DeploymentScript): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta :param az_cli_version: Required. Azure CLI module version to be used. :type az_cli_version: str @@ -233,7 +234,7 @@ class AzureCliScript(DeploymentScript): 'az_cli_version': {'key': 'properties.azCliVersion', 'type': 'str'}, } - def __init__(self, *, location: str, retention_interval, az_cli_version: str, identity=None, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference=None, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + def __init__(self, *, location: str, retention_interval, az_cli_version: str, identity=None, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference="Always", primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout="P1D", **kwargs) -> None: super(AzureCliScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) self.container_settings = container_settings self.storage_account_settings = storage_account_settings @@ -289,7 +290,8 @@ class AzurePowerShellScript(DeploymentScript): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -326,7 +328,7 @@ class AzurePowerShellScript(DeploymentScript): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta :param az_power_shell_version: Required. Azure PowerShell module version to be used. @@ -374,7 +376,7 @@ class AzurePowerShellScript(DeploymentScript): 'az_power_shell_version': {'key': 'properties.azPowerShellVersion', 'type': 'str'}, } - def __init__(self, *, location: str, retention_interval, az_power_shell_version: str, identity=None, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference=None, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + def __init__(self, *, location: str, retention_interval, az_power_shell_version: str, identity=None, tags=None, container_settings=None, storage_account_settings=None, cleanup_preference="Always", primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout="P1D", **kwargs) -> None: super(AzurePowerShellScript, self).__init__(identity=identity, location=location, tags=tags, **kwargs) self.container_settings = container_settings self.storage_account_settings = storage_account_settings @@ -447,7 +449,8 @@ class DeploymentScriptPropertiesBase(Model): ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.StorageAccountConfiguration :param cleanup_preference: The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. Possible - values include: 'Always', 'OnSuccess', 'OnExpiration' + values include: 'Always', 'OnSuccess', 'OnExpiration'. Default value: + "Always" . :type cleanup_preference: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CleanupOptions :ivar provisioning_state: State of the script execution. This only appears @@ -477,7 +480,7 @@ class DeploymentScriptPropertiesBase(Model): 'outputs': {'key': 'outputs', 'type': '{object}'}, } - def __init__(self, *, container_settings=None, storage_account_settings=None, cleanup_preference=None, **kwargs) -> None: + def __init__(self, *, container_settings=None, storage_account_settings=None, cleanup_preference="Always", **kwargs) -> None: super(DeploymentScriptPropertiesBase, self).__init__(**kwargs) self.container_settings = container_settings self.storage_account_settings = storage_account_settings @@ -712,7 +715,7 @@ class ScriptConfigurationBase(Model): pattern (for example P7D means one week). :type retention_interval: timedelta :param timeout: Maximum allowed script execution time specified in ISO - 8601 format. Default value is PT1H + 8601 format. Default value is P1D. Default value: "P1D" . :type timeout: timedelta """ @@ -732,7 +735,7 @@ class ScriptConfigurationBase(Model): 'timeout': {'key': 'timeout', 'type': 'duration'}, } - def __init__(self, *, retention_interval, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout=None, **kwargs) -> None: + def __init__(self, *, retention_interval, primary_script_uri: str=None, supporting_script_uris=None, script_content: str=None, arguments: str=None, environment_variables=None, force_update_tag: str=None, timeout="P1D", **kwargs) -> None: super(ScriptConfigurationBase, self).__init__(**kwargs) self.primary_script_uri = primary_script_uri self.supporting_script_uris = supporting_script_uris @@ -883,8 +886,7 @@ class SystemData(Model): 'ManagedIdentity', 'Key' :type last_modified_by_type: str or ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.CreatedByType - :param last_modified_at: The type of identity that last modified the - resource. + :param last_modified_at: The timestamp of resource last modification (UTC) :type last_modified_at: datetime """ @@ -910,19 +912,27 @@ def __init__(self, *, created_by: str=None, created_by_type=None, created_at=Non class UserAssignedIdentity(Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, } - def __init__(self, *, principal_id: str=None, client_id: str=None, **kwargs) -> None: + def __init__(self, **kwargs) -> None: super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = principal_id - self.client_id = client_id + self.principal_id = None + self.client_id = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py index 42531914c39a..d2a321d231ba 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py @@ -19,7 +19,7 @@ class PolicyClient(MultiApiClientMixin, SDKClient): - """To manage and control access to your resources, you can define customized policies and assign them at a scope. + """PolicyClient This ready contains multiple API versions, to help you deal with all Azure clouds (Azure Stack, Azure Government, Azure China, etc.). @@ -208,6 +208,19 @@ def policy_definitions(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def policy_exemptions(self): + """Instance depends on the API version: + + * 2020-09-01: :class:`PolicyExemptionsOperations` + """ + api_version = self._get_api_version('policy_exemptions') + if api_version == '2020-09-01': + from .v2020_09_01.operations import PolicyExemptionsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def policy_set_definitions(self): """Instance depends on the API version: diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py index 179ce7dc9f2b..9a31391ee857 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py @@ -17,11 +17,12 @@ from .operations import PolicyAssignmentsOperations from .operations import PolicyDefinitionsOperations from .operations import PolicySetDefinitionsOperations +from .operations import PolicyExemptionsOperations from . import models class PolicyClient(SDKClient): - """To manage and control access to your resources, you can define customized policies and assign them at a scope. + """PolicyClient :ivar config: Configuration for client. :vartype config: PolicyClientConfiguration @@ -34,6 +35,8 @@ class PolicyClient(SDKClient): :vartype policy_definitions: azure.mgmt.resource.policy.v2020_09_01.operations.PolicyDefinitionsOperations :ivar policy_set_definitions: PolicySetDefinitions operations :vartype policy_set_definitions: azure.mgmt.resource.policy.v2020_09_01.operations.PolicySetDefinitionsOperations + :ivar policy_exemptions: PolicyExemptions operations + :vartype policy_exemptions: azure.mgmt.resource.policy.v2020_09_01.operations.PolicyExemptionsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -50,7 +53,6 @@ def __init__( super(PolicyClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2020-09-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -62,3 +64,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.policy_set_definitions = PolicySetDefinitionsOperations( self._client, self.config, self._serialize, self._deserialize) + self.policy_exemptions = PolicyExemptionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/__init__.py index c826763dc418..0d2f62f28f4a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/__init__.py @@ -14,12 +14,11 @@ from ._models_py3 import AliasPath from ._models_py3 import AliasPathMetadata from ._models_py3 import AliasPattern - from ._models_py3 import CloudError, CloudErrorException from ._models_py3 import DataEffect from ._models_py3 import DataManifestCustomResourceFunctionDefinition from ._models_py3 import DataPolicyManifest from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse from ._models_py3 import Identity from ._models_py3 import NonComplianceMessage from ._models_py3 import ParameterDefinitionsValue @@ -29,19 +28,20 @@ from ._models_py3 import PolicyDefinition from ._models_py3 import PolicyDefinitionGroup from ._models_py3 import PolicyDefinitionReference + from ._models_py3 import PolicyExemption from ._models_py3 import PolicySetDefinition from ._models_py3 import ResourceTypeAliases + from ._models_py3 import SystemData except (SyntaxError, ImportError): from ._models import Alias from ._models import AliasPath from ._models import AliasPathMetadata from ._models import AliasPattern - from ._models import CloudError, CloudErrorException from ._models import DataEffect from ._models import DataManifestCustomResourceFunctionDefinition from ._models import DataPolicyManifest from ._models import ErrorAdditionalInfo - from ._models import ErrorDetail + from ._models import ErrorResponse from ._models import Identity from ._models import NonComplianceMessage from ._models import ParameterDefinitionsValue @@ -51,11 +51,14 @@ from ._models import PolicyDefinition from ._models import PolicyDefinitionGroup from ._models import PolicyDefinitionReference + from ._models import PolicyExemption from ._models import PolicySetDefinition from ._models import ResourceTypeAliases + from ._models import SystemData from ._paged_models import DataPolicyManifestPaged from ._paged_models import PolicyAssignmentPaged from ._paged_models import PolicyDefinitionPaged +from ._paged_models import PolicyExemptionPaged from ._paged_models import PolicySetDefinitionPaged from ._policy_client_enums import ( AliasPatternType, @@ -66,6 +69,8 @@ ResourceIdentityType, PolicyType, ParameterType, + ExemptionCategory, + CreatedByType, ) __all__ = [ @@ -73,12 +78,11 @@ 'AliasPath', 'AliasPathMetadata', 'AliasPattern', - 'CloudError', 'CloudErrorException', 'DataEffect', 'DataManifestCustomResourceFunctionDefinition', 'DataPolicyManifest', 'ErrorAdditionalInfo', - 'ErrorDetail', + 'ErrorResponse', 'Identity', 'NonComplianceMessage', 'ParameterDefinitionsValue', @@ -88,12 +92,15 @@ 'PolicyDefinition', 'PolicyDefinitionGroup', 'PolicyDefinitionReference', + 'PolicyExemption', 'PolicySetDefinition', 'ResourceTypeAliases', + 'SystemData', 'DataPolicyManifestPaged', 'PolicyAssignmentPaged', 'PolicyDefinitionPaged', 'PolicySetDefinitionPaged', + 'PolicyExemptionPaged', 'AliasPatternType', 'AliasPathTokenType', 'AliasPathAttributes', @@ -102,4 +109,6 @@ 'ResourceIdentityType', 'PolicyType', 'ParameterType', + 'ExemptionCategory', + 'CreatedByType', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models.py index 6cd04642d44f..55c801014808 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models.py @@ -159,18 +159,14 @@ def __init__(self, **kwargs): class CloudError(Model): - """Error response. + """An error response from a policy operation. - Common error response for all Azure Resource Manager APIs to return error - details for failed operations. (This also follows the OData error response - format.). - - :param error: The error object. - :type error: ~azure.mgmt.resource.policy.v2020_09_01.models.ErrorDetail + :param error: + :type error: ~azure.mgmt.resource.policy.v2020_09_01.models.ErrorResponse """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, } def __init__(self, **kwargs): @@ -346,8 +342,12 @@ def __init__(self, **kwargs): self.info = None -class ErrorDetail(Model): - """The error detail. +class ErrorResponse(Model): + """Error Response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -360,7 +360,7 @@ class ErrorDetail(Model): :vartype target: str :ivar details: The error details. :vartype details: - list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorDetail] + list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorResponse] :ivar additional_info: The error additional info. :vartype additional_info: list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorAdditionalInfo] @@ -378,12 +378,12 @@ class ErrorDetail(Model): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__(self, **kwargs): - super(ErrorDetail, self).__init__(**kwargs) + super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None self.target = None @@ -783,6 +783,87 @@ def __init__(self, **kwargs): self.group_names = kwargs.get('group_names', None) +class PolicyExemption(Model): + """The policy exemption. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param policy_assignment_id: Required. The ID of the policy assignment + that is being exempted. + :type policy_assignment_id: str + :param policy_definition_reference_ids: The policy definition reference ID + list when the associated policy assignment is an assignment of a policy + set definition. + :type policy_definition_reference_ids: list[str] + :param exemption_category: Required. The policy exemption category. + Possible values are Waiver and Mitigated. Possible values include: + 'Waiver', 'Mitigated' + :type exemption_category: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.ExemptionCategory + :param expires_on: The expiration date and time (in UTC ISO 8601 format + yyyy-MM-ddTHH:mm:ssZ) of the policy exemption. + :type expires_on: datetime + :param display_name: The display name of the policy exemption. + :type display_name: str + :param description: The description of the policy exemption. + :type description: str + :param metadata: The policy exemption metadata. Metadata is an open ended + object and is typically a collection of key value pairs. + :type metadata: object + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.policy.v2020_09_01.models.SystemData + :ivar id: The ID of the policy exemption. + :vartype id: str + :ivar name: The name of the policy exemption. + :vartype name: str + :ivar type: The type of the resource + (Microsoft.Authorization/policyExemptions). + :vartype type: str + """ + + _validation = { + 'policy_assignment_id': {'required': True}, + 'exemption_category': {'required': True}, + 'system_data': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'policy_assignment_id': {'key': 'properties.policyAssignmentId', 'type': 'str'}, + 'policy_definition_reference_ids': {'key': 'properties.policyDefinitionReferenceIds', 'type': '[str]'}, + 'exemption_category': {'key': 'properties.exemptionCategory', 'type': 'str'}, + 'expires_on': {'key': 'properties.expiresOn', 'type': 'iso-8601'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PolicyExemption, self).__init__(**kwargs) + self.policy_assignment_id = kwargs.get('policy_assignment_id', None) + self.policy_definition_reference_ids = kwargs.get('policy_definition_reference_ids', None) + self.exemption_category = kwargs.get('exemption_category', None) + self.expires_on = kwargs.get('expires_on', None) + self.display_name = kwargs.get('display_name', None) + self.description = kwargs.get('description', None) + self.metadata = kwargs.get('metadata', None) + self.system_data = None + self.id = None + self.name = None + self.type = None + + class PolicySetDefinition(Model): """The policy set definition. @@ -876,3 +957,44 @@ def __init__(self, **kwargs): super(ResourceTypeAliases, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.aliases = kwargs.get('aliases', None) + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC) + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py index 4b68ce38b626..8c5860b3a053 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py @@ -159,18 +159,14 @@ def __init__(self, *, phrase: str=None, variable: str=None, type=None, **kwargs) class CloudError(Model): - """Error response. + """An error response from a policy operation. - Common error response for all Azure Resource Manager APIs to return error - details for failed operations. (This also follows the OData error response - format.). - - :param error: The error object. - :type error: ~azure.mgmt.resource.policy.v2020_09_01.models.ErrorDetail + :param error: + :type error: ~azure.mgmt.resource.policy.v2020_09_01.models.ErrorResponse """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, } def __init__(self, *, error=None, **kwargs) -> None: @@ -346,8 +342,12 @@ def __init__(self, **kwargs) -> None: self.info = None -class ErrorDetail(Model): - """The error detail. +class ErrorResponse(Model): + """Error Response. + + Common error response for all Azure Resource Manager APIs to return error + details for failed operations. (This also follows the OData error response + format.). Variables are only populated by the server, and will be ignored when sending a request. @@ -360,7 +360,7 @@ class ErrorDetail(Model): :vartype target: str :ivar details: The error details. :vartype details: - list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorDetail] + list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorResponse] :ivar additional_info: The error additional info. :vartype additional_info: list[~azure.mgmt.resource.policy.v2020_09_01.models.ErrorAdditionalInfo] @@ -378,12 +378,12 @@ class ErrorDetail(Model): 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } def __init__(self, **kwargs) -> None: - super(ErrorDetail, self).__init__(**kwargs) + super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None self.target = None @@ -783,6 +783,87 @@ def __init__(self, *, policy_definition_id: str, parameters=None, policy_definit self.group_names = group_names +class PolicyExemption(Model): + """The policy exemption. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param policy_assignment_id: Required. The ID of the policy assignment + that is being exempted. + :type policy_assignment_id: str + :param policy_definition_reference_ids: The policy definition reference ID + list when the associated policy assignment is an assignment of a policy + set definition. + :type policy_definition_reference_ids: list[str] + :param exemption_category: Required. The policy exemption category. + Possible values are Waiver and Mitigated. Possible values include: + 'Waiver', 'Mitigated' + :type exemption_category: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.ExemptionCategory + :param expires_on: The expiration date and time (in UTC ISO 8601 format + yyyy-MM-ddTHH:mm:ssZ) of the policy exemption. + :type expires_on: datetime + :param display_name: The display name of the policy exemption. + :type display_name: str + :param description: The description of the policy exemption. + :type description: str + :param metadata: The policy exemption metadata. Metadata is an open ended + object and is typically a collection of key value pairs. + :type metadata: object + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.policy.v2020_09_01.models.SystemData + :ivar id: The ID of the policy exemption. + :vartype id: str + :ivar name: The name of the policy exemption. + :vartype name: str + :ivar type: The type of the resource + (Microsoft.Authorization/policyExemptions). + :vartype type: str + """ + + _validation = { + 'policy_assignment_id': {'required': True}, + 'exemption_category': {'required': True}, + 'system_data': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'policy_assignment_id': {'key': 'properties.policyAssignmentId', 'type': 'str'}, + 'policy_definition_reference_ids': {'key': 'properties.policyDefinitionReferenceIds', 'type': '[str]'}, + 'exemption_category': {'key': 'properties.exemptionCategory', 'type': 'str'}, + 'expires_on': {'key': 'properties.expiresOn', 'type': 'iso-8601'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'metadata': {'key': 'properties.metadata', 'type': 'object'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, policy_assignment_id: str, exemption_category, policy_definition_reference_ids=None, expires_on=None, display_name: str=None, description: str=None, metadata=None, **kwargs) -> None: + super(PolicyExemption, self).__init__(**kwargs) + self.policy_assignment_id = policy_assignment_id + self.policy_definition_reference_ids = policy_definition_reference_ids + self.exemption_category = exemption_category + self.expires_on = expires_on + self.display_name = display_name + self.description = description + self.metadata = metadata + self.system_data = None + self.id = None + self.name = None + self.type = None + + class PolicySetDefinition(Model): """The policy set definition. @@ -876,3 +957,44 @@ def __init__(self, *, resource_type: str=None, aliases=None, **kwargs) -> None: super(ResourceTypeAliases, self).__init__(**kwargs) self.resource_type = resource_type self.aliases = aliases + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.resource.policy.v2020_09_01.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC) + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, *, created_by: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_paged_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_paged_models.py index 2260ba54080e..e33a8c3e284b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_paged_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_paged_models.py @@ -64,3 +64,16 @@ class PolicySetDefinitionPaged(Paged): def __init__(self, *args, **kwargs): super(PolicySetDefinitionPaged, self).__init__(*args, **kwargs) +class PolicyExemptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`PolicyExemption ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PolicyExemption]'} + } + + def __init__(self, *args, **kwargs): + + super(PolicyExemptionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py index f3ed2bb4a4f4..e5add946300b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_policy_client_enums.py @@ -72,3 +72,17 @@ class ParameterType(str, Enum): integer = "Integer" float_enum = "Float" date_time_enum = "DateTime" + + +class ExemptionCategory(str, Enum): + + waiver = "Waiver" #: This category of exemptions usually means the scope is not applicable for the policy. + mitigated = "Mitigated" #: This category of exemptions usually means the mitigation actions have been applied to the scope. + + +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/__init__.py index 2e009bf34472..4a6a39cdbd00 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/__init__.py @@ -13,10 +13,12 @@ from ._policy_assignments_operations import PolicyAssignmentsOperations from ._policy_definitions_operations import PolicyDefinitionsOperations from ._policy_set_definitions_operations import PolicySetDefinitionsOperations +from ._policy_exemptions_operations import PolicyExemptionsOperations __all__ = [ 'DataPolicyManifestsOperations', 'PolicyAssignmentsOperations', 'PolicyDefinitionsOperations', 'PolicySetDefinitionsOperations', + 'PolicyExemptionsOperations', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py new file mode 100644 index 000000000000..f04713a7f5ac --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_policy_exemptions_operations.py @@ -0,0 +1,675 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PolicyExemptionsOperations(object): + """PolicyExemptionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the operation. Constant value: "2020-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-07-01-preview" + + self.config = config + + def delete( + self, scope, policy_exemption_name, custom_headers=None, raw=False, **operation_config): + """Deletes a policy exemption. + + This operation deletes a policy exemption, given its name and the scope + it was created in. The scope of a policy exemption is the part of its + ID preceding + '/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'. + + :param scope: The scope of the policy exemption. Valid scopes are: + management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + subscription (format: '/subscriptions/{subscriptionId}'), resource + group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', + or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + :type scope: str + :param policy_exemption_name: The name of the policy exemption to + delete. + :type policy_exemption_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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 = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} + + def create_or_update( + self, scope, policy_exemption_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a policy exemption. + + This operation creates or updates a policy exemption with the given + scope and name. Policy exemptions apply to all resources contained + within their scope. For example, when you create a policy exemption at + resource group scope for a policy assignment at the same or above + level, the exemption exempts to all applicable resources in the + resource group. + + :param scope: The scope of the policy exemption. Valid scopes are: + management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + subscription (format: '/subscriptions/{subscriptionId}'), resource + group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', + or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + :type scope: str + :param policy_exemption_name: The name of the policy exemption to + delete. + :type policy_exemption_name: str + :param parameters: Parameters for the policy exemption. + :type parameters: + ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + :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: PolicyExemption or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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['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, 'PolicyExemption') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PolicyExemption', response) + if response.status_code == 201: + deserialized = self._deserialize('PolicyExemption', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} + + def get( + self, scope, policy_exemption_name, custom_headers=None, raw=False, **operation_config): + """Retrieves a policy exemption. + + This operation retrieves a single policy exemption, given its name and + the scope it was created at. + + :param scope: The scope of the policy exemption. Valid scopes are: + management group (format: + '/providers/Microsoft.Management/managementGroups/{managementGroup}'), + subscription (format: '/subscriptions/{subscriptionId}'), resource + group (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', + or resource (format: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + :type scope: str + :param policy_exemption_name: The name of the policy exemption to + delete. + :type policy_exemption_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PolicyExemption or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'policyExemptionName': self._serialize.url("policy_exemption_name", policy_exemption_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['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PolicyExemption', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'} + + def list( + self, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves all policy exemptions that apply to a subscription. + + This operation retrieves the list of all policy exemptions associated + with the given subscription that match the optional given $filter. + Valid values for $filter are: 'atScope()', 'atExactScope()', + 'excludeExpired()' or 'policyAssignmentId eq '{value}''. If $filter is + not provided, the unfiltered list includes all policy exemptions + associated with the subscription, including those that apply directly + or from management groups that contain the given subscription, as well + as any applied to objects contained within the subscription. + + :param filter: The filter to apply on the operation. Valid values for + $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or + 'policyAssignmentId eq '{value}''. If $filter is not provided, no + filtering is performed. If $filter is not provided, the unfiltered + list includes all policy exemptions associated with the scope, + including those that apply directly or apply from containing scopes. + If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the + unfiltered list except those applied to sub scopes contained within + the given scope. If $filter=atExactScope() is provided, the returned + list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes + all policy exemptions that either haven't expired or didn't set + expiration date. If $filter=policyAssignmentId eq '{value}' is + provided. the returned list only includes all policy exemptions that + are associated with the give policyAssignmentId. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PolicyExemption + :rtype: + ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PolicyExemptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyExemptions'} + + def list_for_resource_group( + self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves all policy exemptions that apply to a resource group. + + This operation retrieves the list of all policy exemptions associated + with the given resource group in the given subscription that match the + optional given $filter. Valid values for $filter are: 'atScope()', + 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId eq + '{value}''. If $filter is not provided, the unfiltered list includes + all policy exemptions associated with the resource group, including + those that apply directly or apply from containing scopes, as well as + any applied to resources contained within the resource group. + + :param resource_group_name: The name of the resource group containing + the resource. + :type resource_group_name: str + :param filter: The filter to apply on the operation. Valid values for + $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or + 'policyAssignmentId eq '{value}''. If $filter is not provided, no + filtering is performed. If $filter is not provided, the unfiltered + list includes all policy exemptions associated with the scope, + including those that apply directly or apply from containing scopes. + If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the + unfiltered list except those applied to sub scopes contained within + the given scope. If $filter=atExactScope() is provided, the returned + list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes + all policy exemptions that either haven't expired or didn't set + expiration date. If $filter=policyAssignmentId eq '{value}' is + provided. the returned list only includes all policy exemptions that + are associated with the give policyAssignmentId. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PolicyExemption + :rtype: + ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_for_resource_group.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\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PolicyExemptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions'} + + def list_for_resource( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves all policy exemptions that apply to a resource. + + This operation retrieves the list of all policy exemptions associated + with the specified resource in the given resource group and + subscription that match the optional given $filter. Valid values for + $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or + 'policyAssignmentId eq '{value}''. If $filter is not provided, the + unfiltered list includes all policy exemptions associated with the + resource, including those that apply directly or from all containing + scopes, as well as any applied to resources contained within the + resource. Three parameters plus the resource name are used to identify + a specific resource. If the resource is not part of a parent resource + (the more common case), the parent resource path should not be provided + (or provided as ''). For example a web app could be specified as + ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} + == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the + resource is part of a parent resource, then all parameters should be + provided. For example a virtual machine DNS name could be specified as + ({resourceProviderNamespace} == 'Microsoft.Compute', + {parentResourcePath} == 'virtualMachines/MyVirtualMachine', + {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A + convenient alternative to providing the namespace and type name + separately is to provide both in the {resourceType} parameter, format: + ({resourceProviderNamespace} == '', {parentResourcePath} == '', + {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + + :param resource_group_name: The name of the resource group containing + the resource. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource + provider. For example, the namespace of a virtual machine is + Microsoft.Compute (from Microsoft.Compute/virtualMachines) + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource path. Use empty + string if there is none. + :type parent_resource_path: str + :param resource_type: The resource type name. For example the type + name of a web app is 'sites' (from Microsoft.Web/sites). + :type resource_type: str + :param resource_name: The name of the resource. + :type resource_name: str + :param filter: The filter to apply on the operation. Valid values for + $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or + 'policyAssignmentId eq '{value}''. If $filter is not provided, no + filtering is performed. If $filter is not provided, the unfiltered + list includes all policy exemptions associated with the scope, + including those that apply directly or apply from containing scopes. + If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the + unfiltered list except those applied to sub scopes contained within + the given scope. If $filter=atExactScope() is provided, the returned + list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes + all policy exemptions that either haven't expired or didn't set + expiration date. If $filter=policyAssignmentId eq '{value}' is + provided. the returned list only includes all policy exemptions that + are associated with the give policyAssignmentId. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PolicyExemption + :rtype: + ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_for_resource.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\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PolicyExemptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions'} + + def list_for_management_group( + self, management_group_id, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieves all policy exemptions that apply to a management group. + + This operation retrieves the list of all policy exemptions applicable + to the management group that match the given $filter. Valid values for + $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or + 'policyAssignmentId eq '{value}''. If $filter=atScope() is provided, + the returned list includes all policy exemptions that are assigned to + the management group or the management group's ancestors. + + :param management_group_id: The ID of the management group. + :type management_group_id: str + :param filter: The filter to apply on the operation. Valid values for + $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or + 'policyAssignmentId eq '{value}''. If $filter is not provided, no + filtering is performed. If $filter is not provided, the unfiltered + list includes all policy exemptions associated with the scope, + including those that apply directly or apply from containing scopes. + If $filter=atScope() is provided, the returned list only includes all + policy exemptions that apply to the scope, which is everything in the + unfiltered list except those applied to sub scopes contained within + the given scope. If $filter=atExactScope() is provided, the returned + list only includes all policy exemptions that at the given scope. If + $filter=excludeExpired() is provided, the returned list only includes + all policy exemptions that either haven't expired or didn't set + expiration date. If $filter=policyAssignmentId eq '{value}' is + provided. the returned list only includes all policy exemptions that + are associated with the give policyAssignmentId. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PolicyExemption + :rtype: + ~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemptionPaged[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyExemption] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_for_management_group.metadata['url'] + path_format_arguments = { + 'managementGroupId': self._serialize.url("management_group_id", management_group_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True) + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PolicyExemptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_for_management_group.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py index c9369972a2e7..2ec0f20590a3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_resource_groups_operations.py @@ -168,7 +168,7 @@ def create_or_update( def _delete_initial( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, force_deletion_resource_types=None, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -179,6 +179,8 @@ def _delete_initial( # Construct parameters query_parameters = {} + if force_deletion_resource_types is not None: + query_parameters['forceDeletionResourceTypes'] = self._serialize.query("force_deletion_resource_types", force_deletion_resource_types, 'str') query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers @@ -204,7 +206,7 @@ def _delete_initial( return client_raw_response def delete( - self, resource_group_name, custom_headers=None, raw=False, polling=True, **operation_config): + self, resource_group_name, force_deletion_resource_types=None, custom_headers=None, raw=False, polling=True, **operation_config): """Deletes a resource group. When you delete a resource group, all of its resources are also @@ -214,6 +216,10 @@ def delete( :param resource_group_name: The name of the resource group to delete. The name is case insensitive. :type resource_group_name: str + :param force_deletion_resource_types: The resource types you want to + force delete. Currently, only the following is supported: + forceDeletionResourceTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets + :type force_deletion_resource_types: 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 @@ -227,6 +233,7 @@ def delete( """ raw_result = self._delete_initial( resource_group_name=resource_group_name, + force_deletion_resource_types=force_deletion_resource_types, custom_headers=custom_headers, raw=True, **operation_config diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py index fd8c99b03716..3e91b98637f8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py @@ -156,8 +156,7 @@ class SystemData(Model): 'ManagedIdentity', 'Key' :type last_modified_by_type: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the - resource. + :param last_modified_at: The timestamp of resource last modification (UTC) :type last_modified_at: datetime """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py index d3521b64d6cc..0485cd926d65 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py @@ -156,8 +156,7 @@ class SystemData(Model): 'ManagedIdentity', 'Key' :type last_modified_by_type: str or ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the - resource. + :param last_modified_at: The timestamp of resource last modification (UTC) :type last_modified_at: datetime """