-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy path_params.py
More file actions
56 lines (49 loc) · 4 KB
/
_params.py
File metadata and controls
56 lines (49 loc) · 4 KB
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
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long
def load_arguments(self, _):
from azure.cli.core.commands.parameters import get_enum_type, get_three_state_flag
from azure.cli.core.style import Theme
with self.argument_context('rest') as c:
c.argument('method', options_list=['--method', '-m'],
arg_type=get_enum_type(['head', 'get', 'put', 'post', 'delete', 'options', 'patch'], default='get'),
help='HTTP request method')
c.argument('url', options_list=['--url', '--uri', '-u'],
help='Request URL. If it doesn\'t start with a host, '
'CLI assumes it as an Azure resource ID and prefixes it with the ARM endpoint of the current '
'cloud shown by `az cloud show --query endpoints.resourceManager`. Common token '
'{subscriptionId} will be replaced with the current subscription ID specified by `az account '
'set`')
c.argument('headers', nargs='+',
help="Space-separated headers in KEY=VALUE format or JSON string. Use @{file} to load from a file")
c.argument('uri_parameters', options_list=['--uri-parameters', '--url-parameters'], nargs='+',
help='Query parameters in the URL. Space-separated queries in KEY=VALUE format or JSON string. '
'Use @{file} to load from a file')
c.argument('skip_authorization_header', action='store_true', help='Do not auto-append Authorization header')
c.argument('body', options_list=['--body', '-b'],
help='Request body. Use @{file} to load from a file. For quoting issues in different terminals, '
'see https://github.com/Azure/azure-cli/blob/dev/doc/use_cli_effectively.md#quoting-issues')
c.argument('output_file', help='save response payload to a file')
c.argument('resource',
help='Resource url for which CLI should acquire a token from Microsoft Entra ID in order to access '
'the service. Using --scope is preferred.')
c.argument('scopes', options_list=['--scope'], nargs='+',
help='Scopes for which CLI should acquire a token from Microsoft Entra ID in order to access '
'the service. The token will be placed in the Authorization header. By default, '
'CLI can figure this out based on --url argument, unless you use ones not in the list '
'of "az cloud show --query endpoints"')
with self.argument_context('upgrade') as c:
c.argument('update_all', options_list=['--all'], arg_type=get_three_state_flag(), help='Enable updating extensions as well.', default='true')
c.argument('yes', options_list=['--yes', '-y'], action='store_true', help='Do not prompt for checking release notes.')
c.argument('allow_preview', options_list=['--allow-preview-extensions', '--allow-preview'],
arg_type=get_three_state_flag(), help="Include preview packages for extension installation, if exists")
with self.argument_context('demo style') as c:
c.argument('theme', arg_type=get_enum_type(Theme),
help='The theme to format styled text. If unspecified, the default theme is used.')
with self.argument_context('demo secret-store save') as c:
c.positional('key_value', nargs='+', help="Space-separated data: <key>=<value> [<key>=<value> ...]")
with self.argument_context('demo byo-access-token') as c:
c.argument('access_token', help="Your own access token")
c.argument('subscription_id', help="Subscription ID under which to list resource groups")