Skip to content

Commit 23bbd3c

Browse files
committed
update commands
1 parent a04a893 commit 23bbd3c

File tree

3 files changed

+70
-35
lines changed

3 files changed

+70
-35
lines changed

src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_list.py

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,24 @@
1515
"connectedmachine extension image list",
1616
)
1717
class List(AAZCommand):
18-
"""List all Extension versions based on location, publisher, extensionType.
18+
"""List all Extension versions based on location, publisher, extensionType
1919
20-
:example: Sample command for extension image list
21-
az connectedmachine extension image list --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent --location eastus
20+
:example: GET a list of extension metadata
21+
az connectedmachine extension image list --location EastUS --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent
2222
"""
2323

2424
_aaz_info = {
2525
"version": "2024-11-10-preview",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions", "2024-11-10-preview"],
27+
["mgmt-plane", "/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions", "2024-11-10-preview"],
2828
]
2929
}
3030

31+
AZ_SUPPORT_PAGINATION = True
32+
3133
def _handler(self, command_args):
3234
super()._handler(command_args)
33-
self._execute_operations()
34-
return self._output()
35+
return self.build_paging(self._execute_operations, self._output)
3536

3637
_args_schema = None
3738

@@ -45,23 +46,23 @@ def _build_arguments_schema(cls, *args, **kwargs):
4546

4647
_args_schema = cls._args_schema
4748
_args_schema.extension_type = AAZStrArg(
48-
options=["--type", "--extension-type"],
49+
options=["--extension-type"],
4950
help="The extensionType of the Extension being received.",
5051
required=True,
5152
)
5253
_args_schema.location = AAZResourceLocationArg(
5354
required=True,
5455
)
5556
_args_schema.publisher = AAZStrArg(
56-
options=["-p", "--publisher"],
57+
options=["--publisher"],
5758
help="The publisher of the Extension being received.",
5859
required=True,
5960
)
6061
return cls._args_schema
6162

6263
def _execute_operations(self):
6364
self.pre_operations()
64-
self.ExtensionMetadataList(ctx=self.ctx)()
65+
self.ExtensionMetadataV2List(ctx=self.ctx)()
6566
self.post_operations()
6667

6768
@register_callback
@@ -74,9 +75,10 @@ def post_operations(self):
7475

7576
def _output(self, *args, **kwargs):
7677
result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True)
77-
return result
78+
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
79+
return result, next_link
7880

79-
class ExtensionMetadataList(AAZHttpOperation):
81+
class ExtensionMetadataV2List(AAZHttpOperation):
8082
CLIENT_TYPE = "MgmtClient"
8183

8284
def __call__(self, *args, **kwargs):
@@ -90,7 +92,7 @@ def __call__(self, *args, **kwargs):
9092
@property
9193
def url(self):
9294
return self.client.format_url(
93-
"/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions",
95+
"/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions",
9496
**self.url_parameters
9597
)
9698

@@ -117,10 +119,6 @@ def url_parameters(self):
117119
"publisher", self.ctx.args.publisher,
118120
required=True,
119121
),
120-
**self.serialize_url_param(
121-
"subscriptionId", self.ctx.subscription_id,
122-
required=True,
123-
),
124122
}
125123
return parameters
126124

@@ -161,6 +159,9 @@ def _build_schema_on_200(cls):
161159
cls._schema_on_200 = AAZObjectType()
162160

163161
_schema_on_200 = cls._schema_on_200
162+
_schema_on_200.next_link = AAZStrType(
163+
serialized_name="nextLink",
164+
)
164165
_schema_on_200.value = AAZListType(
165166
flags={"read_only": True},
166167
)
@@ -187,17 +188,38 @@ def _build_schema_on_200(cls):
187188
)
188189

189190
properties = cls._schema_on_200.value.Element.properties
191+
properties.architecture = AAZListType(
192+
flags={"read_only": True},
193+
)
194+
properties.extension_signature_uri = AAZStrType(
195+
serialized_name="extensionSignatureUri",
196+
flags={"read_only": True},
197+
)
190198
properties.extension_type = AAZStrType(
191199
serialized_name="extensionType",
192200
flags={"read_only": True},
193201
)
202+
properties.extension_uris = AAZListType(
203+
serialized_name="extensionUris",
204+
flags={"read_only": True},
205+
)
206+
properties.operating_system = AAZStrType(
207+
serialized_name="operatingSystem",
208+
flags={"read_only": True},
209+
)
194210
properties.publisher = AAZStrType(
195211
flags={"read_only": True},
196212
)
197213
properties.version = AAZStrType(
198214
flags={"read_only": True},
199215
)
200216

217+
architecture = cls._schema_on_200.value.Element.properties.architecture
218+
architecture.Element = AAZStrType()
219+
220+
extension_uris = cls._schema_on_200.value.Element.properties.extension_uris
221+
extension_uris.Element = AAZStrType()
222+
201223
system_data = cls._schema_on_200.value.Element.system_data
202224
system_data.created_at = AAZStrType(
203225
serialized_name="createdAt",

src/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/extension/image/_show.py

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
"connectedmachine extension image show",
1616
)
1717
class Show(AAZCommand):
18-
"""Get an Extension Metadata based on location, publisher, extensionType and version.
18+
"""Get an Extension Metadata based on location, publisher, extensionType and version
1919
20-
:example: Sample command for extension image show
21-
az connectedmachine extension image show --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent --location eastus --version 1.9.1
20+
:example: GET an extension metadata
21+
az connectedmachine extension image show --location EastUS --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent --version 1.33.0
2222
"""
2323

