diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index 71405f83a7e4..5473db10a812 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -1,12 +1,12 @@ { - "commit": "0ebd4949e8e1cd9537ca5a07384c7661162cc7a6", + "commit": "40d2a23557a5a1cf82851a197a417af9b5735831", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ "@autorest/python@6.7.1", "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/compute/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/compute/resource-manager/readme.md", "package-2023-03-01-only": "2023-04-17 22:42:05 -0400 b06a6f45e472dd07c2e0dab06b1e52dfe2684c88 Microsoft.Compute/ComputeRP/stable/2023-03-01/virtualMachineScaleSet.json", "package-2023-01-02-only": "2023-06-28 00:48:15 -0400 b1d41f8dc643415d4dc6ee82bdb2fef04ef45bc9 Microsoft.Compute/DiskRP/stable/2023-01-02/snapshot.json", @@ -47,6 +47,6 @@ "package-compute-2016-04-preview": "2022-07-31 21:47:43 -0400 2dcad6d6e9a96882eb6d317e7500a94be007a9c6 Microsoft.Compute/DiskRP/preview/2016-04-30-preview/disk.json", "package-compute-2016-03": "2022-07-31 21:47:43 -0400 2dcad6d6e9a96882eb6d317e7500a94be007a9c6 Microsoft.Compute/ComputeRP/stable/2016-03-30/compute.json", "package-compute-2015-06": "2022-07-31 21:47:43 -0400 2dcad6d6e9a96882eb6d317e7500a94be007a9c6 Microsoft.Compute/ComputeRP/stable/2015-06-15/compute.json", - "package-2023-07-01-only": "2023-08-10 16:21:40 -0400 1a925d1afe288a5f20d078bbc89214a36a0e4287 Microsoft.Compute/ComputeRP/stable/2023-07-01/virtualMachineScaleSet.json", + "package-2023-07-01-only": "2023-11-01 08:25:03 -0700 7189ecf96b23dad6c80c1195d2862ea70ef93380 Microsoft.Compute/ComputeRP/stable/2023-07-01/virtualMachineScaleSet.json", "package-2023-04-02-only": "2023-08-07 20:58:57 -0400 b9403296f0b0e112b0d8222ad05fd1d79ee10e03 Microsoft.Compute/DiskRP/stable/2023-04-02/snapshot.json" } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py index 8ba757ca7ebb..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "30.3.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/__init__.py index 15e443e4ca26..e3d1472180b2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/__init__.py @@ -108,6 +108,9 @@ from ._models_py3 import PurchasePlan from ._models_py3 import RecoveryWalkResponse from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import ResiliencyPolicy +from ._models_py3 import ResilientVMCreationPolicy +from ._models_py3 import ResilientVMDeletionPolicy from ._models_py3 import Resource from ._models_py3 import ResourceWithOptionalLocation from ._models_py3 import RestorePoint @@ -454,6 +457,9 @@ "PurchasePlan", "RecoveryWalkResponse", "RequestRateByIntervalInput", + "ResiliencyPolicy", + "ResilientVMCreationPolicy", + "ResilientVMDeletionPolicy", "Resource", "ResourceWithOptionalLocation", "RestorePoint", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/_models_py3.py index 94dd2d3ea2e9..bfdc5c132294 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/_models_py3.py @@ -5697,6 +5697,90 @@ def __init__( self.interval_length = interval_length +class ResiliencyPolicy(_serialization.Model): + """Describes an resiliency policy - resilientVMCreationPolicy and/or resilientVMDeletionPolicy. + + :ivar resilient_vm_creation_policy: The configuration parameters used while performing + resilient VM creation. + :vartype resilient_vm_creation_policy: + ~azure.mgmt.compute.v2023_07_01.models.ResilientVMCreationPolicy + :ivar resilient_vm_deletion_policy: The configuration parameters used while performing + resilient VM deletion. + :vartype resilient_vm_deletion_policy: + ~azure.mgmt.compute.v2023_07_01.models.ResilientVMDeletionPolicy + """ + + _attribute_map = { + "resilient_vm_creation_policy": {"key": "resilientVMCreationPolicy", "type": "ResilientVMCreationPolicy"}, + "resilient_vm_deletion_policy": {"key": "resilientVMDeletionPolicy", "type": "ResilientVMDeletionPolicy"}, + } + + def __init__( + self, + *, + resilient_vm_creation_policy: Optional["_models.ResilientVMCreationPolicy"] = None, + resilient_vm_deletion_policy: Optional["_models.ResilientVMDeletionPolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword resilient_vm_creation_policy: The configuration parameters used while performing + resilient VM creation. + :paramtype resilient_vm_creation_policy: + ~azure.mgmt.compute.v2023_07_01.models.ResilientVMCreationPolicy + :keyword resilient_vm_deletion_policy: The configuration parameters used while performing + resilient VM deletion. + :paramtype resilient_vm_deletion_policy: + ~azure.mgmt.compute.v2023_07_01.models.ResilientVMDeletionPolicy + """ + super().__init__(**kwargs) + self.resilient_vm_creation_policy = resilient_vm_creation_policy + self.resilient_vm_deletion_policy = resilient_vm_deletion_policy + + +class ResilientVMCreationPolicy(_serialization.Model): + """The configuration parameters used while performing resilient VM creation. + + :ivar enabled: Specifies whether resilient VM creation should be enabled on the virtual machine + scale set. The default value is false. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Specifies whether resilient VM creation should be enabled on the virtual + machine scale set. The default value is false. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ResilientVMDeletionPolicy(_serialization.Model): + """The configuration parameters used while performing resilient VM deletion. + + :ivar enabled: Specifies whether resilient VM deletion should be enabled on the virtual machine + scale set. The default value is false. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Specifies whether resilient VM deletion should be enabled on the virtual + machine scale set. The default value is false. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + class ResourceWithOptionalLocation(_serialization.Model): """The Resource model definition with location property as optional. @@ -11088,6 +11172,8 @@ class VirtualMachineScaleSet(Resource): # pylint: disable=too-many-instance-att :ivar automatic_repairs_policy: Policy for automatic repairs. :vartype automatic_repairs_policy: ~azure.mgmt.compute.v2023_07_01.models.AutomaticRepairsPolicy + :ivar resiliency_policy: Policy for Resiliency. + :vartype resiliency_policy: ~azure.mgmt.compute.v2023_07_01.models.ResiliencyPolicy :ivar virtual_machine_profile: The virtual machine profile. :vartype virtual_machine_profile: ~azure.mgmt.compute.v2023_07_01.models.VirtualMachineScaleSetVMProfile @@ -11166,6 +11252,7 @@ class VirtualMachineScaleSet(Resource): # pylint: disable=too-many-instance-att "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "upgrade_policy": {"key": "properties.upgradePolicy", "type": "UpgradePolicy"}, "automatic_repairs_policy": {"key": "properties.automaticRepairsPolicy", "type": "AutomaticRepairsPolicy"}, + "resiliency_policy": {"key": "properties.resiliencyPolicy", "type": "ResiliencyPolicy"}, "virtual_machine_profile": { "key": "properties.virtualMachineProfile", "type": "VirtualMachineScaleSetVMProfile", @@ -11203,6 +11290,7 @@ def __init__( # pylint: disable=too-many-locals extended_location: Optional["_models.ExtendedLocation"] = None, upgrade_policy: Optional["_models.UpgradePolicy"] = None, automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = None, + resiliency_policy: Optional["_models.ResiliencyPolicy"] = None, virtual_machine_profile: Optional["_models.VirtualMachineScaleSetVMProfile"] = None, overprovision: Optional[bool] = None, do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = None, @@ -11244,6 +11332,8 @@ def __init__( # pylint: disable=too-many-locals :keyword automatic_repairs_policy: Policy for automatic repairs. :paramtype automatic_repairs_policy: ~azure.mgmt.compute.v2023_07_01.models.AutomaticRepairsPolicy + :keyword resiliency_policy: Policy for Resiliency. + :paramtype resiliency_policy: ~azure.mgmt.compute.v2023_07_01.models.ResiliencyPolicy :keyword virtual_machine_profile: The virtual machine profile. :paramtype virtual_machine_profile: ~azure.mgmt.compute.v2023_07_01.models.VirtualMachineScaleSetVMProfile @@ -11301,6 +11391,7 @@ def __init__( # pylint: disable=too-many-locals self.extended_location = extended_location self.upgrade_policy = upgrade_policy self.automatic_repairs_policy = automatic_repairs_policy + self.resiliency_policy = resiliency_policy self.virtual_machine_profile = virtual_machine_profile self.provisioning_state = None self.overprovision = overprovision @@ -13218,6 +13309,8 @@ class VirtualMachineScaleSetUpdate(UpdateResource): # pylint: disable=too-many- :ivar automatic_repairs_policy: Policy for automatic repairs. :vartype automatic_repairs_policy: ~azure.mgmt.compute.v2023_07_01.models.AutomaticRepairsPolicy + :ivar resiliency_policy: Policy for Resiliency. + :vartype resiliency_policy: ~azure.mgmt.compute.v2023_07_01.models.ResiliencyPolicy :ivar virtual_machine_profile: The virtual machine profile. :vartype virtual_machine_profile: ~azure.mgmt.compute.v2023_07_01.models.VirtualMachineScaleSetUpdateVMProfile @@ -13258,6 +13351,7 @@ class VirtualMachineScaleSetUpdate(UpdateResource): # pylint: disable=too-many- "identity": {"key": "identity", "type": "VirtualMachineScaleSetIdentity"}, "upgrade_policy": {"key": "properties.upgradePolicy", "type": "UpgradePolicy"}, "automatic_repairs_policy": {"key": "properties.automaticRepairsPolicy", "type": "AutomaticRepairsPolicy"}, + "resiliency_policy": {"key": "properties.resiliencyPolicy", "type": "ResiliencyPolicy"}, "virtual_machine_profile": { "key": "properties.virtualMachineProfile", "type": "VirtualMachineScaleSetUpdateVMProfile", @@ -13284,6 +13378,7 @@ def __init__( identity: Optional["_models.VirtualMachineScaleSetIdentity"] = None, upgrade_policy: Optional["_models.UpgradePolicy"] = None, automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = None, + resiliency_policy: Optional["_models.ResiliencyPolicy"] = None, virtual_machine_profile: Optional["_models.VirtualMachineScaleSetUpdateVMProfile"] = None, overprovision: Optional[bool] = None, do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = None, @@ -13310,6 +13405,8 @@ def __init__( :keyword automatic_repairs_policy: Policy for automatic repairs. :paramtype automatic_repairs_policy: ~azure.mgmt.compute.v2023_07_01.models.AutomaticRepairsPolicy + :keyword resiliency_policy: Policy for Resiliency. + :paramtype resiliency_policy: ~azure.mgmt.compute.v2023_07_01.models.ResiliencyPolicy :keyword virtual_machine_profile: The virtual machine profile. :paramtype virtual_machine_profile: ~azure.mgmt.compute.v2023_07_01.models.VirtualMachineScaleSetUpdateVMProfile @@ -13350,6 +13447,7 @@ def __init__( self.identity = identity self.upgrade_policy = upgrade_policy self.automatic_repairs_policy = automatic_repairs_policy + self.resiliency_policy = resiliency_policy self.virtual_machine_profile = virtual_machine_profile self.overprovision = overprovision self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py new file mode 100644 index 000000000000..40848d63bc75 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": False, + "resiliencyPolicy": {"resilientVMCreationPolicy": {"enabled": True}}, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py new file mode 100644 index 000000000000..eab41b2bc740 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/generated_samples/virtual_machine_scale_set_examples/virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": False, + "resiliencyPolicy": {"resilientVMDeletionPolicy": {"enabled": True}}, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.json +if __name__ == "__main__": + main()