Skip to content

Commit 6147171

Browse files
committed
Final GA changes for MCC CLI extension
1 parent e354ae6 commit 6147171

5 files changed

Lines changed: 363 additions & 7 deletions

File tree

src/mcc/azext_mcc/aaz/latest/mcc/ent/node/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from .__cmd_group import *
1212
from ._create import *
1313
from ._delete import *
14+
from ._get_deployment_details import *
1415
from ._get_provisioning_details import *
1516
from ._list import *
1617
from ._show import *
Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
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+
"mcc ent node get-deployment-details",
16+
)
17+
class GetDeploymentDetails(AAZCommand):
18+
"""Retrieves Microsoft Connected Cache for Enterprise cache node details and keys needed to deploy cache node.
19+
"""
20+
21+
_aaz_info = {
22+
"version": "2024-11-30-preview",
23+
"resources": [
24+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.connectedcache/enterprisemcccustomers/{}/enterprisemcccachenodes/{}/getcachenodeinstalldetails", "2024-11-30-preview"],
25+
]
26+
}
27+
28+
def _handler(self, command_args):
29+
super()._handler(command_args)
30+
self._execute_operations()
31+
return self._output()
32+
33+
_args_schema = None
34+
35+
@classmethod
36+
def _build_arguments_schema(cls, *args, **kwargs):
37+
if cls._args_schema is not None:
38+
return cls._args_schema
39+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
40+
41+
# define Arg Group ""
42+
43+
_args_schema = cls._args_schema
44+
_args_schema.cache_node_name = AAZStrArg(
45+
options=["--cache-node-name"],
46+
help="Name of Microsoft Connected Cache for Enterprise cache node.",
47+
required=True,
48+
id_part="child_name_1",
49+
fmt=AAZStrArgFormat(
50+
pattern="^[a-zA-Z0-9\\_\\-]*",
51+
max_length=90,
52+
min_length=1,
53+
),
54+
)
55+
_args_schema.mcc_resource_name = AAZStrArg(
56+
options=["--mcc-resource-name"],
57+
help="Name of Microsoft Connected Cache for Enterprise resource.",
58+
required=True,
59+
id_part="name",
60+
fmt=AAZStrArgFormat(
61+
pattern="^[a-zA-Z0-9\\_\\-]*",
62+
max_length=90,
63+
min_length=1,
64+
),
65+
)
66+
_args_schema.resource_group = AAZResourceGroupNameArg(
67+
required=True,
68+
)
69+
return cls._args_schema
70+
71+
def _execute_operations(self):
72+
self.pre_operations()
73+
self.EnterpriseMccCacheNodesOperationsGetCacheNodeInstallDetails(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 EnterpriseMccCacheNodesOperationsGetCacheNodeInstallDetails(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.ConnectedCache/enterpriseMccCustomers/{customerResourceName}/enterpriseMccCacheNodes/{cacheNodeResourceName}/getCacheNodeInstallDetails",
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 "MgmtErrorFormat"
113+
114+
@property
115+
def url_parameters(self):
116+
parameters = {
117+
**self.serialize_url_param(
118+
"cacheNodeResourceName", self.ctx.args.cache_node_name,
119+
required=True,
120+
),
121+
**self.serialize_url_param(
122+
"customerResourceName", self.ctx.args.mcc_resource_name,
123+
required=True,
124+
),
125+
**self.serialize_url_param(
126+
"resourceGroupName", self.ctx.args.resource_group,
127+
required=True,
128+
),
129+
**self.serialize_url_param(
130+
"subscriptionId", self.ctx.subscription_id,
131+
required=True,
132+
),
133+
}
134+
return parameters
135+
136+
@property
137+
def query_parameters(self):
138+
parameters = {
139+
**self.serialize_query_param(
140+
"api-version", "2024-11-30-preview",
141+
required=True,
142+
),
143+
}
144+
return parameters
145+
146+
@property
147+
def header_parameters(self):
148+
parameters = {
149+
**self.serialize_header_param(
150+
"Accept", "application/json",
151+
),
152+
}
153+
return parameters
154+
155+
def on_200(self, session):
156+
data = self.deserialize_http_content(session)
157+
self.ctx.set_var(
158+
"instance",
159+
data,
160+
schema_builder=self._build_schema_on_200
161+
)
162+
163+
_schema_on_200 = None
164+
165+
@classmethod
166+
def _build_schema_on_200(cls):
167+
if cls._schema_on_200 is not None:
168+
return cls._schema_on_200
169+
170+
cls._schema_on_200 = AAZObjectType()
171+
172+
_schema_on_200 = cls._schema_on_200
173+
_schema_on_200.id = AAZStrType(
174+
flags={"read_only": True},
175+
)
176+
_schema_on_200.location = AAZStrType(
177+
flags={"required": True},
178+
)
179+
_schema_on_200.name = AAZStrType(
180+
flags={"read_only": True},
181+
)
182+
_schema_on_200.properties = AAZObjectType()
183+
_schema_on_200.system_data = AAZObjectType(
184+
serialized_name="systemData",
185+
flags={"read_only": True},
186+
)
187+
_schema_on_200.tags = AAZDictType()
188+
_schema_on_200.type = AAZStrType(
189+
flags={"read_only": True},
190+
)
191+
192+
properties = cls._schema_on_200.properties
193+
properties.cache_node_id = AAZStrType(
194+
serialized_name="cacheNodeId",
195+
)
196+
properties.customer_id = AAZStrType(
197+
serialized_name="customerId",
198+
)
199+
properties.drive_configuration = AAZListType(
200+
serialized_name="driveConfiguration",
201+
)
202+
properties.primary_account_key = AAZStrType(
203+
serialized_name="primaryAccountKey",
204+
flags={"secret": True, "read_only": True},
205+
)
206+
properties.proxy_url_configuration = AAZObjectType(
207+
serialized_name="proxyUrlConfiguration",
208+
)
209+
properties.registration_key = AAZStrType(
210+
serialized_name="registrationKey",
211+
flags={"secret": True, "read_only": True},
212+
)
213+
properties.secondary_account_key = AAZStrType(
214+
serialized_name="secondaryAccountKey",
215+
flags={"secret": True, "read_only": True},
216+
)
217+
properties.tls_certificate_provisioning_key = AAZStrType(
218+
serialized_name="tlsCertificateProvisioningKey",
219+
flags={"secret": True, "read_only": True},
220+
)
221+
222+
drive_configuration = cls._schema_on_200.properties.drive_configuration
223+
drive_configuration.Element = AAZObjectType()
224+
225+
_element = cls._schema_on_200.properties.drive_configuration.Element
226+
_element.cache_number = AAZIntType(
227+
serialized_name="cacheNumber",
228+
)
229+
_element.nginx_mapping = AAZStrType(
230+
serialized_name="nginxMapping",
231+
)
232+
_element.physical_path = AAZStrType(
233+
serialized_name="physicalPath",
234+
)
235+
_element.size_in_gb = AAZIntType(
236+
serialized_name="sizeInGb",
237+
)
238+
239+
proxy_url_configuration = cls._schema_on_200.properties.proxy_url_configuration
240+
proxy_url_configuration.proxy_url = AAZStrType(
241+
serialized_name="proxyUrl",
242+
)
243+
244+
system_data = cls._schema_on_200.system_data
245+
system_data.created_at = AAZStrType(
246+
serialized_name="createdAt",
247+
)
248+
system_data.created_by = AAZStrType(
249+
serialized_name="createdBy",
250+
)
251+
system_data.created_by_type = AAZStrType(
252+
serialized_name="createdByType",
253+
)
254+
system_data.last_modified_at = AAZStrType(
255+
serialized_name="lastModifiedAt",
256+
)
257+
system_data.last_modified_by = AAZStrType(
258+
serialized_name="lastModifiedBy",
259+
)
260+
system_data.last_modified_by_type = AAZStrType(
261+
serialized_name="lastModifiedByType",
262+
)
263+
264+
tags = cls._schema_on_200.tags
265+
tags.Element = AAZStrType()
266+
267+
return cls._schema_on_200
268+
269+
270+
class _GetDeploymentDetailsHelper:
271+
"""Helper class for GetDeploymentDetails"""
272+
273+
274+
__all__ = ["GetDeploymentDetails"]

src/mcc/azext_mcc/aaz/latest/mcc/ent/node/_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
276276
_args_schema.auto_update_week = AAZIntArg(
277277
options=["--auto-update-week"],
278278
arg_group="Configuration",
279-
help="Week of month (1-4) that cache node will automatically install software update",
279+
help="Week of month that cache node will automatically install software update. Allowed Values: 2-3",
280280
nullable=True,
281281
fmt=AAZIntArgFormat(
282282
maximum=5,

src/mcc/azext_mcc/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ def load_command_table(self, _):
2121
self.command_table['mcc ent resource list'] = MccEntResourceList(loader=self)
2222

2323
with self.command_group('mcc ent node'):
24-
from .custom import MccEntNodeCreate, MccEntNodeUpdate, MccEntNodeDelete, MccEntNodeList, MccEntNodeShow, MccEntNodeGetProvisioningDetails
24+
from .custom import MccEntNodeCreate, MccEntNodeUpdate, MccEntNodeDelete, MccEntNodeList, MccEntNodeShow, MccEntNodeGetDeploymentDetails
2525
self.command_table['mcc ent node create'] = MccEntNodeCreate(loader=self)
2626
self.command_table['mcc ent node update'] = MccEntNodeUpdate(loader=self)
2727
self.command_table['mcc ent node delete'] = MccEntNodeDelete(loader=self)
2828
self.command_table['mcc ent node list'] = MccEntNodeList(loader=self)
2929
self.command_table['mcc ent node show'] = MccEntNodeShow(loader=self)
30-
self.command_table['mcc ent node get-provisioning-details'] = MccEntNodeGetProvisioningDetails(loader=self)
30+
self.command_table['mcc ent node get-deployment-details'] = MccEntNodeGetDeploymentDetails(loader=self)

0 commit comments

Comments
 (0)