/
_help.py
320 lines (278 loc) · 14.2 KB
/
_help.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# coding=utf-8
# --------------------------------------------------------------------------------------------
# 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 # pylint: disable=unused-import
# pylint: disable=line-too-long, too-many-lines
helps['redis'] = """
type: group
short-summary: Manage dedicated Redis caches for your Azure applications.
"""
helps['redis create'] = """
type: command
short-summary: Create new Redis Cache instance.
parameters:
- name: --redis-configuration
short-summary: A json file used to set redis-configuration settings. You may encounter parse errors if the json file is invalid.
long-summary: |
Usage: --redis-configuration @"{config_file.json}"
An example json file for configuring max-memory policies
[
{
"maxmemory-policy": "allkeys-lru"
}
]
An example json file for enabling the RDB back up data persistence is
[
{
"rdb-storage-connection-string": "DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=myAccountKey;EndpointSuffix=core.windows.net",
"rdb-backup-enabled": "true",
"rdb-backup-frequency": "15",
"rdb-backup-max-snapshot-count": "1"
}
]
An example json file for enabling the AOF back up data persistence is
[
{
"aof-backup-enabled": "true",
"aof-storage-connection-string-0": "DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=myAccountKey;EndpointSuffix=core.windows.net",
"aof-storage-connection-string-1": "DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=myAccountKey;EndpointSuffix=core.windows.net"
}
]
The content for a json file for configuring Microsoft Entra Authentication is
{
"aad-enabled": "true",
}
examples:
- name: Create new Redis Cache instance. (autogenerated)
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Basic --vm-size c0
crafted: true
- name: Configure the multiple zones for new Premium Azure Cache for Redis
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --zones 1 2
crafted: true
- name: Configure the memory policies for the cache.
text: az redis create --resource-group resourceGroupName --name cacheName --location westus2 --sku Standard --vm-size c0 --redis-configuration @"config_max-memory.json"
crafted: true
- name: Configure and enable the RDB back up data persistence for new Premium Azure Cache for Redis.
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --redis-configuration @"config_rdb.json"
crafted: true
- name: Configure and enable the AOF back up data persistence for new Premium Azure Cache for Redis
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --redis-configuration @"config_aof.json"
crafted: true
- name: Create a Premium Azure Cache for Redis with clustering enabled
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --shard-count 2
crafted: true
- name: Deploying a Premium Azure Cache for Redis inside an existing Azure Virtual Network
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --subnet-id "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/Microsoft.{Network|ClassicNetwork}/virtualNetworks/vnet1/subnets/subnet1"
crafted: true
- name: Deploying a Premium Azure Cache for Redis with Microsoft Entra Authentication configured
text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --redis-configuration @"config_enable-aad.json"
"""
helps['redis export'] = """
type: command
short-summary: Export data stored in a Redis cache.
examples:
- name: Use managed identity to export cache data
text: az redis export -n testCacheName -g testResourceGroup --prefix examplePrefix --container containerUrl --preferred-data-archive-auth-method ManagedIdentity --storage-subscription-id 1a6574ss-ddad-1111-a111-8d756312d1dd
crafted: true
"""
helps['redis firewall-rules'] = """
type: group
short-summary: Manage Redis firewall rules.
"""
helps['redis firewall-rules create'] = """
type: command
short-summary: Create a redis cache firewall rule.
long-summary: Usage example - az redis firewall-rules create --name testCacheName --resource-group testResourceGroup --start-ip 10.10.10.10 --end-ip 20.20.20.20 --rule-name 10to20
"""
helps['redis firewall-rules update'] = """
type: command
short-summary: Update a redis cache firewall rule.
"""
helps['redis import'] = """
type: command
short-summary: Import data into a Redis cache.
examples:
- name: Use managed identity to import cache data
text: az redis import -n testCacheName -g testResourceGroup --files blobUrl --preferred-data-archive-auth-method ManagedIdentity --storage-subscription-id 1a6574ss-ddad-1111-a111-8d756312d1dd
crafted: true
"""
helps['redis list'] = """
type: command
short-summary: List Redis Caches.
long-summary: Lists details about all caches within current Subscription or provided Resource Group.
"""
helps['redis flush'] = """
type: command
short-summary: Delete all of the keys in a cache.
"""
helps['redis patch-schedule'] = """
type: group
short-summary: Manage Redis patch schedules.
"""
helps['redis patch-schedule create'] = """
type: command
short-summary: Create patching schedule for Redis cache.
long-summary: Usage example - az redis patch-schedule create --name testCacheName --resource-group testResourceGroup --schedule-entries '[{"dayOfWeek":"Tuesday","startHourUtc":"00","maintenanceWindow":"PT5H"}]'
"""
helps['redis patch-schedule update'] = """
type: command
short-summary: Update the patching schedule for Redis cache.
long-summary: Usage example - az redis patch-schedule update --name testCacheName --resource-group testResourceGroup --schedule-entries '[{"dayOfWeek":"Tuesday","startHourUtc":"00","maintenanceWindow":"PT5H"}]'
"""
helps['redis server-link'] = """
type: group
short-summary: Manage Redis server links.
"""
helps['redis server-link create'] = """
type: command
short-summary: Adds a server link to the Redis cache (requires Premium SKU).
long-summary: Usage example - az redis server-link create --name testCacheName --resource-group testResourceGroup --cache-to-link secondTestCacheName --replication-role Secondary
"""
helps['redis update'] = """
type: command
short-summary: Update a Redis cache.
long-summary: Scale or update settings of a Redis cache.
examples:
- name: Update the maxmemory-policy for your Azure Cache for Redis named MyRedisCache
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set "redisConfiguration.maxmemory-policy"="allkeys-lru"
crafted: true
- name: Disable the RDB back up data persistence for Premium Azure Cache for Redis
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set "redisConfiguration.rdb-backup-enabled"="false"
crafted: true
- name: Configure the RDB back up enabled data persistence for already created Premium Azure Cache for Redis
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set "redisConfiguration.rdb-storage-connection-string"="BlobEndpoint=https//..." "redisConfiguration.rdb-backup-enabled"="true" "redisConfiguration.rdb-backup-frequency"="15" "redisConfiguration.rdb-backup-max-snapshot-count"="1"
crafted: true
- name: Scale an Azure Cache for Redis Instance - Update to different size (An example to scale from c0 to c1).
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set "sku.capacity"="2"
crafted: true
- name: Scale an Azure Cache for Redis Instance - Update to different tier (From Basic to Standard or Standard to Premium).
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set "sku.name"="Premium" "sku.capacity"="1" "sku.family"="P"
crafted: true
- name: Scale an Azure Cache for Redis Instance - Enable Clustering.
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set shardCount=1
crafted: true
- name: Scale an Azure Cache for Redis Instance in/out using Redis Cluster.
text: az redis update --name MyRedisCache --resource-group MyResourceGroup --set shardCount=2
crafted: true
"""
helps['redis force-reboot'] = """
type: command
short-summary: Reboot specified Redis node(s).
long-summary: Usage example - az redis force-reboot --name testCacheName --resource-group testResourceGroup --reboot-type {AllNodes, PrimaryNode, SecondaryNode} [--shard-id]
"""
helps['redis import-method'] = """
type: command
short-summary: Import data into Redis cache.
long-summary: Usage example - az redis import-method --name testCacheName --resource-group testResourceGroup --files [--file-format]
"""
helps['redis patch-schedule delete'] = """
type: command
short-summary: Deletes the patching schedule of a redis cache.
long-summary: Usage example - az redis patch-schedule delete --name testCacheName --resource-group testResourceGroup
"""
helps['redis patch-schedule show'] = """
type: command
short-summary: Gets the patching schedule of a redis cache.
long-summary: Usage example - az redis patch-schedule show --name testCacheName --resource-group testResourceGroup [--query-examples]
"""
helps['redis regenerate-keys'] = """
type: command
short-summary: Regenerate Redis cache's access keys.
long-summary: Usage example - az redis regenerate-keys --name testCacheName --resource-group testResourceGroup --key-type {Primary, Secondary}
"""
helps['redis identity'] = """
type: group
short-summary: Manage identity assigned to Azure cache for Redis.
"""
helps['redis identity assign'] = """
type: command
short-summary: Assign identity for Azure cache for Redis.
"""
helps['redis identity remove'] = """
type: command
short-summary: Remove the identity already assigned for Azure cache for Redis.
"""
helps['redis identity show'] = """
type: command
short-summary: Show the identity assigned for Azure cache for Redis.
"""
helps['redis access-policy'] = """
type: group
short-summary: Manage Access Policies for Redis Cache
"""
helps['redis access-policy create'] = """
type: command
short-summary: Add an Access Policy to the Redis Cache
examples:
- name: Create a custom Access Policy with the given permissions
text: az redis access-policy create -g testResourceGroup -n testCacheName --access-policy-name testAccessPolicy --permissions "+get +hget"
"""
helps['redis access-policy update'] = """
type: command
short-summary: Update an Access Policy of the Redis Cache
examples:
- name: Update the permissions of the custom Access Policy
text: az redis access-policy update -g testResourceGroup -n testCacheName --access-policy-name testAccessPolicy --permissions "+get"
"""
helps['redis access-policy delete'] = """
type: command
short-summary: Delete the Access Policy
examples:
- name: Delete the custom Access Policy
text: az redis access-policy delete -g testResourceGroup -n testCacheName --access-policy-name testAccessPolicy
"""
helps['redis access-policy show'] = """
type: command
short-summary: Get the detailed information about an Access Policy of the Redis Cache
examples:
- name: Show the permissions of the custom Access Policy
text: az redis access-policy show -g testResourceGroup -n testCacheName --access-policy-name testAccessPolicy
"""
helps['redis access-policy list'] = """
type: command
short-summary: Get the list of Access Policies associated with the Redis Cache
examples:
- name: List the Access Policies of the Redis Cache
text: az redis access-policy list -g testResourceGroup -n testCacheName
"""
helps['redis access-policy-assignment'] = """
type: group
short-summary: Manage Access Policy Assignments (Redis Users) for Redis Cache
"""
helps['redis access-policy-assignment create'] = """
type: command
short-summary: Add an Access Policy Assignment (Redis User) to the Redis Cache
examples:
- name: Configure Redis User for role based access control
text: az redis access-policy-assignment create -g testResourceGroup -n testCacheName --object-id 932b5c60-66e4-4fbf-b8b0-xxxxxxxxxxxx --object-id-alias testAlias --access-policy-name testAccessPolicy --policy-assignment-name testAccessPolicyAssignment
"""
helps['redis access-policy-assignment update'] = """
type: command
short-summary: Update an Access Policy Assignment (Redis User) of the Redis Cache
examples:
- name: Update Redis User for role based access control
text: az redis access-policy-assignment update -g testResourceGroup -n testCacheName --object-id 932b5c60-66e4-4fbf-b8b0-xxxxxxxxxxxx --object-id-alias testAlias --access-policy-name testAccessPolicy --policy-assignment-name testAccessPolicyAssignment
"""
helps['redis access-policy-assignment delete'] = """
type: command
short-summary: Delete the Access Policy Assignment (Redis User)
examples:
- name: Delete the Redis User
text: az redis access-policy-assignment delete -g testResourceGroup -n testCacheName --policy-assignment-name testAccessPolicyAssignment
"""
helps['redis access-policy-assignment show'] = """
type: command
short-summary: Get the detailed information about an Access Policy Assignment (Redis User) of the Redis Cache
examples:
- name: Get the Object Id, Object Id Alias and Access Policy assigned to the Redis User
text: az redis access-policy-assignment show -g testResourceGroup -n testCacheName --policy-assignment-name testAccessPolicyAssignment
"""
helps['redis access-policy-assignment list'] = """
type: command
short-summary: Get the list of Access Policy Assignments (Redis Users) associated with the Redis Cache
examples:
- name: List the Redis Users of the Redis Cache
text: az redis access-policy-assignment list -g testResourceGroup -n testCacheName
"""