Skip to content

Commit 93f08a9

Browse files
committed
force recovery
1 parent 8816586 commit 93f08a9

File tree

2 files changed

+196
-0
lines changed

2 files changed

+196
-0
lines changed

src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from .__cmd_group import *
1212
from ._delete import *
13+
from ._force_recovery_service_fabric_platform_update_domain_walk import *
1314
from ._get_os_upgrade_history import *
1415
from ._list import *
1516
from ._list_instance_public_ips import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command(
15+
"vmss force-recovery-service-fabric-platform-update-domain-walk",
16+
)
17+
class ForceRecoveryServiceFabricPlatformUpdateDomainWalk(AAZCommand):
18+
"""Manual platform update domain walk to update virtual machines in a service fabric virtual machine scale set.
19+
20+
:example: Force recovery service fabric platform update domain walk
21+
az force-recovery-service-fabric-platform-update-domain-walk -g rg --vmss-name vmss --platform-update-domain
22+
"""
23+
24+
_aaz_info = {
25+
"version": "2023-07-01",
26+
"resources": [
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/forcerecoveryservicefabricplatformupdatedomainwalk", "2023-07-01"],
28+
]
29+
}
30+
31+
def _handler(self, command_args):
32+
super()._handler(command_args)
33+
self._execute_operations()
34+
return self._output()
35+
36+
_args_schema = None
37+
38+
@classmethod
39+
def _build_arguments_schema(cls, *args, **kwargs):
40+
if cls._args_schema is not None:
41+
return cls._args_schema
42+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
43+
44+
# define Arg Group ""
45+
46+
_args_schema = cls._args_schema
47+
_args_schema.resource_group = AAZResourceGroupNameArg(
48+
required=True,
49+
)
50+
_args_schema.vmss_name = AAZStrArg(
51+
options=["--vmss-name"],
52+
help="The name of the VM scale set.",
53+
required=True,
54+
id_part="name",
55+
)
56+
_args_schema.placement_group_id = AAZStrArg(
57+
options=["--placement-group-id"],
58+
help="The placement group id for which the manual recovery walk is requested.",
59+
)
60+
_args_schema.platform_update_domain = AAZIntArg(
61+
options=["--platform-update-domain"],
62+
help="The platform update domain for which a manual recovery walk is requested",
63+
required=True,
64+
)
65+
_args_schema.zone = AAZStrArg(
66+
options=["--zone"],
67+
help="The zone in which the manual recovery walk is requested for cross zone virtual machine scale set",
68+
)
69+
return cls._args_schema
70+
71+
def _execute_operations(self):
72+
self.pre_operations()
73+
self.VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx=self.ctx)()
74+
self.post_operations()
75+
76+
@register_callback
77+
def pre_operations(self):
78+
pass
79+
80+
@register_callback
81+
def post_operations(self):
82+
pass
83+
84+
def _output(self, *args, **kwargs):
85+
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
86+
return result
87+
88+
class VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalk(AAZHttpOperation):
89+
CLIENT_TYPE = "MgmtClient"
90+
91+
def __call__(self, *args, **kwargs):
92+
request = self.make_request()
93+
session = self.client.send_request(request=request, stream=False, **kwargs)
94+
if session.http_response.status_code in [200]:
95+
return self.on_200(session)
96+
97+
return self.on_error(session.http_response)
98+
99+
@property
100+
def url(self):
101+
return self.client.format_url(
102+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk",
103+
**self.url_parameters
104+
)
105+
106+
@property
107+
def method(self):
108+
return "POST"
109+
110+
@property
111+
def error_format(self):
112+
return "ODataV4Format"
113+
114+
@property
115+
def url_parameters(self):
116+
parameters = {
117+
**self.serialize_url_param(
118+
"resourceGroupName", self.ctx.args.resource_group,
119+
required=True,
120+
),
121+
**self.serialize_url_param(
122+
"subscriptionId", self.ctx.subscription_id,
123+
required=True,
124+
),
125+
**self.serialize_url_param(
126+
"vmScaleSetName", self.ctx.args.vmss_name,
127+
required=True,
128+
),
129+
}
130+
return parameters
131+
132+
@property
133+
def query_parameters(self):
134+
parameters = {
135+
**self.serialize_query_param(
136+
"placementGroupId", self.ctx.args.placement_group_id,
137+
),
138+
**self.serialize_query_param(
139+
"platformUpdateDomain", self.ctx.args.platform_update_domain,
140+
required=True,
141+
),
142+
**self.serialize_query_param(
143+
"zone", self.ctx.args.zone,
144+
),
145+
**self.serialize_query_param(
146+
"api-version", "2023-07-01",
147+
required=True,
148+
),
149+
}
150+
return parameters
151+
152+
@property
153+
def header_parameters(self):
154+
parameters = {
155+
**self.serialize_header_param(
156+
"Accept", "application/json",
157+
),
158+
}
159+
return parameters
160+
161+
def on_200(self, session):
162+
data = self.deserialize_http_content(session)
163+
self.ctx.set_var(
164+
"instance",
165+
data,
166+
schema_builder=self._build_schema_on_200
167+
)
168+
169+
_schema_on_200 = None
170+
171+
@classmethod
172+
def _build_schema_on_200(cls):
173+
if cls._schema_on_200 is not None:
174+
return cls._schema_on_200
175+
176+
cls._schema_on_200 = AAZObjectType()
177+
178+
_schema_on_200 = cls._schema_on_200
179+
_schema_on_200.next_platform_update_domain = AAZIntType(
180+
serialized_name="nextPlatformUpdateDomain",
181+
flags={"read_only": True},
182+
)
183+
_schema_on_200.walk_performed = AAZBoolType(
184+
serialized_name="walkPerformed",
185+
flags={"read_only": True},
186+
)
187+
188+
return cls._schema_on_200
189+
190+
191+
class _ForceRecoveryServiceFabricPlatformUpdateDomainWalkHelper:
192+
"""Helper class for ForceRecoveryServiceFabricPlatformUpdateDomainWalk"""
193+
194+
195+
__all__ = ["ForceRecoveryServiceFabricPlatformUpdateDomainWalk"]

0 commit comments

Comments
 (0)