Skip to content

Commit f94d74d

Browse files
shanefujscalvinhzy
andauthored
[Storage-Discovery] 2025-06-01-preivew initial preview (#8954)
* [storage-discovery] 06-01-preivew cli extension * add azext_storage_discovery tests and recordings * Add help.py for azext_storage_discovery * split test into test_<module>_<feature> * add examples for all workspace features * add storage-discovery to service_name.json * update README and examples * update test cases and recordings * add codeowner * add codeowner --------- Co-authored-by: zhiyihuang <[email protected]>
1 parent a36d707 commit f94d74d

31 files changed

+3222
-0
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,5 @@
331331
/src/carbon/ @itiinani
332332

333333
/src/amlfs/ @Aman-Jain-14 @amajai @mawhite @brpanask @tibanyas
334+
335+
/src/storage-discovery/ @shanefujs @calvinhzy

src/service_name.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,11 @@
879879
"AzureServiceName": "Azure Storage Actions",
880880
"URL": "https://learn.microsoft.com/azure/storage-actions/"
881881
},
882+
{
883+
"Command": "az storage-discovery",
884+
"AzureServiceName": "Azure Storage Discovery",
885+
"URL": "https://learn.microsoft.com/azure/storage-discovery/"
886+
},
882887
{
883888
"Command": "az baremetalinstance",
884889
"AzureServiceName": "BareMetal Infrastructure",

src/storage-discovery/HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. :changelog:
2+
3+
Release History
4+
===============
5+
6+
1.0.0b1
7+
++++++
8+
* Initial release.

src/storage-discovery/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Azure CLI StorageDiscovery Extension #
2+
This is an extension to Azure CLI to manage StorageDiscovery resources.
3+
4+
## How to use ##
5+
### az storage-discovery workspace create ###
6+
```commandline
7+
az storage-discovery workspace create \
8+
--resource-group myRG \
9+
--name myWorkspace \
10+
--location francecentral \
11+
--workspace-roots "/subscriptions/mySubId/resourceGroups/myRG" \
12+
--scopes '[{"displayName":"basic","resourceTypes":["Microsoft.Storage/storageAccounts"]}]'
13+
```
14+
15+
### az storage-discovery workspace create (with full configuration) ###
16+
```commandline
17+
az storage-discovery workspace create \
18+
--resource-group myRG \
19+
--name myWorkspace \
20+
--location francecentral \
21+
--description "My workspace for storage discovery" \
22+
--sku Standard \
23+
--workspace-roots "/subscriptions/mySubId/resourceGroups/myRG" \
24+
--scopes '[{"displayName":"production","resourceTypes":["Microsoft.Storage/storageAccounts"],"tagKeysOnly":["environment"],"tags":{"project":"demo","tier":"prod"}}]'
25+
```
26+
27+
### az storage-discovery workspace show ###
28+
```commandline
29+
az storage-discovery workspace show --resource-group myRG --name myWorkspace
30+
```
31+
32+
### az storage-discovery workspace update ###
33+
```commandline
34+
az storage-discovery workspace update \
35+
--resource-group myRG \
36+
--name myWorkspace \
37+
--description "Updated description" \
38+
--sku Free \
39+
--scopes '[{"displayName":"updated","resourceTypes":["Microsoft.Storage/storageAccounts"],"tags":{"environment":"test"}}]' \
40+
--tags environment=production team=storage
41+
```
42+
43+
### az storage-discovery workspace list ###
44+
```commandline
45+
az storage-discovery workspace list --resource-group myRG
46+
```
47+
48+
### az storage-discovery workspace list (subscription level) ###
49+
```commandline
50+
az storage-discovery workspace list
51+
```
52+
53+
### az storage-discovery workspace delete ###
54+
```commandline
55+
az storage-discovery workspace delete --resource-group myRG --name myWorkspace
56+
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
from azure.cli.core import AzCommandsLoader
9+
from azext_storage_discovery._help import helps # pylint: disable=unused-import
10+
11+
12+
class StorageDiscoveryCommandsLoader(AzCommandsLoader):
13+
14+
def __init__(self, cli_ctx=None):
15+
from azure.cli.core.commands import CliCommandType
16+
custom_command_type = CliCommandType(
17+
operations_tmpl='azext_storage_discovery.custom#{}')
18+
super().__init__(cli_ctx=cli_ctx,
19+
custom_command_type=custom_command_type)
20+
21+
def load_command_table(self, args):
22+
from azext_storage_discovery.commands import load_command_table
23+
from azure.cli.core.aaz import load_aaz_command_table
24+
try:
25+
from . import aaz
26+
except ImportError:
27+
aaz = None
28+
if aaz:
29+
load_aaz_command_table(
30+
loader=self,
31+
aaz_pkg_name=aaz.__name__,
32+
args=args
33+
)
34+
load_command_table(self, args)
35+
return self.command_table
36+
37+
def load_arguments(self, command):
38+
from azext_storage_discovery._params import load_arguments
39+
load_arguments(self, command)
40+
41+
42+
COMMAND_LOADER_CLS = StorageDiscoveryCommandsLoader
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=line-too-long
9+
# pylint: disable=too-many-lines
10+
11+
from knack.help_files import helps # pylint: disable=unused-import
12+
13+
helps['storage-discovery workspace create'] = """
14+
type: command
15+
short-summary: Create a storage discovery workspace.
16+
examples:
17+
- name: Create a storage discovery workspace with basic settings.
18+
text: |
19+
az storage-discovery workspace create \\
20+
--resource-group myRG \\
21+
--name myWorkspace \\
22+
--location eastus2 \\
23+
--workspace-roots "/subscriptions/mySubId/resourceGroups/myRG" \\
24+
--scopes '[{"displayName":"basic","resourceTypes":["Microsoft.Storage/storageAccounts"]}]'
25+
- name: Create a storage discovery workspace with full configuration.
26+
text: |
27+
az storage-discovery workspace create \\
28+
--resource-group myRG \\
29+
--name myWorkspace \\
30+
--location francecentral \\
31+
--description "My workspace for storage discovery" \\
32+
--sku Standard \\
33+
--workspace-roots "/subscriptions/mySubId/resourceGroups/myRG" \\
34+
--scopes '[{"displayName":"production","resourceTypes":["Microsoft.Storage/storageAccounts"],"tagKeysOnly":["environment"],"tags":{"project":"demo","tier":"prod"}}]'
35+
"""
36+
37+
helps['storage-discovery workspace update'] = """
38+
type: command
39+
short-summary: Update a storage discovery workspace.
40+
examples:
41+
- name: Update workspace description and SKU.
42+
text: |
43+
az storage-discovery workspace update \\
44+
--resource-group myRG \\
45+
--name myWorkspace \\
46+
--description "Updated description" \\
47+
--sku Free
48+
- name: Update workspace with new scopes and tags.
49+
text: |
50+
az storage-discovery workspace update \\
51+
--resource-group myRG \\
52+
--name myWorkspace \\
53+
--scopes '[{"displayName":"updated","resourceTypes":["Microsoft.Storage/storageAccounts"],"tags":{"environment":"test"}}]' \\
54+
--tags environment=production team=storage
55+
- name: Update workspace roots to subscription level.
56+
text: |
57+
az storage-discovery workspace update \\
58+
--resource-group myRG \\
59+
--name myWorkspace \\
60+
--workspace-roots "/subscriptions/mySubId"
61+
"""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=too-many-lines
9+
# pylint: disable=too-many-statements
10+
11+
12+
def load_arguments(self, _): # pylint: disable=unused-argument
13+
pass
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"storage-discovery",
16+
is_preview=True,
17+
)
18+
class __CMDGroup(AAZCommandGroup):
19+
"""Manage Storage Discovery
20+
"""
21+
pass
22+
23+
24+
__all__ = ["__CMDGroup"]

0 commit comments

Comments
 (0)