|
11 | 11 | resource_group_name_type, |
12 | 12 | get_location_type |
13 | 13 | ) |
14 | | -from ._validators import process_container_resource, transfer_cache_name |
| 14 | +from ._validators import process_container_resource, JunctionAddAction, validate_storage_account_name_or_id |
| 15 | +from knack.arguments import CLIArgumentType |
15 | 16 |
|
| 17 | +junction_type = CLIArgumentType(options_list=['--junction'], |
| 18 | + help='List of Cache namespace junctions to target for namespace associations.' |
| 19 | + 'The sub parameters contains: ' |
| 20 | + '(1) --namespace-path: Namespace path on a Cache for a Storage Target ' |
| 21 | + '(2) --nfs-export: NFS export where targetPath exists ' |
| 22 | + '(3) --target-path(Optional): Path in Storage Target to ' |
| 23 | + 'which namespacePath points', |
| 24 | + action=JunctionAddAction, nargs='+') |
16 | 25 |
|
17 | | -def load_arguments(self, _): |
| 26 | +storage_account_type = CLIArgumentType(options_list=['--storage-account'], |
| 27 | + help='Resource ID or Name of target storage account.', |
| 28 | + validator=validate_storage_account_name_or_id) |
| 29 | + |
| 30 | +cache_name_type = CLIArgumentType(help='Name of Cache.') |
| 31 | + |
| 32 | +storage_target_type = CLIArgumentType(help='Name of the Storage Target.') |
18 | 33 |
|
19 | | - with self.argument_context('hpc-cache skus list') as c: |
20 | | - pass |
21 | 34 |
|
22 | | - with self.argument_context('hpc-cache usage-model list') as c: |
23 | | - pass |
| 35 | +def load_arguments(self, _): |
24 | 36 |
|
25 | 37 | with self.argument_context('hpc-cache create') as c: |
26 | | - c.argument('resource_group_name', resource_group_name_type) |
27 | | - c.argument('name', help='Name of Cache.', required=True) |
| 38 | + c.argument('name', cache_name_type, required=True) |
28 | 39 | c.argument('tags', tags_type) |
29 | 40 | c.argument('location', arg_type=get_location_type(self.cli_ctx), required=True) |
30 | 41 | c.argument('cache_size_gb', help='The size of this Cache, in GB.', required=True) |
31 | 42 | c.argument('subnet', help='Subnet used for the Cache.', required=True) |
32 | 43 | c.argument('sku_name', help='SKU name for this Cache.', required=True) |
33 | 44 |
|
34 | 45 | with self.argument_context('hpc-cache update') as c: |
35 | | - c.argument('resource_group_name', resource_group_name_type) |
36 | | - c.argument('name', help='Name of Cache.') |
| 46 | + c.argument('name', cache_name_type) |
37 | 47 | c.argument('tags', tags_type) |
38 | | - c.argument('location', arg_type=get_location_type(self.cli_ctx)) |
39 | | - c.argument('cache_size_gb', help='The size of this Cache, in GB.') |
40 | | - c.argument('subnet', help='Subnet used for the Cache.') |
41 | | - c.argument('sku_name', help='SKU name for this Cache.') |
42 | | - |
43 | | - with self.argument_context('hpc-cache delete') as c: |
44 | | - c.argument('resource_group_name', resource_group_name_type) |
45 | | - c.argument('name', help='Name of Cache.') |
| 48 | + c.argument('location', arg_type=get_location_type(self.cli_ctx), deprecate_info=c.deprecate(hide=True)) |
| 49 | + c.argument('cache_size_gb', help='The size of this Cache, in GB.', deprecate_info=c.deprecate(hide=True)) |
| 50 | + c.argument('subnet', help='Subnet used for the Cache.', deprecate_info=c.deprecate(hide=True)) |
| 51 | + c.argument('sku_name', help='SKU name for this Cache.', deprecate_info=c.deprecate(hide=True)) |
46 | 52 |
|
47 | | - with self.argument_context('hpc-cache show') as c: |
48 | | - c.argument('resource_group_name', resource_group_name_type) |
49 | | - c.argument('name', help='Name of Cache.') |
| 53 | + for item in ['delete', 'show', 'flush', 'start', 'stop', 'upgrade-firmware']: |
| 54 | + with self.argument_context('hpc-cache {}'.format(item)) as c: |
| 55 | + c.argument('name', cache_name_type) |
50 | 56 |
|
51 | 57 | with self.argument_context('hpc-cache wait') as c: |
52 | | - c.argument('resource_group_name', resource_group_name_type) |
53 | | - c.extra('name', help='Name of Cache.', validator=transfer_cache_name, required=True) |
54 | | - c.ignore('cache_name') |
55 | | - |
56 | | - with self.argument_context('hpc-cache list') as c: |
57 | | - c.argument('resource_group_name', resource_group_name_type, required=False) |
58 | | - |
59 | | - with self.argument_context('hpc-cache flush') as c: |
60 | | - c.argument('resource_group_name', resource_group_name_type) |
61 | | - c.argument('name', help='Name of Cache.') |
62 | | - |
63 | | - with self.argument_context('hpc-cache start') as c: |
64 | | - c.argument('resource_group_name', resource_group_name_type) |
65 | | - c.argument('name', help='Name of Cache.') |
66 | | - |
67 | | - with self.argument_context('hpc-cache stop') as c: |
68 | | - c.argument('resource_group_name', resource_group_name_type) |
69 | | - c.argument('name', help='Name of Cache.') |
70 | | - |
71 | | - with self.argument_context('hpc-cache upgrade-firmware') as c: |
72 | | - c.argument('resource_group_name', resource_group_name_type) |
73 | | - c.argument('name', help='Name of Cache.') |
| 58 | + c.argument('cache_name', cache_name_type, options_list=['--name', '-n'], required=True) |
74 | 59 |
|
75 | 60 | with self.argument_context('hpc-cache blob-storage-target add') as c: |
76 | | - c.argument('resource_group_name', resource_group_name_type) |
77 | | - c.argument('cache_name', help='Name of Cache.') |
78 | | - c.argument('name', help='Name of the Storage Target.') |
| 61 | + c.argument('cache_name', cache_name_type) |
| 62 | + c.argument('name', storage_target_type) |
79 | 63 | c.argument('virtual_namespace_path', options_list=['--virtual-namespace-path', '-v'], required=True, |
80 | 64 | help='Path to create for this storage target in the client-facing virtual filesystem.') |
81 | | - c.extra('storage_account', options_list=['--storage-account'], help='Resource ID of target storage account.', |
82 | | - required=True) |
| 65 | + c.extra('storage_account', storage_account_type, required=True) |
83 | 66 | c.extra('container_name', options_list=['--container-name'], validator=process_container_resource, |
84 | 67 | required=True, help='Name of target storage container.') |
85 | 68 | c.ignore('clfs_target') |
86 | 69 |
|
87 | 70 | with self.argument_context('hpc-cache blob-storage-target update') as c: |
88 | | - c.argument('resource_group_name', resource_group_name_type) |
89 | | - c.argument('cache_name', help='Name of Cache.') |
90 | | - c.argument('name', help='Name of the Storage Target.') |
| 71 | + c.argument('cache_name', cache_name_type) |
| 72 | + c.argument('name', storage_target_type) |
91 | 73 | c.argument('virtual_namespace_path', options_list=['--virtual-namespace-path', '-v'], |
92 | 74 | help='Path to create for this storage target in the client-facing virtual filesystem.') |
93 | | - c.extra('storage_account', options_list=['--storage-account'], |
94 | | - help='Resource ID of target storage account.') |
| 75 | + c.extra('storage_account', storage_account_type) |
95 | 76 | c.extra('container_name', options_list=['--container-name'], validator=process_container_resource, |
96 | 77 | help='Name of target storage container.') |
97 | 78 | c.ignore('clfs_target') |
98 | 79 |
|
99 | 80 | with self.argument_context('hpc-cache storage-target remove') as c: |
100 | | - c.argument('resource_group_name', resource_group_name_type) |
101 | | - c.argument('cache_name', help='Name of Cache.') |
102 | | - c.argument('name', help='Name of the Storage Target.') |
| 81 | + c.argument('cache_name', cache_name_type) |
| 82 | + c.argument('name', storage_target_type) |
103 | 83 |
|
104 | 84 | with self.argument_context('hpc-cache storage-target show') as c: |
105 | | - c.argument('resource_group_name', resource_group_name_type) |
106 | | - c.argument('cache_name', help='Name of Cache.') |
107 | | - c.argument('name', help='Name of the Storage Target.') |
| 85 | + c.argument('cache_name', cache_name_type) |
| 86 | + c.argument('name', storage_target_type) |
108 | 87 |
|
109 | 88 | with self.argument_context('hpc-cache storage-target list') as c: |
110 | | - c.argument('resource_group_name', resource_group_name_type) |
111 | | - c.argument('cache_name', help='Name of Cache.') |
| 89 | + c.argument('cache_name', cache_name_type) |
112 | 90 |
|
113 | 91 | with self.argument_context('hpc-cache nfs-storage-target add') as c: |
114 | | - c.argument('resource_group_name', resource_group_name_type) |
115 | | - c.argument('cache_name', help='Name of Cache.') |
116 | | - c.argument('name', help='Name of the Storage Target.') |
117 | | - from ._validators import JunctionAddAction |
118 | | - c.extra('junction', help='List of Cache namespace junctions to target for namespace associations.', |
119 | | - action=JunctionAddAction, nargs='+', required=True) |
| 92 | + c.argument('cache_name', cache_name_type) |
| 93 | + c.argument('name', storage_target_type) |
| 94 | + |
| 95 | + c.argument('junctions', junction_type, required=True) |
120 | 96 | c.argument('nfs3_target', help='IP address or host name of an NFSv3 host (e.g., 10.0.44.44).', required=True) |
121 | 97 | c.argument('nfs3_usage_model', help='Identifies the primary usage model to be used for this Storage Target.', |
122 | 98 | required=True) |
123 | | - c.ignore('junctions') |
124 | 99 |
|
125 | 100 | with self.argument_context('hpc-cache nfs-storage-target update') as c: |
126 | | - c.argument('resource_group_name', resource_group_name_type) |
127 | | - c.argument('cache_name', help='Name of Cache.') |
128 | | - c.argument('name', help='Name of the Storage Target.') |
129 | | - from ._validators import JunctionAddAction |
130 | | - c.extra('junction', help='List of Cache namespace junctions to target for namespace associations.', action=JunctionAddAction, nargs='+') |
| 101 | + c.argument('cache_name', cache_name_type) |
| 102 | + c.argument('name', storage_target_type) |
| 103 | + c.argument('junctions', junction_type) |
131 | 104 | c.argument('nfs3_target', help='IP address or host name of an NFSv3 host (e.g., 10.0.44.44).') |
132 | 105 | c.argument('nfs3_usage_model', help='Identifies the primary usage model to be used for this Storage Target.') |
133 | | - c.ignore('junctions') |
0 commit comments