-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{DisconnectedOperations} Added az edge disconnected-operation offer command
#30980
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
Draft
kotewar
wants to merge
49
commits into
Azure:dev
Choose a base branch
from
kotewar:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
fdb30b0
initial commit
20ccfa2
fixed linter issues
fb71536
Added enhanced list and download logic
bdd0065
fixed linter comments
073d0d3
added get-offer
ded8819
updated help file
f084e8c
Added image download logic
4e310f1
removing mgmt storage latest
f888c18
Added storage mgmt version back
3de81a9
Merge branch 'dev' of https://github.com/kotewar/azure-cli into dev
dd577af
Merge branch 'Azure:dev' into dev
kotewar abe306c
initial commit
b3a27b7
fixed linter issues
d2159a2
Added enhanced list and download logic
a6544bb
fixed linter comments
82077ab
added get-offer
3a6d509
updated help file
5f2053d
Added image download logic
c0b969d
removing mgmt storage latest
65dd221
Added storage mgmt version back
d67dab0
fixed styling issues
e4effe4
Merge branch 'dev' of https://github.com/kotewar/azure-cli into dev
5f9ceff
Added unit tests
977bb3f
added more tests and fixed linting issues
7e11fbc
Updated test case
e28abbf
Merge branch 'Azure:dev' into dev
kotewar ff73e46
Merge branch 'Azure:dev' into dev
kotewar caa8d91
Addressed review comments for command and help
ae32b4a
Merge branch 'Azure:dev' into dev
kotewar b73d852
Addressed review comments for edge
a372b18
Merge branch 'Azure:dev' into dev
kotewar db6efc6
Merge branch 'Azure:dev' into dev
kotewar 59da40e
Fixed endpoints
6a60d3d
Merge branch 'Azure:dev' into dev
kotewar 3ce8fa4
Merge branch 'Azure:dev' into dev
kotewar e85a69d
Merge branch 'Azure:dev' into dev
kotewar 9999650
Merge branch 'Azure:dev' into dev
kotewar 4ba2873
Merge branch 'Azure:dev' into dev
kotewar 7f3eccb
Added catalog content in metadata file
d616d86
Replacing endpoints with unpublished edge marketplace sdk functions
1d65274
Merge branch 'Azure:dev' into dev
kotewar 2d26a6f
Refactored packaging tool
68727bf
Merge branch 'Azure:dev' into dev
kotewar ccf7ded
Fixed helpfile with recent changes
da29256
fixed styling errors and tests
e9cafd7
Merge branch 'Azure:dev' into dev
kotewar 838066f
Refactored code
03dc2a6
Merge branch 'Azure:dev' into dev
kotewar 0484e93
Unit tests fixes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/azure-cli/azure/cli/command_modules/disconnectedoperations/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from azure.cli.command_modules.disconnectedoperations._client_factory import cf_image | ||
|
|
||
| # pylint: disable=unused-import | ||
| from azure.cli.command_modules.disconnectedoperations._help import ( | ||
| helps, | ||
| ) | ||
| from azure.cli.core import AzCommandsLoader | ||
|
|
||
|
|
||
| class DisconnectedoperationsCommandsLoader(AzCommandsLoader): | ||
| def __init__(self, cli_ctx=None): | ||
| from azure.cli.core.commands import CliCommandType | ||
| from azure.cli.core.profiles import ResourceType | ||
|
|
||
| disconnectedoperations_custom = CliCommandType( | ||
| operations_tmpl="azure.cli.command_modules.disconnectedoperations.custom#{}", | ||
| client_factory=cf_image, | ||
| ) | ||
| super().__init__( | ||
| cli_ctx=cli_ctx, | ||
| resource_type=ResourceType.MGMT_DISCONNECTEDOPERATIONS, | ||
| custom_command_type=disconnectedoperations_custom, | ||
| ) | ||
|
|
||
| def load_command_table(self, args): | ||
| from azure.cli.command_modules.disconnectedoperations.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) | ||
| return self.command_table | ||
|
|
||
| def load_arguments(self, command): | ||
| from azure.cli.command_modules.disconnectedoperations._params import ( | ||
| load_arguments, | ||
| ) | ||
|
|
||
| load_arguments(self, command) | ||
|
|
||
|
|
||
| COMMAND_LOADER_CLS = DisconnectedoperationsCommandsLoader | ||
19 changes: 19 additions & 0 deletions
19
src/azure-cli/azure/cli/command_modules/disconnectedoperations/_client_factory.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| def get_disconnectedoperations_management_client(cli_ctx, *_): | ||
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
|
|
||
| # pylint: disable=import-error no-name-in-module | ||
| from azure.mgmt.disconnectedoperations import ( | ||
| DisconnectedOperationsClient, | ||
| ) | ||
|
|
||
| return get_mgmt_service_client(cli_ctx, DisconnectedOperationsClient) | ||
|
|
||
|
|
||
| def cf_image(cli_ctx, *_): | ||
| return get_disconnectedoperations_management_client(cli_ctx).image |
114 changes: 114 additions & 0 deletions
114
src/azure-cli/azure/cli/command_modules/disconnectedoperations/_help.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from knack.help_files import helps | ||
|
|
||
| helps['edge'] = """ | ||
| type: group | ||
| short-summary: Manage Azure Edge services and operations for edge computing scenarios. | ||
| """ | ||
|
|
||
| # Remove the duplicate entry and improve the remaining one | ||
| helps['edge disconnected-operation'] = """ | ||
| type: group | ||
| short-summary: Manage Azure Edge Marketplace services for disconnected (offline) environments. | ||
| long-summary: Enables downloading and packaging of marketplace offerings for deployment in environments with limited or no internet connectivity. | ||
| """ | ||
|
|
||
| helps['edge disconnected-operation offer'] = """ | ||
| type: group | ||
| short-summary: Manage marketplace offers for disconnected Edge environments. | ||
| long-summary: View, download, and package marketplace VM images and solutions for deployment to disconnected edge environments. | ||
| """ | ||
|
|
||
| helps['edge disconnected-operation offer list'] = """ | ||
| type: command | ||
| short-summary: List all available marketplace offers for disconnected operations. | ||
| long-summary: Retrieves a list of all VM images and solutions available in the marketplace that can be packaged for disconnected environments, including publisher, offer, SKU, and version information. | ||
| examples: | ||
| - name: List all marketplace offers for a specific resource | ||
| text: > | ||
| az edge disconnected-operation offer list --resource-group myResourceGroup --resource-name myResource | ||
| - name: List offers and format output as table | ||
| text: > | ||
| az edge disconnected-operation offer list -g myResourceGroup --resource-name myResource --output table | ||
| - name: List offers and filter output using JMESPath query | ||
| text: > | ||
| az edge disconnected-operation offer list -g myResourceGroup --resource-name myResource --query "[?OS_Type=='Linux']" | ||
| parameters: | ||
| - name: --resource-group -g | ||
| type: string | ||
| short-summary: Name of resource group containing the disconnected operations resource | ||
| - name: --resource-name | ||
| type: string | ||
| short-summary: Name of the disconnected operations resource | ||
| """ | ||
|
|
||
| helps['edge disconnected-operation offer get'] = """ | ||
| type: command | ||
| short-summary: Get detailed information about a specific marketplace offer. | ||
| long-summary: Retrieves comprehensive details for a marketplace offer, including available SKUs, versions, OS type, and size information to help with disconnected environment planning. | ||
| examples: | ||
| - name: Get details of a specific marketplace offer | ||
| text: > | ||
| az edge disconnected-operation offer get --resource-group myResourceGroup --resource-name myResource --publisher-name publisherName --offer-id offerName | ||
| - name: Get offer details and output as JSON | ||
| text: > | ||
| az edge disconnected-operation offer get -g myResourceGroup --resource-name myResource --publisher-name publisherName --offer-id offerName --output json | ||
| - name: Get offer details with custom query | ||
| text: > | ||
| az edge disconnected-operation offer get -g myResourceGroup --resource-name myResource --publisher-name publisherName --offer-id offerName --query "[].{SKU:SKU,Version:Versions}" | ||
| parameters: | ||
| - name: --resource-group -g | ||
| type: string | ||
| short-summary: Name of resource group containing the disconnected operations resource | ||
| - name: --resource-name | ||
| type: string | ||
| short-summary: Name of the disconnected operations resource | ||
| - name: --publisher-name | ||
| type: string | ||
| short-summary: Publisher name of the marketplace offer (e.g., 'MicrosoftWindowsServer') | ||
| - name: --offer-id | ||
| type: string | ||
| short-summary: Offer identifier in the marketplace (e.g., 'WindowsServer') | ||
| """ | ||
|
|
||
| helps['edge disconnected-operation offer package'] = """ | ||
| type: command | ||
| short-summary: Download and package a marketplace VM image with its metadata for offline use. | ||
| long-summary: Creates a complete package containing the VM image (VHD), metadata, and icons for deployment in disconnected environments. The package can be transported to an air-gapped environment and used for VM deployment without internet connectivity. | ||
| examples: | ||
| - name: Package a marketplace offer with specific version | ||
| text: > | ||
| az edge disconnected-operation offer package --resource-group myResourceGroup --resource-name myResource --publisher-name publisherName --offer-id offerName --sku skuName --version versionNumber --output-folder "D:\\MarketplacePackages" | ||
| - name: Package a marketplace offer with specific region | ||
| text: > | ||
| az edge disconnected-operation offer package --resource-group myResourceGroup --resource-name myResource --publisher-name publisherName --offer-id offerName --sku skuName --version versionNumber --output-folder "D:\\MarketplacePackages" --region eastus | ||
| parameters: | ||
| - name: --resource-group -g | ||
| type: string | ||
| short-summary: Name of resource group containing the disconnected operations resource | ||
| - name: --resource-name | ||
| type: string | ||
| short-summary: Name of the disconnected operations resource | ||
| - name: --publisher-name | ||
| type: string | ||
| short-summary: Publisher name of the marketplace offer (e.g., 'MicrosoftWindowsServer') | ||
| - name: --offer-id | ||
| type: string | ||
| short-summary: Offer identifier in the marketplace (e.g., 'WindowsServer') | ||
| - name: --sku | ||
| type: string | ||
| short-summary: SKU identifier for the specific offer variant (e.g., '2019-Datacenter') | ||
| - name: --version | ||
| type: string | ||
| short-summary: Version of the marketplace offer to download (e.g., '17763.3287.2210110541') | ||
| - name: --output-folder | ||
| type: string | ||
| short-summary: Local folder path where the package contents will be downloaded and organized | ||
| - name: --region | ||
| type: string | ||
| short-summary: Azure region to use for marketplace access (e.g., 'eastus', 'westeurope') | ||
| """ |
49 changes: 49 additions & 0 deletions
49
src/azure-cli/azure/cli/command_modules/disconnectedoperations/_params.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # 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 | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from azure.cli.core.commands.parameters import resource_group_name_type | ||
|
|
||
|
|
||
| def load_arguments(self, _): | ||
| with self.argument_context( | ||
| "disconnectedoperations edgemarketplace listoffers" | ||
| ) as c: | ||
| c.argument("resource_group_name", arg_type=resource_group_name_type) | ||
| c.argument( | ||
| "resource_name", type=str, help="Name of the resource to list offers for" | ||
| ) | ||
|
|
||
| with self.argument_context("disconnectedoperations edgemarketplace getoffer") as c: | ||
| c.argument("resource_group_name", arg_type=resource_group_name_type) | ||
| c.argument( | ||
| "resource_name", type=str, help="Name of the resource to list offers for" | ||
| ) | ||
| c.argument("offer_id", type=str, help="Name of the offer") | ||
| c.argument("publisher_name", type=str, help="Name of the publisher") | ||
|
|
||
| with self.argument_context( | ||
| "disconnectedoperations edgemarketplace packageoffer" | ||
| ) as c: | ||
| c.argument("resource_group_name", arg_type=resource_group_name_type) | ||
| c.argument( | ||
| "resource_name", type=str, help="Name of the resource to list offers for" | ||
| ) | ||
| c.argument("publisher_name", type=str, help="Name of the publisher") | ||
| c.argument("offer_id", type=str, help="Name of the offer to package") | ||
| c.argument("sku", type=str, help="SKU of the product") | ||
| c.argument("version", type=str, help="Version of the product") | ||
| c.argument( | ||
| "output_folder", | ||
| type=str, | ||
| help="Drive and directory to save the package to. Example: E:\\ or D:\\packages\\", | ||
| ) | ||
| c.argument( | ||
| "region", | ||
| type=str, | ||
| help="Azure region to use for marketplace access. If not specified, the current cloud's primary region will be used.", # pylint: disable=line-too-long | ||
| required=False, | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
azure-cli/src/azure-cli/azure/cli/command_modules/monitor/__init__.py
Line 9 in 3b70655
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