2424
_aaz_info = {
2525
"version": "2024-11-10-preview",
2626
"resources": [
27-
["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions/{}", "2024-11-10-preview"],
27+
["mgmt-plane", "/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions/{}", "2024-11-10-preview"],
2828
]
2929
}
3030

@@ -45,32 +45,28 @@ def _build_arguments_schema(cls, *args, **kwargs):
4545

4646
_args_schema = cls._args_schema
4747
_args_schema.extension_type = AAZStrArg(
48-
options=["--type", "--extension-type"],
48+
options=["--extension-type"],
4949
help="The extensionType of the Extension being received.",
5050
required=True,
51-
id_part="child_name_2",
5251
)
5352
_args_schema.location = AAZResourceLocationArg(
5453
required=True,
55-
id_part="name",
5654
)
5755
_args_schema.publisher = AAZStrArg(
58-
options=["-p", "--publisher"],
56+
options=["--publisher"],
5957
help="The publisher of the Extension being received.",
6058
required=True,
61-
id_part="child_name_1",
6259
)
6360
_args_schema.version = AAZStrArg(
64-
options=["-n", "--name", "--version"],
61+
options=["--version"],
6562
help="The version of the Extension being received.",
6663
required=True,
67-
id_part="child_name_3",
6864
)
6965
return cls._args_schema
7066

7167
def _execute_operations(self):
7268
self.pre_operations()
73-
self.ExtensionMetadataGet(ctx=self.ctx)()
69+
self.ExtensionMetadataV2Get(ctx=self.ctx)()
7470
self.post_operations()
7571

7672
@register_callback
@@ -85,7 +81,7 @@ def _output(self, *args, **kwargs):
8581
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
8682
return result
8783

88-
class ExtensionMetadataGet(AAZHttpOperation):
84+
class ExtensionMetadataV2Get(AAZHttpOperation):
8985
CLIENT_TYPE = "MgmtClient"
9086

9187
def __call__(self, *args, **kwargs):
@@ -99,7 +95,7 @@ def __call__(self, *args, **kwargs):
9995
@property
10096
def url(self):
10197
return self.client.format_url(
102-
"/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}",
98+
"/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}",
10399
**self.url_parameters
104100
)
105101

@@ -126,10 +122,6 @@ def url_parameters(self):
126122
"publisher", self.ctx.args.publisher,
127123
required=True,
128124
),
129-
**self.serialize_url_param(
130-
"subscriptionId", self.ctx.subscription_id,
131-
required=True,
132-
),
133125
**self.serialize_url_param(
134126
"version", self.ctx.args.version,
135127
required=True,
@@ -192,17 +184,38 @@ def _build_schema_on_200(cls):
192184
)
193185

194186
properties = cls._schema_on_200.properties
187+
properties.architecture = AAZListType(
188+
flags={"read_only": True},
189+
)
190+
properties.extension_signature_uri = AAZStrType(
191+
serialized_name="extensionSignatureUri",
192+
flags={"read_only": True},
193+
)
195194
properties.extension_type = AAZStrType(
196195
serialized_name="extensionType",
197196
flags={"read_only": True},
198197
)
198+
properties.extension_uris = AAZListType(
199+
serialized_name="extensionUris",
200+
flags={"read_only": True},
201+
)
202+
properties.operating_system = AAZStrType(
203+
serialized_name="operatingSystem",
204+
flags={"read_only": True},
205+
)
199206
properties.publisher = AAZStrType(
200207
flags={"read_only": True},
201208
)
202209
properties.version = AAZStrType(
203210
flags={"read_only": True},
204211
)
205212

213+
architecture = cls._schema_on_200.properties.architecture
214+
architecture.Element = AAZStrType()
215+
216+
extension_uris = cls._schema_on_200.properties.extension_uris
217+
extension_uris.Element = AAZStrType()
218+
206219
system_data = cls._schema_on_200.system_data
207220
system_data.created_at = AAZStrType(
208221
serialized_name="createdAt",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"azext.isPreview": true,
3-
"azext.minCliCoreVersion": "2.57.0"
3+
"azext.minCliCoreVersion": "2.75.0"
44
}

0 commit comments

Comments
 (0)