Skip to content

Commit

Permalink
customize command
Browse files Browse the repository at this point in the history
  • Loading branch information
yaotongms committed Oct 24, 2024
1 parent 8ee2dd8 commit 0eb47c5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Update(AAZCommand):
"""Update the base Settings of the target resource.
:example: Sample command for setting update
az arcgateway settings update --resource-group myResourceGroup --subscription mySubscription --base-provider Microsoft.HybridCompute --base-resource-type machines --base-resource-name workloadServer --settings-resource-name default --gateway-resource-id myResourceId
az az arcgateway settings update --resource-group myResourceGroup --subscription mySubscription --base-provider Microsoft.HybridCompute --base-resource-type machines --base-resource-name workloadServer --gateway-resource-id myResourceId
"""

_aaz_info = {
Expand Down
2 changes: 1 addition & 1 deletion src/arcgateway/azext_arcgateway/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@


def load_command_table(self, _): # pylint: disable=unused-argument
pass
self.command_table["arcgateway settings update"] = Update(loader=self)
37 changes: 30 additions & 7 deletions src/arcgateway/azext_arcgateway/custom.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
# --------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines
# pylint: disable=unused-argument
# pylint: disable=too-many-statements

from knack.log import get_logger
from azure.cli.core.aaz import register_command
from .aaz.latest.arcgateway.settings import Update as _Update

@register_command(
"arcgateway settings update",
)
class Update(_Update):
"""Update the base Settings of the target resource.
:example: Sample command for setting update
az arcgateway settings update --resource-group myResourceGroup --subscription mySubscription --base-provider Microsoft.HybridCompute --base-resource-type machines --base-resource-name workloadServer --settings-resource-name default --gateway-resource-id myResourceId
"""
@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
args_schema = super()._build_arguments_schema(*args, **kwargs)

args_schema.settings_resource_name._required = False
args_schema.settings_resource_name._registered = False

return args_schema

logger = get_logger(__name__)
def pre_operations(self):
args = self.ctx.args
args.settings_resource_name = "Default"

0 comments on commit 0eb47c5

Please sign in to comment.