Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/connectedmachine/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Release History
===============
2.0.0b2
+++++
* Update connectedmachine extension image commands and set subscription id as optional.

2.0.0b1
+++++
* 2024/11/10-preview is used for aaz generation. Migrated to aaz.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@
"connectedmachine extension image list",
)
class List(AAZCommand):
"""List all Extension versions based on location, publisher, extensionType.
"""List all Extension versions based on location, publisher, extensionType

:example: Sample command for extension image list
az connectedmachine extension image list --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent --location eastus
:example: GET a list of extension metadata
az connectedmachine extension image list --location EastUS --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent
"""

_aaz_info = {
"version": "2024-11-10-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions", "2024-11-10-preview"],
["mgmt-plane", "/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions", "2024-11-10-preview"],
]
}

AZ_SUPPORT_PAGINATION = True

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()
return self.build_paging(self._execute_operations, self._output)

_args_schema = None

Expand Down Expand Up @@ -61,7 +62,7 @@ def _build_arguments_schema(cls, *args, **kwargs):

def _execute_operations(self):
self.pre_operations()
self.ExtensionMetadataList(ctx=self.ctx)()
self.ExtensionMetadataV2List(ctx=self.ctx)()
self.post_operations()

@register_callback
Expand All @@ -74,9 +75,10 @@ def post_operations(self):

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True)
return result
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
return result, next_link

class ExtensionMetadataList(AAZHttpOperation):
class ExtensionMetadataV2List(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand All @@ -90,7 +92,7 @@ def __call__(self, *args, **kwargs):
@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions",
"/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions",
**self.url_parameters
)

Expand All @@ -117,10 +119,6 @@ def url_parameters(self):
"publisher", self.ctx.args.publisher,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

Expand Down Expand Up @@ -161,6 +159,9 @@ def _build_schema_on_200(cls):
cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.next_link = AAZStrType(
serialized_name="nextLink",
)
_schema_on_200.value = AAZListType(
flags={"read_only": True},
)
Expand All @@ -187,17 +188,38 @@ def _build_schema_on_200(cls):
)

properties = cls._schema_on_200.value.Element.properties
properties.architecture = AAZListType(
flags={"read_only": True},
)
properties.extension_signature_uri = AAZStrType(
serialized_name="extensionSignatureUri",
flags={"read_only": True},
)
properties.extension_type = AAZStrType(
serialized_name="extensionType",
flags={"read_only": True},
)
properties.extension_uris = AAZListType(
serialized_name="extensionUris",
flags={"read_only": True},
)
properties.operating_system = AAZStrType(
serialized_name="operatingSystem",
flags={"read_only": True},
)
properties.publisher = AAZStrType(
flags={"read_only": True},
)
properties.version = AAZStrType(
flags={"read_only": True},
)

architecture = cls._schema_on_200.value.Element.properties.architecture
architecture.Element = AAZStrType()

extension_uris = cls._schema_on_200.value.Element.properties.extension_uris
extension_uris.Element = AAZStrType()

system_data = cls._schema_on_200.value.Element.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
"connectedmachine extension image show",
)
class Show(AAZCommand):
"""Get an Extension Metadata based on location, publisher, extensionType and version.
"""Get an Extension Metadata based on location, publisher, extensionType and version

:example: Sample command for extension image show
az connectedmachine extension image show --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent --location eastus --version 1.9.1
:example: GET an extension metadata
az connectedmachine extension image show --location EastUS --publisher microsoft.azure.monitor --extension-type azuremonitorlinuxagent --version 1.33.0
"""

_aaz_info = {
"version": "2024-11-10-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions/{}", "2024-11-10-preview"],
["mgmt-plane", "/providers/microsoft.hybridcompute/locations/{}/publishers/{}/extensiontypes/{}/versions/{}", "2024-11-10-preview"],
]
}

Expand All @@ -48,29 +48,25 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["--type", "--extension-type"],
help="The extensionType of the Extension being received.",
required=True,
id_part="child_name_2",
)
_args_schema.location = AAZResourceLocationArg(
required=True,
id_part="name",
)
_args_schema.publisher = AAZStrArg(
options=["-p", "--publisher"],
help="The publisher of the Extension being received.",
required=True,
id_part="child_name_1",
)
_args_schema.version = AAZStrArg(
options=["-n", "--name", "--version"],
help="The version of the Extension being received.",
required=True,
id_part="child_name_3",
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.ExtensionMetadataGet(ctx=self.ctx)()
self.ExtensionMetadataV2Get(ctx=self.ctx)()
self.post_operations()

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

class ExtensionMetadataGet(AAZHttpOperation):
class ExtensionMetadataV2Get(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand All @@ -99,7 +95,7 @@ def __call__(self, *args, **kwargs):
@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}",
"/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}",
**self.url_parameters
)

Expand All @@ -126,10 +122,6 @@ def url_parameters(self):
"publisher", self.ctx.args.publisher,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
**self.serialize_url_param(
"version", self.ctx.args.version,
required=True,
Expand Down Expand Up @@ -192,17 +184,38 @@ def _build_schema_on_200(cls):
)

properties = cls._schema_on_200.properties
properties.architecture = AAZListType(
flags={"read_only": True},
)
properties.extension_signature_uri = AAZStrType(
serialized_name="extensionSignatureUri",
flags={"read_only": True},
)
properties.extension_type = AAZStrType(
serialized_name="extensionType",
flags={"read_only": True},
)
properties.extension_uris = AAZListType(
serialized_name="extensionUris",
flags={"read_only": True},
)
properties.operating_system = AAZStrType(
serialized_name="operatingSystem",
flags={"read_only": True},
)
properties.publisher = AAZStrType(
flags={"read_only": True},
)
properties.version = AAZStrType(
flags={"read_only": True},
)

architecture = cls._schema_on_200.properties.architecture
architecture.Element = AAZStrType()

extension_uris = cls._schema_on_200.properties.extension_uris
extension_uris.Element = AAZStrType()

system_data = cls._schema_on_200.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.57.0"
"azext.minCliCoreVersion": "2.75.0"
}
Loading
Loading