Skip to content

Commit d6afd07

Browse files
author
SDKAuto
committed
CodeGen from PR 26497 in Azure/azure-rest-api-specs
Merge 7189ecf96b23dad6c80c1195d2862ea70ef93380 into b7a863f0edae81b8261b7029caf833f2bee2ec99
1 parent 877bcfc commit d6afd07

File tree

6 files changed

+290
-4
lines changed

6 files changed

+290
-4
lines changed

sdk/compute/azure-mgmt-compute/_meta.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"commit": "0ebd4949e8e1cd9537ca5a07384c7661162cc7a6",
2+
"commit": "40d2a23557a5a1cf82851a197a417af9b5735831",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.9.7",
55
"use": [
66
"@autorest/[email protected]",
77
"@autorest/[email protected]"
88
],
9-
"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/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
9+
"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/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
1010
"readme": "specification/compute/resource-manager/readme.md",
1111
"package-2023-03-01-only": "2023-04-17 22:42:05 -0400 b06a6f45e472dd07c2e0dab06b1e52dfe2684c88 Microsoft.Compute/ComputeRP/stable/2023-03-01/virtualMachineScaleSet.json",
1212
"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 @@
4747
"package-compute-2016-04-preview": "2022-07-31 21:47:43 -0400 2dcad6d6e9a96882eb6d317e7500a94be007a9c6 Microsoft.Compute/DiskRP/preview/2016-04-30-preview/disk.json",
4848
"package-compute-2016-03": "2022-07-31 21:47:43 -0400 2dcad6d6e9a96882eb6d317e7500a94be007a9c6 Microsoft.Compute/ComputeRP/stable/2016-03-30/compute.json",
4949
"package-compute-2015-06": "2022-07-31 21:47:43 -0400 2dcad6d6e9a96882eb6d317e7500a94be007a9c6 Microsoft.Compute/ComputeRP/stable/2015-06-15/compute.json",
50-
"package-2023-07-01-only": "2023-08-10 16:21:40 -0400 1a925d1afe288a5f20d078bbc89214a36a0e4287 Microsoft.Compute/ComputeRP/stable/2023-07-01/virtualMachineScaleSet.json",
50+
"package-2023-07-01-only": "2023-11-01 08:25:03 -0700 7189ecf96b23dad6c80c1195d2862ea70ef93380 Microsoft.Compute/ComputeRP/stable/2023-07-01/virtualMachineScaleSet.json",
5151
"package-2023-04-02-only": "2023-08-07 20:58:57 -0400 b9403296f0b0e112b0d8222ad05fd1d79ee10e03 Microsoft.Compute/DiskRP/stable/2023-04-02/snapshot.json"
5252
}

sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "30.3.0"
9+
VERSION = "1.0.0b1"

sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
from ._models_py3 import PurchasePlan
109109
from ._models_py3 import RecoveryWalkResponse
110110
from ._models_py3 import RequestRateByIntervalInput
111+
from ._models_py3 import ResiliencyPolicy
112+
from ._models_py3 import ResilientVMCreationPolicy
113+
from ._models_py3 import ResilientVMDeletionPolicy
111114
from ._models_py3 import Resource
112115
from ._models_py3 import ResourceWithOptionalLocation
113116
from ._models_py3 import RestorePoint
@@ -454,6 +457,9 @@
454457
"PurchasePlan",
455458
"RecoveryWalkResponse",
456459
"RequestRateByIntervalInput",
460+
"ResiliencyPolicy",
461+
"ResilientVMCreationPolicy",
462+
"ResilientVMDeletionPolicy",
457463
"Resource",
458464
"ResourceWithOptionalLocation",
459465
"RestorePoint",

sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2023_07_01/models/_models_py3.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5697,6 +5697,90 @@ def __init__(
56975697
self.interval_length = interval_length
56985698

56995699

5700+
class ResiliencyPolicy(_serialization.Model):
5701+
"""Describes an resiliency policy - resilientVMCreationPolicy and/or resilientVMDeletionPolicy.
5702+
5703+
:ivar resilient_vm_creation_policy: The configuration parameters used while performing
5704+
resilient VM creation.
5705+
:vartype resilient_vm_creation_policy:
5706+
~azure.mgmt.compute.v2023_07_01.models.ResilientVMCreationPolicy
5707+
:ivar resilient_vm_deletion_policy: The configuration parameters used while performing
5708+
resilient VM deletion.
5709+
:vartype resilient_vm_deletion_policy:
5710+
~azure.mgmt.compute.v2023_07_01.models.ResilientVMDeletionPolicy
5711+
"""
5712+
5713+
_attribute_map = {
5714+
"resilient_vm_creation_policy": {"key": "resilientVMCreationPolicy", "type": "ResilientVMCreationPolicy"},
5715+
"resilient_vm_deletion_policy": {"key": "resilientVMDeletionPolicy", "type": "ResilientVMDeletionPolicy"},
5716+
}
5717+
5718+
def __init__(
5719+
self,
5720+
*,
5721+
resilient_vm_creation_policy: Optional["_models.ResilientVMCreationPolicy"] = None,
5722+
resilient_vm_deletion_policy: Optional["_models.ResilientVMDeletionPolicy"] = None,
5723+
**kwargs: Any
5724+
) -> None:
5725+
"""
5726+
:keyword resilient_vm_creation_policy: The configuration parameters used while performing
5727+
resilient VM creation.
5728+
:paramtype resilient_vm_creation_policy:
5729+
~azure.mgmt.compute.v2023_07_01.models.ResilientVMCreationPolicy
5730+
:keyword resilient_vm_deletion_policy: The configuration parameters used while performing
5731+
resilient VM deletion.
5732+
:paramtype resilient_vm_deletion_policy:
5733+
~azure.mgmt.compute.v2023_07_01.models.ResilientVMDeletionPolicy
5734+
"""
5735+
super().__init__(**kwargs)
5736+
self.resilient_vm_creation_policy = resilient_vm_creation_policy
5737+
self.resilient_vm_deletion_policy = resilient_vm_deletion_policy
5738+
5739+
5740+
class ResilientVMCreationPolicy(_serialization.Model):
5741+
"""The configuration parameters used while performing resilient VM creation.
5742+
5743+
:ivar enabled: Specifies whether resilient VM creation should be enabled on the virtual machine
5744+
scale set. The default value is false.
5745+
:vartype enabled: bool
5746+
"""
5747+
5748+
_attribute_map = {
5749+
"enabled": {"key": "enabled", "type": "bool"},
5750+
}
5751+
5752+
def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None:
5753+
"""
5754+
:keyword enabled: Specifies whether resilient VM creation should be enabled on the virtual
5755+
machine scale set. The default value is false.
5756+
:paramtype enabled: bool
5757+
"""
5758+
super().__init__(**kwargs)
5759+
self.enabled = enabled
5760+
5761+
5762+
class ResilientVMDeletionPolicy(_serialization.Model):
5763+
"""The configuration parameters used while performing resilient VM deletion.
5764+
5765+
:ivar enabled: Specifies whether resilient VM deletion should be enabled on the virtual machine
5766+
scale set. The default value is false.
5767+
:vartype enabled: bool
5768+
"""
5769+
5770+
_attribute_map = {
5771+
"enabled": {"key": "enabled", "type": "bool"},
5772+
}
5773+
5774+
def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None:
5775+
"""
5776+
:keyword enabled: Specifies whether resilient VM deletion should be enabled on the virtual
5777+
machine scale set. The default value is false.
5778+
:paramtype enabled: bool
5779+
"""
5780+
super().__init__(**kwargs)
5781+
self.enabled = enabled
5782+
5783+
57005784
class ResourceWithOptionalLocation(_serialization.Model):
57015785
"""The Resource model definition with location property as optional.
57025786

@@ -11088,6 +11172,8 @@ class VirtualMachineScaleSet(Resource): # pylint: disable=too-many-instance-att
1108811172
:ivar automatic_repairs_policy: Policy for automatic repairs.
1108911173
:vartype automatic_repairs_policy:
1109011174
~azure.mgmt.compute.v2023_07_01.models.AutomaticRepairsPolicy
11175+
:ivar resiliency_policy: Policy for Resiliency.
11176+
:vartype resiliency_policy: ~azure.mgmt.compute.v2023_07_01.models.ResiliencyPolicy
1109111177
:ivar virtual_machine_profile: The virtual machine profile.
1109211178
:vartype virtual_machine_profile:
1109311179
~azure.mgmt.compute.v2023_07_01.models.VirtualMachineScaleSetVMProfile
@@ -11166,6 +11252,7 @@ class VirtualMachineScaleSet(Resource): # pylint: disable=too-many-instance-att
1116611252
"extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"},
1116711253
"upgrade_policy": {"key": "properties.upgradePolicy", "type": "UpgradePolicy"},
1116811254
"automatic_repairs_policy": {"key": "properties.automaticRepairsPolicy", "type": "AutomaticRepairsPolicy"},
11255+
"resiliency_policy": {"key": "properties.resiliencyPolicy", "type": "ResiliencyPolicy"},
1116911256
"virtual_machine_profile": {
1117011257
"key": "properties.virtualMachineProfile",
1117111258
"type": "VirtualMachineScaleSetVMProfile",
@@ -11203,6 +11290,7 @@ def __init__( # pylint: disable=too-many-locals
1120311290
extended_location: Optional["_models.ExtendedLocation"] = None,
1120411291
upgrade_policy: Optional["_models.UpgradePolicy"] = None,
1120511292
automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = None,
11293+
resiliency_policy: Optional["_models.ResiliencyPolicy"] = None,
1120611294
virtual_machine_profile: Optional["_models.VirtualMachineScaleSetVMProfile"] = None,
1120711295
overprovision: Optional[bool] = None,
1120811296
do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = None,
@@ -11244,6 +11332,8 @@ def __init__( # pylint: disable=too-many-locals
1124411332
:keyword automatic_repairs_policy: Policy for automatic repairs.
1124511333
:paramtype automatic_repairs_policy:
1124611334
~azure.mgmt.compute.v2023_07_01.models.AutomaticRepairsPolicy
11335+
:keyword resiliency_policy: Policy for Resiliency.
11336+
:paramtype resiliency_policy: ~azure.mgmt.compute.v2023_07_01.models.ResiliencyPolicy
1124711337
:keyword virtual_machine_profile: The virtual machine profile.
1124811338
:paramtype virtual_machine_profile:
1124911339
~azure.mgmt.compute.v2023_07_01.models.VirtualMachineScaleSetVMProfile
@@ -11301,6 +11391,7 @@ def __init__( # pylint: disable=too-many-locals
1130111391
self.extended_location = extended_location
1130211392
self.upgrade_policy = upgrade_policy
1130311393
self.automatic_repairs_policy = automatic_repairs_policy
11394+
self.resiliency_policy = resiliency_policy
1130411395
self.virtual_machine_profile = virtual_machine_profile
1130511396
self.provisioning_state = None
1130611397
self.overprovision = overprovision
@@ -13218,6 +13309,8 @@ class VirtualMachineScaleSetUpdate(UpdateResource): # pylint: disable=too-many-
1321813309
:ivar automatic_repairs_policy: Policy for automatic repairs.
1321913310
:vartype automatic_repairs_policy:
1322013311
~azure.mgmt.compute.v2023_07_01.models.AutomaticRepairsPolicy
13312+
:ivar resiliency_policy: Policy for Resiliency.
13313+
:vartype resiliency_policy: ~azure.mgmt.compute.v2023_07_01.models.ResiliencyPolicy
1322113314
:ivar virtual_machine_profile: The virtual machine profile.
1322213315
:vartype virtual_machine_profile:
1322313316
~azure.mgmt.compute.v2023_07_01.models.VirtualMachineScaleSetUpdateVMProfile
@@ -13258,6 +13351,7 @@ class VirtualMachineScaleSetUpdate(UpdateResource): # pylint: disable=too-many-
1325813351
"identity": {"key": "identity", "type": "VirtualMachineScaleSetIdentity"},
1325913352
"upgrade_policy": {"key": "properties.upgradePolicy", "type": "UpgradePolicy"},
1326013353
"automatic_repairs_policy": {"key": "properties.automaticRepairsPolicy", "type": "AutomaticRepairsPolicy"},
13354+
"resiliency_policy": {"key": "properties.resiliencyPolicy", "type": "ResiliencyPolicy"},
1326113355
"virtual_machine_profile": {
1326213356
"key": "properties.virtualMachineProfile",
1326313357
"type": "VirtualMachineScaleSetUpdateVMProfile",
@@ -13284,6 +13378,7 @@ def __init__(
1328413378
identity: Optional["_models.VirtualMachineScaleSetIdentity"] = None,
1328513379
upgrade_policy: Optional["_models.UpgradePolicy"] = None,
1328613380
automatic_repairs_policy: Optional["_models.AutomaticRepairsPolicy"] = None,
13381+
resiliency_policy: Optional["_models.ResiliencyPolicy"] = None,
1328713382
virtual_machine_profile: Optional["_models.VirtualMachineScaleSetUpdateVMProfile"] = None,
1328813383
overprovision: Optional[bool] = None,
1328913384
do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = None,
@@ -13310,6 +13405,8 @@ def __init__(
1331013405
:keyword automatic_repairs_policy: Policy for automatic repairs.
1331113406
:paramtype automatic_repairs_policy:
1331213407
~azure.mgmt.compute.v2023_07_01.models.AutomaticRepairsPolicy
13408+
:keyword resiliency_policy: Policy for Resiliency.
13409+
:paramtype resiliency_policy: ~azure.mgmt.compute.v2023_07_01.models.ResiliencyPolicy
1331313410
:keyword virtual_machine_profile: The virtual machine profile.
1331413411
:paramtype virtual_machine_profile:
1331513412
~azure.mgmt.compute.v2023_07_01.models.VirtualMachineScaleSetUpdateVMProfile
@@ -13350,6 +13447,7 @@ def __init__(
1335013447
self.identity = identity
1335113448
self.upgrade_policy = upgrade_policy
1335213449
self.automatic_repairs_policy = automatic_repairs_policy
13450+
self.resiliency_policy = resiliency_policy
1335313451
self.virtual_machine_profile = virtual_machine_profile
1335413452
self.overprovision = overprovision
1335513453
self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.compute import ComputeManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-compute
16+
# USAGE
17+
python virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = ComputeManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="{subscription-id}",
30+
)
31+
32+
response = client.virtual_machine_scale_sets.begin_create_or_update(
33+
resource_group_name="myResourceGroup",
34+
vm_scale_set_name="{vmss-name}",
35+
parameters={
36+
"location": "westus",
37+
"properties": {
38+
"overprovision": False,
39+
"resiliencyPolicy": {"resilientVMCreationPolicy": {"enabled": True}},
40+
"upgradePolicy": {"mode": "Manual"},
41+
"virtualMachineProfile": {
42+
"networkProfile": {
43+
"networkInterfaceConfigurations": [
44+
{
45+
"name": "{vmss-name}",
46+
"properties": {
47+
"enableIPForwarding": True,
48+
"ipConfigurations": [
49+
{
50+
"name": "{vmss-name}",
51+
"properties": {
52+
"subnet": {
53+
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}"
54+
}
55+
},
56+
}
57+
],
58+
"primary": True,
59+
},
60+
}
61+
]
62+
},
63+
"osProfile": {
64+
"adminPassword": "{your-password}",
65+
"adminUsername": "{your-username}",
66+
"computerNamePrefix": "{vmss-name}",
67+
},
68+
"storageProfile": {
69+
"imageReference": {
70+
"offer": "WindowsServer",
71+
"publisher": "MicrosoftWindowsServer",
72+
"sku": "2016-Datacenter",
73+
"version": "latest",
74+
},
75+
"osDisk": {
76+
"caching": "ReadWrite",
77+
"createOption": "FromImage",
78+
"managedDisk": {"storageAccountType": "Standard_LRS"},
79+
},
80+
},
81+
},
82+
},
83+
"sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"},
84+
},
85+
).result()
86+
print(response)
87+
88+
89+
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.json
90+
if __name__ == "__main__":
91+
main()

0 commit comments

Comments
 (0)