-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{DisconnectedOperations} Added az edge disconnected-operation edge-marketplace offer
command
#30980
base: dev
Are you sure you want to change the base?
Conversation
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
Validation for Breaking Change Starting...
Thanks for your contribution! |
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
DisconnectedOperations |
@microsoft-github-policy-service agree company="Microsoft" |
|
||
# Register the parent command group | ||
with self.command_group( | ||
"disconnectedoperations", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use edge disconnected-operation
as the top level command group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be okay if edge
keyword repeats? the command would look something like
az edge disconnected-operation edge-marketplace offer list
|
||
# Register the subgroup and its commands | ||
with self.command_group( | ||
"disconnectedoperations edgemarketplace", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please separate the edgemarketplace
by -
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
g.custom_command( | ||
"listoffers", "list_offers", table_transformer=transform_offers_table | ||
) | ||
g.custom_command( | ||
"getoffer", "get_offer", table_transformer=transform_offer_table | ||
) | ||
g.custom_command("packageoffer", "package_offer") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the command should be renamed as offer list
offer show
and offer package
based on cli command name guideline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
logger = get_logger(__name__) | ||
management_endpoint = _get_management_endpoint(cmd.cli_ctx) | ||
subscription_id = get_subscription_id(cmd.cli_ctx) | ||
|
||
# Construct URL with parameters | ||
url = ( | ||
f"https://{management_endpoint}" | ||
f"/subscriptions/{subscription_id}" | ||
f"/resourceGroups/{resource_group_name}" | ||
f"/providers/{provider_namespace}/dataBoxEdgeDevices/{resource_name}" | ||
f"/providers/{sub_provider}/offers/{publisher_name}:{offer_name}" | ||
f"?api-version={api_version}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the arm request, please use the aaz-dev-tools to generate atomic command, then you can use it directly in your custom functions. Like this
azure-cli/src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_workspace.py
Lines 28 to 48 in 3b70655
def recover_log_analytics_workspace(cmd, workspace_name, resource_group_name=None, no_wait=False): | |
from azure.cli.command_modules.monitor.aaz.latest.monitor.log_analytics.workspace import Create, \ | |
ListDeletedWorkspaces | |
deleted_workspaces = ListDeletedWorkspaces(cli_ctx=cmd.cli_ctx)(command_args={ | |
"resource_group": resource_group_name | |
}) | |
for deleted_workspace in deleted_workspaces: | |
if deleted_workspace['name'].lower() == workspace_name.lower(): | |
resource_group_name = _parse_id(deleted_workspace['id'])['resource-group'] | |
location = deleted_workspace['location'] | |
return Create(cli_ctx=cmd.cli_ctx)(command_args={ | |
"workspace_name": deleted_workspace['name'], | |
"resource_group": resource_group_name, | |
"location": location, | |
"no_wait": no_wait, | |
}) | |
raise InvalidArgumentValueError('{} is not a deleted workspace and you can only recover a deleted workspace ' | |
'within 14 days.'.format(workspace_name)) |
BTW, this module should be delivered as an extension. |
|
||
from azure.cli.command_modules.disconnectedoperations._client_factory import cf_image | ||
from azure.cli.core import AzCommandsLoader | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please input the _help.py here like this
from azure.cli.command_modules.monitor._help import helps # pylint: disable=unused-import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
@kairu-ms We actually need this module in a disconnected environment, so internet won't be there to install any extension on top of the CLI. |
az disconnectedoperations edgemarketplace packageoffer
commandaz disconnectedoperations edge-marketplace offer
command
az disconnectedoperations edge-marketplace offer
commandaz edge disconnected-operation edge-marketplace offer
command
Related command
az edge disconnected-operation
(new)Description
This PR adds support for packaging Microsoft.edgemarketplace images.
Corresponding AAZ PR: Azure/aaz#710
Testing Guide
History Notes
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.