def Args(parser): project_arg = parser.add_argument( '--project', metavar='PROJECT_ID', dest='project', help='Google Cloud Platform project ID to use for this invocation.', action=actions.StoreProperty(properties.VALUES.core.project)) project_arg.detailed_help = """\ The Google Cloud Platform project name to use for this invocation. If omitted then the current project is assumed. """ # Must have a None default so properties are not always overridden when the # arg is not provided. quiet_arg = parser.add_argument( '--quiet', '-q', default=None, help='Disable all interactive prompts.', action=actions.StoreConstProperty( properties.VALUES.core.disable_prompts, True)) quiet_arg.detailed_help = """\ Disable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised. """ trace_group = parser.add_mutually_exclusive_group() trace_group.add_argument( '--trace-token', default=None, help= 'Token used to route traces of service requests for investigation' ' of issues.')
def Args(parser): parser.add_argument( '--account', metavar='ACCOUNT', category=base.COMMONLY_USED_FLAGS, help='Google Cloud Platform user account to use for invocation.', action=actions.StoreProperty(properties.VALUES.core.account)) parser.add_argument( '--project', metavar='PROJECT_ID', dest='project', category=base.COMMONLY_USED_FLAGS, suggestion_aliases=['--application'], completer=resource_manager_completers.ProjectCompleter, action=actions.StoreProperty(properties.VALUES.core.project), help="""\ The Google Cloud Platform project name to use for this invocation. If omitted, then the current project is assumed; the current project can be listed using `gcloud config list --format='text(core.project)'` and can be set using `gcloud config set project PROJECTID`. """) # Must have a None default so properties are not always overridden when the # arg is not provided. parser.add_argument('--quiet', '-q', default=None, category=base.COMMONLY_USED_FLAGS, action=actions.StoreConstProperty( properties.VALUES.core.disable_prompts, True), help="""\ Disable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised. Overrides the default core/disable_prompts property value for this command invocation. Must be used at the beginning of commands. This is equivalent to setting the environment variable `CLOUDSDK_CORE_DISABLE_PROMPTS` to 1. """) trace_group = parser.add_mutually_exclusive_group() trace_group.add_argument( '--trace-token', default=None, action=actions.StoreProperty(properties.VALUES.core.trace_token), help= 'Token used to route traces of service requests for investigation' ' of issues.') trace_group.add_argument('--trace-email', metavar='USERNAME', default=None, action=actions.StoreProperty( properties.VALUES.core.trace_email), hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.') trace_group.add_argument('--trace-log', default=None, action=actions.StoreBooleanProperty( properties.VALUES.core.trace_log), hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.')
def Args(parser): parser.add_argument( '--account', metavar='ACCOUNT', category=base.COMMONLY_USED_FLAGS, help='Google Cloud Platform user account to use for invocation.', action=actions.StoreProperty(properties.VALUES.core.account)) project_arg = parser.add_argument( '--project', metavar='PROJECT_ID', dest='project', category=base.COMMONLY_USED_FLAGS, suggestion_aliases=['--application'], completion_resource='cloudresourcemanager.projects', list_command_path='beta.projects', help='Google Cloud Platform project ID to use for this invocation.', action=actions.StoreProperty(properties.VALUES.core.project)) project_arg.detailed_help = """\ The Google Cloud Platform project name to use for this invocation. If omitted then the current project is assumed. """ # Must have a None default so properties are not always overridden when the # arg is not provided. quiet_arg = parser.add_argument( '--quiet', '-q', default=None, category=base.COMMONLY_USED_FLAGS, help='Disable all interactive prompts.', action=actions.StoreConstProperty( properties.VALUES.core.disable_prompts, True)) quiet_arg.detailed_help = """\ Disable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised. """ trace_group = parser.add_mutually_exclusive_group() trace_group.add_argument( '--trace-token', default=None, action=actions.StoreProperty(properties.VALUES.core.trace_token), help= 'Token used to route traces of service requests for investigation' ' of issues.') trace_group.add_argument('--trace-email', metavar='USERNAME', default=None, action=actions.StoreProperty( properties.VALUES.core.trace_email), help=argparse.SUPPRESS) trace_group.add_argument('--trace-log', default=None, action=actions.StoreBooleanProperty( properties.VALUES.core.trace_log), help=argparse.SUPPRESS)
def ParseArgs(): """Parse args for the installer, so interactive prompts can be avoided.""" def Bool(s): return s.lower() in ['true', '1'] parser = argparse.ArgumentParser() parser.add_argument('--usage-reporting', default=None, type=Bool, help='(true/false) Disable anonymous usage reporting.') parser.add_argument('--rc-path', help='Profile to update with PATH and completion.') parser.add_argument( '--command-completion', '--bash-completion', default=None, type=Bool, help=('(true/false) Add a line for command completion in' ' the profile.')) parser.add_argument( '--path-update', default=None, type=Bool, help=('(true/false) Add a line for path updating in the' ' profile.')) parser.add_argument('--disable-installation-options', action='store_true', help='DEPRECATED. This flag is no longer used.') parser.add_argument( '--override-components', nargs='*', help='Override the components that would be installed by ' 'default and install these instead.') parser.add_argument( '--additional-components', nargs='+', help='Additional components to install by default. These' ' components will either be added to the default install ' 'list, or to the override-components (if provided).') # Must have a None default so properties are not always overridden when the # arg is not provided. parser.add_argument('--quiet', '-q', default=None, action=actions.StoreConstProperty( properties.VALUES.core.disable_prompts, True), help='Disable all interactive prompts. If input is ' 'required, defaults will be used or an error will be ' 'raised') return parser.parse_args()
def Args(parser): parser.add_argument( '--account', metavar='ACCOUNT', category=base.COMMONLY_USED_FLAGS, help='Google Cloud Platform user account to use for invocation.', action=actions.StoreProperty(properties.VALUES.core.account)) # Ideally this would be on the alpha group (since it's alpha) but there are # a bunch of problems with doing that. Global flags are treated differently # than other flags and flags on the Alpha group are not treated as global. # The result is that the flag shows up on every man page as if it was part # of the individual command (which is undesirable and breaks every surface # spec). parser.add_argument( '--impersonate-service-account', metavar='SERVICE_ACCOUNT_EMAIL', hidden=True, help='(ALPHA) For this gcloud invocation, all API requests will be ' 'made as the given service account instead of the currently ' 'selected account. This is done without needing to create, ' 'download, and activate a key for the account. In order to ' 'perform operations as the service account, your currently ' 'selected account must have an IAM role that includes the ' 'iam.serviceAccounts.getAccessToken permission for the service ' 'account. The roles/iam.serviceAccountTokenCreator role has ' 'this permission or you may create a custom role.', action=actions.StoreProperty( properties.VALUES.auth.impersonate_service_account)) parser.add_argument( '--project', metavar='PROJECT_ID', dest='project', category=base.COMMONLY_USED_FLAGS, suggestion_aliases=['--application'], completer=resource_manager_completers.ProjectCompleter, action=actions.StoreProperty(properties.VALUES.core.project), help="""\ The Google Cloud Platform project name to use for this invocation. If omitted, then the current project is assumed; the current project can be listed using `gcloud config list --format='text(core.project)'` and can be set using `gcloud config set project PROJECTID`. """) # Must have a None default so properties are not always overridden when the # arg is not provided. parser.add_argument('--quiet', '-q', default=None, category=base.COMMONLY_USED_FLAGS, action=actions.StoreConstProperty( properties.VALUES.core.disable_prompts, True), help="""\ Disable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised. Overrides the default core/disable_prompts property value for this command invocation. Must be used at the beginning of commands. This is equivalent to setting the environment variable `CLOUDSDK_CORE_DISABLE_PROMPTS` to 1. """) trace_group = parser.add_mutually_exclusive_group() trace_group.add_argument( '--trace-token', default=None, action=actions.StoreProperty(properties.VALUES.core.trace_token), help= 'Token used to route traces of service requests for investigation' ' of issues.') trace_group.add_argument('--trace-email', metavar='USERNAME', default=None, action=actions.StoreProperty( properties.VALUES.core.trace_email), hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.') trace_group.add_argument('--trace-log', default=None, action=actions.StoreBooleanProperty( properties.VALUES.core.trace_log), hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.')
def ParseArgs(): """Parse args for the installer, so interactive prompts can be avoided.""" def Bool(s): return s.lower() in ['true', '1'] parser = argparse.ArgumentParser() parser.add_argument('--usage-reporting', default=None, type=Bool, help='(true/false) Enable anonymous usage reporting.') parser.add_argument('--screen-reader', default=None, type=Bool, help='(true/false) Enable screen reader mode.') parser.add_argument( '--rc-path', help=('Profile to update with PATH and completion. If' ' given without --command-completion or' ' --path-update in "quiet" mode, a line will be' ' added to this profile for both command completion' ' and path updating.')) parser.add_argument( '--command-completion', '--bash-completion', default=None, type=Bool, help=('(true/false) Add a line for command completion in' ' the profile. In "quiet" mode, if True and you do' ' not provide--rc-path, the default profile' ' will be updated.')) parser.add_argument( '--path-update', default=None, type=Bool, help=('(true/false) Add a line for path updating in the' ' profile. In "quiet" mode, if True and you do not' ' provide --rc-path, the default profile will be' ' updated.')) parser.add_argument('--disable-installation-options', action='store_true', help='DEPRECATED. This flag is no longer used.') parser.add_argument( '--override-components', nargs='*', help='Override the components that would be installed by ' 'default and install these instead.') parser.add_argument( '--additional-components', nargs='+', help='Additional components to install by default. These' ' components will either be added to the default install ' 'list, or to the override-components (if provided).') # Must have a None default so properties are not always overridden when the # arg is not provided. parser.add_argument('--quiet', '-q', default=None, action=actions.StoreConstProperty( properties.VALUES.core.disable_prompts, True), help='Disable all interactive prompts. If input is ' 'required, defaults will be used or an error will be ' 'raised') parser.add_argument( '--install-python', default=True, type=Bool, help='(true/false) Attempt to install Python. MacOs only.') return parser.parse_args(bootstrapping.GetDecodedArgv()[1:])
def Args(parser): parser.add_argument( '--account', metavar='ACCOUNT', category=base.COMMONLY_USED_FLAGS, help='Google Cloud Platform user account to use for invocation.', action=actions.StoreProperty(properties.VALUES.core.account)) # Ideally this would be on the alpha group (since it's alpha) but there are # a bunch of problems with doing that. Global flags are treated differently # than other flags and flags on the Alpha group are not treated as global. # The result is that the flag shows up on every man page as if it was part # of the individual command (which is undesirable and breaks every surface # spec). parser.add_argument( '--impersonate-service-account', metavar='SERVICE_ACCOUNT_EMAIL', help='For this gcloud invocation, all API requests will be ' 'made as the given service account instead of the currently ' 'selected account. This is done without needing to create, ' 'download, and activate a key for the account. In order to ' 'perform operations as the service account, your currently ' 'selected account must have an IAM role that includes the ' 'iam.serviceAccounts.getAccessToken permission for the service ' 'account. The roles/iam.serviceAccountTokenCreator role has ' 'this permission or you may create a custom role.', action=actions.StoreProperty( properties.VALUES.auth.impersonate_service_account)) common_args.ProjectArgument().AddToParser(parser) parser.add_argument( '--billing-project', metavar='BILLING_PROJECT', category=base.COMMONLY_USED_FLAGS, help= 'The Google Cloud Platform project that will be charged quota for ' 'operations performed in gcloud. If you need to operate on one ' 'project, but need quota against a different project, you can use ' 'this flag to specify the billing project. If both ' '`billing/quota_project` and `--billing-project` are specified, ' '`--billing-project` takes precedence. ' 'Run `$ gcloud config set --help` to see more information about ' '`billing/quota_project`.', action=actions.StoreProperty( properties.VALUES.billing.quota_project)) # Must have a None default so properties are not always overridden when the # arg is not provided. parser.add_argument('--quiet', '-q', default=None, category=base.COMMONLY_USED_FLAGS, action=actions.StoreConstProperty( properties.VALUES.core.disable_prompts, True), help="""\ Disable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised. Overrides the default core/disable_prompts property value for this command invocation. Must be used at the beginning of commands. This is equivalent to setting the environment variable `CLOUDSDK_CORE_DISABLE_PROMPTS` to 1. """) trace_group = parser.add_mutually_exclusive_group() trace_group.add_argument( '--trace-token', default=None, action=actions.StoreProperty(properties.VALUES.core.trace_token), help= 'Token used to route traces of service requests for investigation' ' of issues.') trace_group.add_argument('--trace-email', metavar='USERNAME', default=None, action=actions.StoreProperty( properties.VALUES.core.trace_email), hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.') trace_group.add_argument('--trace-log', default=None, action=actions.StoreBooleanProperty( properties.VALUES.core.trace_log), hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.')
def Args(parser): parser.add_argument( '--account', metavar='ACCOUNT', category=base.COMMONLY_USED_FLAGS, help='Google Cloud user account to use for invocation.', action=actions.StoreProperty(properties.VALUES.core.account)) # Ideally this would be on the alpha group (since it's alpha) but there are # a bunch of problems with doing that. Global flags are treated differently # than other flags and flags on the Alpha group are not treated as global. # The result is that the flag shows up on every man page as if it was part # of the individual command (which is undesirable and breaks every surface # spec). parser.add_argument( '--impersonate-service-account', metavar='SERVICE_ACCOUNT_EMAILS', help="""\ For this `gcloud` invocation, all API requests will be made as the given service account or target service account in an impersonation delegation chain instead of the currently selected account. You can specify either a single service account as the impersonator, or a comma-separated list of service accounts to create an impersonation delegation chain. The impersonation is done without needing to create, download, and activate a key for the service account or accounts. In order to make API requests as a service account, your currently selected account must have an IAM role that includes the `iam.serviceAccounts.getAccessToken` permission for the service account or accounts. The `roles/iam.serviceAccountTokenCreator` role has the `iam.serviceAccounts.getAccessToken permission`. You can also create a custom role. You can specify a list of service accounts, separated with commas. This creates an impersonation delegation chain in which each service account delegates its permissions to the next service account in the chain. Each service account in the list must have the `roles/iam.serviceAccountTokenCreator` role on the next service account in the list. For example, when `--impersonate-service-account=` ``SERVICE_ACCOUNT_1'',``SERVICE_ACCOUNT_2'', the active account must have the `roles/iam.serviceAccountTokenCreator` role on ``SERVICE_ACCOUNT_1'', which must have the `roles/iam.serviceAccountTokenCreator` role on ``SERVICE_ACCOUNT_2''. ``SERVICE_ACCOUNT_1'' is the impersonated service account and ``SERVICE_ACCOUNT_2'' is the delegate. """, action=actions.StoreProperty( properties.VALUES.auth.impersonate_service_account)) parser.add_argument('--access-token-file', metavar='ACCESS_TOKEN_FILE', help="""\ A file path to read the access token. Use this flag to authenticate `gcloud` with an access token. The credentials of the active account (if exists) will be ignored. The file should only contain an access token with no other information. """, action=actions.StoreProperty( properties.VALUES.auth.access_token_file)) common_args.ProjectArgument().AddToParser(parser) parser.add_argument('--billing-project', metavar='BILLING_PROJECT', category=base.COMMONLY_USED_FLAGS, help="""\ The Google Cloud project that will be charged quota for operations performed in `gcloud`. If you need to operate on one project, but need quota against a different project, you can use this flag to specify the billing project. If both `billing/quota_project` and `--billing-project` are specified, `--billing-project` takes precedence. Run `$ gcloud config set --help` to see more information about `billing/quota_project`. """, action=actions.StoreProperty( properties.VALUES.billing.quota_project)) # Must have a None default so properties are not always overridden when the # arg is not provided. parser.add_argument('--quiet', '-q', default=None, category=base.COMMONLY_USED_FLAGS, action=actions.StoreConstProperty( properties.VALUES.core.disable_prompts, True), help="""\ Disable all interactive prompts when running `gcloud` commands. If input is required, defaults will be used, or an error will be raised. Overrides the default core/disable_prompts property value for this command invocation. This is equivalent to setting the environment variable `CLOUDSDK_CORE_DISABLE_PROMPTS` to 1. """) trace_group = parser.add_mutually_exclusive_group() trace_group.add_argument( '--trace-token', default=None, action=actions.StoreProperty(properties.VALUES.core.trace_token), help= 'Token used to route traces of service requests for investigation' ' of issues.') trace_group.add_argument('--trace-email', metavar='USERNAME', default=None, action=actions.StoreProperty( properties.VALUES.core.trace_email), hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.') trace_group.add_argument('--trace-log', default=None, action=actions.StoreBooleanProperty( properties.VALUES.core.trace_log), hidden=True, help='THIS ARGUMENT NEEDS HELP TEXT.')