Skip to content

Commit 736d67b

Browse files
committed
az storage share create: Add --enable-snapshot-virtual-directory-access
1 parent a6798ae commit 736d67b

File tree

3 files changed

+200
-0
lines changed

3 files changed

+200
-0
lines changed

src/azure-cli/azure/cli/command_modules/storage/_params.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,11 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
17821782
resource_type=ResourceType.DATA_STORAGE_FILESHARE)
17831783
c.extra('protocols', options_list=['--protocol'], arg_type=get_enum_type(t_share_protocols_type),
17841784
help='The protocol to enable for the share.')
1785+
c.extra('enable_snapshot_virtual_directory_access',
1786+
options_list=('--enable-snapshot-virtual-directory-access', '--virtual-dir-access'),
1787+
arg_type=get_three_state_flag(),
1788+
help='Specifies whether the snapshot virtual directory should be accessible at the root of the '
1789+
'share mount point when NFS is enabled. If not specified, it will be accessible.')
17851790

17861791
with self.argument_context('storage share url') as c:
17871792
c.extra('unc', action='store_true', help='Output UNC network path.')
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- application/json
7+
Accept-Encoding:
8+
- gzip, deflate
9+
CommandName:
10+
- storage account keys list
11+
Connection:
12+
- keep-alive
13+
Content-Length:
14+
- '0'
15+
ParameterSetName:
16+
- -n -g --query -o
17+
User-Agent:
18+
- AZURECLI/2.70.0 azsdk-python-core/1.31.0 Python/3.12.9 (Windows-11-10.0.26100-SP0)
19+
method: POST
20+
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Storage/storageAccounts/share000002/listKeys?api-version=2024-01-01&$expand=kerb
21+
response:
22+
body:
23+
string: '{"keys":[{"creationTime":"2025-03-24T07:54:38.3786395Z","keyName":"key1","value":"veryFakedStorageAccountKey==","permissions":"FULL"},{"creationTime":"2025-03-24T07:54:38.3786395Z","keyName":"key2","value":"veryFakedStorageAccountKey==","permissions":"FULL"}]}'
24+
headers:
25+
cache-control:
26+
- no-cache
27+
content-length:
28+
- '260'
29+
content-type:
30+
- application/json
31+
date:
32+
- Mon, 24 Mar 2025 07:55:03 GMT
33+
expires:
34+
- '-1'
35+
pragma:
36+
- no-cache
37+
strict-transport-security:
38+
- max-age=31536000; includeSubDomains
39+
x-cache:
40+
- CONFIG_NOCACHE
41+
x-content-type-options:
42+
- nosniff
43+
x-ms-operation-identifier:
44+
- tenantId=54826b22-38d6-4fb2-bad9-b7b93a3e9c5a,objectId=a7250e3a-0e5e-48e2-9a34-45f1f5e1a91e/southeastasia/f62b3840-5053-420e-a14b-a6678ed31473
45+
x-ms-ratelimit-remaining-subscription-resource-requests:
46+
- '11999'
47+
x-msedge-ref:
48+
- 'Ref A: 78F7AD4038F74BF3973FAC71662C42DC Ref B: MAA201060515019 Ref C: 2025-03-24T07:55:03Z'
49+
status:
50+
code: 200
51+
message: OK
52+
- request:
53+
body: null
54+
headers:
55+
Accept:
56+
- application/xml
57+
Accept-Encoding:
58+
- gzip, deflate
59+
CommandName:
60+
- storage share create
61+
Connection:
62+
- keep-alive
63+
Content-Length:
64+
- '0'
65+
ParameterSetName:
66+
- -n --fail-on-exist --metadata --enable-snapshot-virtual-directory-access --protocol
67+
--account-name --account-key
68+
User-Agent:
69+
- AZURECLI/2.70.0 azsdk-python-storage-file-share/12.21.0 Python/3.12.9 (Windows-11-10.0.26100-SP0)
70+
x-ms-date:
71+
- Mon, 24 Mar 2025 07:55:04 GMT
72+
x-ms-enable-snapshot-virtual-directory-access:
73+
- 'false'
74+
x-ms-enabled-protocols:
75+
- NFS
76+
x-ms-meta:
77+
- '{''foo'': ''bar'', ''cat'': ''hat''}'
78+
x-ms-meta-cat:
79+
- hat
80+
x-ms-meta-foo:
81+
- bar
82+
x-ms-version:
83+
- '2025-05-05'
84+
method: PUT
85+
uri: https://share000002.file.core.windows.net/share000003?restype=share
86+
response:
87+
body:
88+
string: ''
89+
headers:
90+
content-length:
91+
- '0'
92+
date:
93+
- Mon, 24 Mar 2025 07:55:04 GMT
94+
etag:
95+
- '"0x8DD6AA930885461"'
96+
last-modified:
97+
- Mon, 24 Mar 2025 07:55:05 GMT
98+
server:
99+
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
100+
x-ms-version:
101+
- '2025-05-05'
102+
status:
103+
code: 201
104+
message: Created
105+
- request:
106+
body: null
107+
headers:
108+
Accept:
109+
- application/xml
110+
Accept-Encoding:
111+
- gzip, deflate
112+
CommandName:
113+
- storage share show
114+
Connection:
115+
- keep-alive
116+
ParameterSetName:
117+
- -n --account-name --account-key
118+
User-Agent:
119+
- AZURECLI/2.70.0 azsdk-python-storage-file-share/12.21.0 Python/3.12.9 (Windows-11-10.0.26100-SP0)
120+
x-ms-date:
121+
- Mon, 24 Mar 2025 07:55:05 GMT
122+
x-ms-version:
123+
- '2025-05-05'
124+
method: GET
125+
uri: https://share000002.file.core.windows.net/share000003?restype=share
126+
response:
127+
body:
128+
string: ''
129+
headers:
130+
content-length:
131+
- '0'
132+
date:
133+
- Mon, 24 Mar 2025 07:55:06 GMT
134+
etag:
135+
- '"0x8DD6AA930885461"'
136+
last-modified:
137+
- Mon, 24 Mar 2025 07:55:05 GMT
138+
server:
139+
- Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
140+
x-ms-access-tier:
141+
- Premium
142+
x-ms-enable-snapshot-virtual-directory-access:
143+
- 'false'
144+
x-ms-enabled-protocols:
145+
- NFS
146+
x-ms-has-immutability-policy:
147+
- 'false'
148+
x-ms-has-legal-hold:
149+
- 'false'
150+
x-ms-lease-state:
151+
- available
152+
x-ms-lease-status:
153+
- unlocked
154+
x-ms-meta-cat:
155+
- hat
156+
x-ms-meta-foo:
157+
- bar
158+
x-ms-root-squash:
159+
- NoRootSquash
160+
x-ms-share-next-allowed-quota-downgrade-time:
161+
- Mon, 24 Mar 2025 07:55:05 GMT
162+
x-ms-share-paid-bursting-enabled:
163+
- 'false'
164+
x-ms-share-provisioned-bandwidth-mibps:
165+
- '117'
166+
x-ms-share-provisioned-egress-mbps:
167+
- '117'
168+
x-ms-share-provisioned-ingress-mbps:
169+
- '117'
170+
x-ms-share-provisioned-iops:
171+
- '3032'
172+
x-ms-share-quota:
173+
- '32'
174+
x-ms-version:
175+
- '2025-05-05'
176+
status:
177+
code: 200
178+
message: OK
179+
version: 1

