Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8467e6c
Adding ExtensionImage + aaz
ankjayant May 2, 2023
15e3a22
Updating patches + history
ankjayant May 11, 2023
4e4c419
Comment fixes + Generating from stable version
ankjayant May 25, 2023
de09bcc
add extension image commands
yaotongms Jul 7, 2023
b88a39e
remove private link scope show machine details
yaotongms Jul 14, 2023
a267318
Merge pull request #1 from yaotongms/feature-extensionimage
yaotongms Jul 14, 2023
8ea5b02
add all tests
yaotongms Jul 17, 2023
cfeb05a
add all tests
yaotongms Jul 17, 2023
6b8dd6b
fix swagger regex
yaotongms Jul 25, 2023
fdd9d74
add test on install patches
yaotongms Aug 7, 2023
515f0ff
Revert "add test on install patches"
yaotongms Aug 7, 2023
b54701a
add test on install patches
yaotongms Aug 8, 2023
9c5ebec
fix code style
yaotongms Aug 9, 2023
c15131a
remove old code and shorten argument names
yaotongms Aug 9, 2023
6d6fc0e
add missing descriptions
yaotongms Aug 9, 2023
db6fe17
fix command description
yaotongms Aug 9, 2023
4942cf4
Update src/connectedmachine/HISTORY.rst
yaotongms Aug 11, 2023
b1a0601
Update src/connectedmachine/azext_connectedmachine/aaz/latest/connect…
yaotongms Aug 11, 2023
d459313
Update src/connectedmachine/azext_connectedmachine/aaz/latest/connect…
yaotongms Aug 11, 2023
31deb65
Update src/connectedmachine/azext_connectedmachine/aaz/latest/connect…
yaotongms Aug 11, 2023
90cfcfe
Update src/connectedmachine/azext_connectedmachine/aaz/latest/connect…
yaotongms Aug 11, 2023
304ee24
fix command description
yaotongms Aug 11, 2023
6db95ab
fix command description
yaotongms Aug 11, 2023
0d23f55
Update src/connectedmachine/setup.py
yaotongms Aug 13, 2023
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
3 changes: 3 additions & 0 deletions src/connectedmachine/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Release History
===============
0.6.0
+++++
* Adding install-patches/assess-patches/Extensionimage API's. 2022/12/27 is used for aaz generation. Migrated to aaz.
Comment thread
yaotongms marked this conversation as resolved.
Outdated

0.5.1
+++++
Expand Down
12 changes: 11 additions & 1 deletion src/connectedmachine/azext_connectedmachine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import azext_connectedmachine._help
from azure.cli.core import AzCommandsLoader


class ConnectedMachineCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
Expand All @@ -26,6 +25,17 @@ def __init__(self, cli_ctx=None):

def load_command_table(self, args):
from azext_connectedmachine.generated.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
try:
from azext_connectedmachine.manual.commands import load_command_table as load_command_table_manual
Expand Down
6 changes: 6 additions & 0 deletions src/connectedmachine/azext_connectedmachine/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"connectedmachine",
)
class __CMDGroup(AAZCommandGroup):
"""Manage an Azure Arc-Enabled Server.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._assess_patches import *
from ._delete import *
from ._install_patches import *
from ._list import *
from ._show import *
from ._update import *
from ._upgrade_extension import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command(
"connectedmachine assess-patches",
)
class AssessPatches(AAZCommand):
"""Assess patches on an Azure Arc-Enabled Server.

:example: Sample command for assess-patches
az connectedmachine assess-patches --resource-group MyResourceGroup --name MyMachine
"""

_aaz_info = {
"version": "2022-12-27",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.hybridcompute/machines/{}/assesspatches", "2022-12-27"],
]
}

AZ_SUPPORT_NO_WAIT = True

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

_args_schema = None

@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
if cls._args_schema is not None:
return cls._args_schema
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)

# define Arg Group ""

_args_schema = cls._args_schema
_args_schema.name = AAZStrArg(
options=["-n", "--name"],
help="The name of the hybrid machine.",
required=True,
id_part="name",
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
yield self.MachinesAssessPatches(ctx=self.ctx)()
self.post_operations()

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

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

class MachinesAssessPatches(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
request = self.make_request()
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [202]:
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200,
self.on_error,
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200]:
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200,
self.on_error,
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches",
**self.url_parameters
)

@property
def method(self):
return "POST"

@property
def error_format(self):
return "MgmtErrorFormat"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"name", self.ctx.args.name,
required=True,
),
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-12-27",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

def on_200(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_200
)

_schema_on_200 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.assessment_activity_id = AAZStrType(
serialized_name="assessmentActivityId",
flags={"read_only": True},
)
_schema_on_200.available_patch_count_by_classification = AAZObjectType(
serialized_name="availablePatchCountByClassification",
)
_schema_on_200.error_details = AAZObjectType(
serialized_name="errorDetails",
)
_AssessPatchesHelper._build_schema_error_detail_read(_schema_on_200.error_details)
_schema_on_200.last_modified_date_time = AAZStrType(
serialized_name="lastModifiedDateTime",
flags={"read_only": True},
)
_schema_on_200.os_type = AAZStrType(
serialized_name="osType",
flags={"read_only": True},
)
_schema_on_200.patch_service_used = AAZStrType(
serialized_name="patchServiceUsed",
flags={"read_only": True},
)
_schema_on_200.reboot_pending = AAZBoolType(
serialized_name="rebootPending",
flags={"read_only": True},
)
_schema_on_200.start_date_time = AAZStrType(
serialized_name="startDateTime",
flags={"read_only": True},
)
_schema_on_200.started_by = AAZStrType(
serialized_name="startedBy",
flags={"read_only": True},
)
_schema_on_200.status = AAZStrType(
flags={"read_only": True},
)

available_patch_count_by_classification = cls._schema_on_200.available_patch_count_by_classification
available_patch_count_by_classification.critical = AAZIntType(
flags={"read_only": True},
)
available_patch_count_by_classification.definition = AAZIntType(
flags={"read_only": True},
)
available_patch_count_by_classification.feature_pack = AAZIntType(
serialized_name="featurePack",
flags={"read_only": True},
)
available_patch_count_by_classification.other = AAZIntType(
flags={"read_only": True},
)
available_patch_count_by_classification.security = AAZIntType(
flags={"read_only": True},
)
available_patch_count_by_classification.service_pack = AAZIntType(
serialized_name="servicePack",
flags={"read_only": True},
)
available_patch_count_by_classification.tools = AAZIntType(
flags={"read_only": True},
)
available_patch_count_by_classification.update_rollup = AAZIntType(
serialized_name="updateRollup",
flags={"read_only": True},
)
available_patch_count_by_classification.updates = AAZIntType(
flags={"read_only": True},
)

return cls._schema_on_200


class _AssessPatchesHelper:
"""Helper class for AssessPatches"""

_schema_error_detail_read = None

@classmethod
def _build_schema_error_detail_read(cls, _schema):
if cls._schema_error_detail_read is not None:
_schema.additional_info = cls._schema_error_detail_read.additional_info
_schema.code = cls._schema_error_detail_read.code
_schema.details = cls._schema_error_detail_read.details
_schema.message = cls._schema_error_detail_read.message
_schema.target = cls._schema_error_detail_read.target
return

cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType()

error_detail_read = _schema_error_detail_read
error_detail_read.additional_info = AAZListType(
serialized_name="additionalInfo",
flags={"read_only": True},
)
error_detail_read.code = AAZStrType(
flags={"read_only": True},
)
error_detail_read.details = AAZListType(
flags={"read_only": True},
)
error_detail_read.message = AAZStrType(
flags={"read_only": True},
)
error_detail_read.target = AAZStrType(
flags={"read_only": True},
)

additional_info = _schema_error_detail_read.additional_info
additional_info.Element = AAZObjectType()

_element = _schema_error_detail_read.additional_info.Element
_element.type = AAZStrType(
flags={"read_only": True},
)

details = _schema_error_detail_read.details
details.Element = AAZObjectType()
cls._build_schema_error_detail_read(details.Element)

_schema.additional_info = cls._schema_error_detail_read.additional_info
_schema.code = cls._schema_error_detail_read.code
_schema.details = cls._schema_error_detail_read.details
_schema.message = cls._schema_error_detail_read.message
_schema.target = cls._schema_error_detail_read.target


__all__ = ["AssessPatches"]
Loading