src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_file_share_scenarios.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ def test_storage_file_share_scenario(self, resource_group, storage_account):
7373
self.storage_cmd('storage share show --name {}', account_info, share) \
7474
.assert_with_checks(JMESPathCheck('properties.quota', 3))
7575

76+
@ResourceGroupPreparer(name_prefix='clitest')
77+
@StorageAccountPreparer(name_prefix='share', kind='FileStorage', location='eastus2', sku='Premium_LRS')
78+
def test_storage_file_share_premium_scenario(self, resource_group, storage_account):
79+
80+
account_info = self.get_account_info(resource_group, storage_account)
81+
share_name = self.create_random_name('share', 24)
82+
83+
self.storage_cmd('storage share create -n {} --fail-on-exist --metadata foo=bar cat=hat '
84+
'--enable-snapshot-virtual-directory-access false --protocol nfs',
85+
account_info, share_name) \
86+
.assert_with_checks(JMESPathCheck('created', True))
87+
88+
self.storage_cmd('storage share show -n {}', account_info, share_name) \
89+
.assert_with_checks(JMESPathCheck('enableSnapshotVirtualDirectoryAccess', False),
90+
JMESPathCheck('protocols', ['NFS']))
91+
7692
@ResourceGroupPreparer(name_prefix='clitest')
7793
@StorageAccountPreparer(name_prefix='share', kind='StorageV2', location='eastus2', sku='Standard_RAGRS')
7894
def test_storage_share_metadata_scenario(self, resource_group, storage_account):

0 commit comments

Comments
 (0)