Example #1
0
def _CommonArgs(parser):
    """Register flags for this command.

  Args:
    parser: argparse.ArgumentParser to register arguments with.

  """
    parser.add_argument('job_name',
                        metavar='JOB_NAME',
                        help='The unique name to assign to the job.')

    parser.add_argument(
        '--gcs-location',
        help=('The Google Cloud Storage location of the job template to run. '
              "(Must be a URL beginning with 'gs://'.)"),
        type=arg_parsers.RegexpValidator(r'^gs://.*',
                                         'Must begin with \'gs://\''),
        required=True)

    parser.add_argument(
        '--staging-location',
        help=('The Google Cloud Storage location to stage temporary files. '
              "(Must be a URL beginning with 'gs://'.)"),
        type=arg_parsers.RegexpValidator(r'^gs://.*',
                                         'Must begin with \'gs://\''))

    parser.add_argument('--zone',
                        type=arg_parsers.RegexpValidator(
                            r'\w+-\w+\d-\w', 'must provide a valid zone'),
                        help='The zone to run the workers in.')

    parser.add_argument('--service-account-email',
                        type=arg_parsers.RegexpValidator(
                            r'.*@.*\..*',
                            'must provide a valid email address'),
                        help='The service account to run the workers as.')

    parser.add_argument('--max-workers',
                        type=int,
                        help='The maximum number of workers to run.')

    parser.add_argument('--parameters',
                        metavar='PARAMETERS',
                        type=arg_parsers.ArgDict(),
                        action=arg_parsers.UpdateAction,
                        help='The parameters to pass to the job.')

    # TODO(b/139889563): Mark as required when default region is removed
    parser.add_argument(
        '--region',
        metavar='REGION_ID',
        help=('The region ID of the job\'s regional endpoint. ' +
              dataflow_util.DEFAULT_REGION_MESSAGE))

    parser.add_argument(
        '--disable-public-ips',
        action=actions.StoreBooleanProperty(
            properties.VALUES.dataflow.disable_public_ips),
        help='The Cloud Dataflow workers must not use public IP addresses.')

    parser.add_argument('--dataflow-kms-key',
                        help='The Cloud KMS key to protect the job resources.')
Example #2
0
    def Args(parser):
        """Register flags for this command.

    Args:
      parser: argparse.ArgumentParser to register arguments with.
    """
        parser.add_argument('job_name',
                            metavar='JOB_NAME',
                            help='Unique name to assign to the job.')

        parser.add_argument(
            '--template-file-gcs-location',
            help=('Google Cloud Storage location of the flex template to run. '
                  "(Must be a URL beginning with 'gs://'.)"),
            type=arg_parsers.RegexpValidator(r'^gs://.*',
                                             'Must begin with \'gs://\''),
            required=True)

        parser.add_argument(
            '--region',
            metavar='REGION_ID',
            help=('Region ID of the job\'s regional endpoint. ' +
                  dataflow_util.DEFAULT_REGION_MESSAGE))

        parser.add_argument(
            '--staging-location',
            help=('Google Cloud Storage location to stage temporary files. '
                  "(Must be a URL beginning with 'gs://'.)"),
            type=arg_parsers.RegexpValidator(r'^gs://.*',
                                             'Must begin with \'gs://\''))

        parser.add_argument('--service-account-email',
                            type=arg_parsers.RegexpValidator(
                                r'.*@.*\..*',
                                'must provide a valid email address'),
                            help='Service account to run the workers as.')

        parser.add_argument('--max-workers',
                            type=int,
                            help='Maximum number of workers to run.')

        parser.add_argument(
            '--disable-public-ips',
            action=actions.StoreBooleanProperty(
                properties.VALUES.dataflow.disable_public_ips),
            help='Cloud Dataflow workers must not use public IP addresses.')

        parser.add_argument('--num-workers',
                            type=int,
                            help='Initial number of workers to use.')

        parser.add_argument(
            '--worker-machine-type',
            help='Type of machine to use for workers. Defaults to '
            'server-specified.')

        parser.add_argument(
            '--subnetwork',
            help='Compute Engine subnetwork for launching instances '
            'to run your pipeline.')

        parser.add_argument(
            '--network',
            help='Compute Engine network for launching instances to '
            'run your pipeline.')

        parser.add_argument('--dataflow-kms-key',
                            help='Cloud KMS key to protect the job resources.')

        region_group = parser.add_mutually_exclusive_group()
        region_group.add_argument('--worker-region',
                                  help='Region to run the workers in.')

        region_group.add_argument('--worker-zone',
                                  help='Zone to run the workers in.')

        parser.add_argument(
            '--enable-streaming-engine',
            action=actions.StoreBooleanProperty(
                properties.VALUES.dataflow.enable_streaming_engine),
            help='Enabling Streaming Engine for the streaming job.')

        parser.add_argument(
            '--additional-experiments',
            metavar='ADDITIONAL_EXPERIMENTS',
            type=arg_parsers.ArgList(),
            help=('Additional experiments to pass to the job.'))

        parser.add_argument(
            '--additional-user-labels',
            metavar='ADDITIONAL_USER_LABELS',
            type=arg_parsers.ArgDict(),
            action=arg_parsers.UpdateAction,
            help=('Additional user labels to pass to the job.'))

        parser.add_argument('--parameters',
                            metavar='PARAMETERS',
                            type=arg_parsers.ArgDict(),
                            action=arg_parsers.UpdateAction,
                            help=('Parameters to pass to the job.'))
        streaming_update_args = parser.add_argument_group()
        streaming_update_args.add_argument(
            '--transform-name-mappings',
            metavar='TRANSFORM_NAME_MAPPINGS',
            type=arg_parsers.ArgDict(),
            action=arg_parsers.UpdateAction,
            help=('Transform name mappings for the streaming update job.'))

        streaming_update_args.add_argument(
            '--update',
            help=('Set this to true for streaming update jobs.'),
            action=arg_parsers.StoreTrueFalseAction,
            required=True)

        parser.add_argument('--flexrs-goal',
                            help=('FlexRS goal for the flex template job.'),
                            choices=['COST_OPTIMIZED', 'SPEED_OPTIMIZED'])
Example #3
0
  def __AddBuiltinGlobalFlags(self, top_element):
    """Adds in calliope builtin global flags.

    This needs to happen immediately after the top group is loaded and before
    any other groups are loaded.  The flags must be present so when sub groups
    are loaded, the flags propagate down.

    Args:
      top_element: backend._CommandCommon, The root of the command tree.
    """
    if self.__version_func is not None:
      top_element.ai.add_argument(
          '-v', '--version',
          do_not_propagate=True,
          category=calliope_base.COMMONLY_USED_FLAGS,
          action=actions.FunctionExitAction(self.__version_func),
          help='Print version information and exit. This flag is only available'
          ' at the global level.')

    configuration_flag = top_element.ai.add_argument(
        '--configuration',
        metavar='CONFIGURATION',
        category=calliope_base.COMMONLY_USED_FLAGS,
        help='The configuration to use for this command invocation.')
    configuration_flag.detailed_help = (
        'The configuration to use for this command invocation. For more '
        'information on how to use configurations, run:  '
        '`gcloud topic configurations`.  You can also use the [{0}] environment'
        ' variable to set the equivalent of this flag for a terminal session.'
        .format(config.CLOUDSDK_ACTIVE_CONFIG_NAME))

    top_element.ai.add_argument(
        '--verbosity',
        choices=log.OrderedVerbosityNames(),
        default=None,
        category=calliope_base.COMMONLY_USED_FLAGS,
        help=(
            'Override the default verbosity for this command.  This must be '
            'a standard logging verbosity level: [{values}] (Default: '
            '[{default}]).').format(
                values=', '.join(log.OrderedVerbosityNames()),
                default=log.DEFAULT_VERBOSITY_STRING),
        action=actions.StoreProperty(properties.VALUES.core.verbosity))

    # This should be a pure Boolean flag, but the alternate true/false explicit
    # value form is preserved for backwards compatibility. This flag and
    # is the only Cloud SDK outlier.
    # TODO(user): b/24095744: Add true/false deprecation message.
    top_element.ai.add_argument(
        '--user-output-enabled',
        metavar=' ',  # Help text will look like the flag does not have a value.
        nargs='?',
        default=None,  # Tri-valued, None => don't override the property.
        const='true',
        choices=('true', 'false'),
        action=actions.StoreBooleanProperty(
            properties.VALUES.core.user_output_enabled),
        help='Print user intended output to the console.')

    format_flag = top_element.ai.add_argument(
        '--format',
        default=None,
        category=calliope_base.COMMONLY_USED_FLAGS,
        help='The format for printing command output resources.')
    format_flag.detailed_help = """\
        Sets the format for printing command output resources. The default is a
        command-specific human-friendly output format. The supported formats
        are: `{0}`. For more details run $ gcloud topic formats.""".format(
            '`, `'.join(resource_printer.SupportedFormats()))

    top_element.ai.add_argument(
        '--log-http',
        default=None,  # Tri-valued, None => don't override the property.
        action=actions.StoreBooleanProperty(properties.VALUES.core.log_http),
        help='Log all HTTP server requests and responses to stderr.')

    top_element.ai.add_argument(
        '--authority-selector',
        default=None,
        action=actions.StoreProperty(properties.VALUES.auth.authority_selector),
        help=argparse.SUPPRESS)

    top_element.ai.add_argument(
        '--authorization-token-file',
        default=None,
        action=actions.StoreProperty(
            properties.VALUES.auth.authorization_token_file),
        help=argparse.SUPPRESS)

    top_element.ai.add_argument(
        '--credential-file-override',
        action=actions.StoreProperty(
            properties.VALUES.auth.credential_file_override),
        help=argparse.SUPPRESS)

    # Timeout value for HTTP requests.
    top_element.ai.add_argument(
        '--http-timeout',
        default=None,
        action=actions.StoreProperty(properties.VALUES.core.http_timeout),
        help=argparse.SUPPRESS)
Example #4
0
    def Args(parser):
        """Get arguments for this command.

    Args:
      parser: argparse.ArgumentParser, the parser for this command.
    """
        flags.SERVER_FLAG.AddToParser(parser)
        flags.IGNORE_CERTS_FLAG.AddToParser(parser)
        parser.add_argument(
            '--version',
            help=
            'The version of the app that will be created or replaced by this '
            'deployment.  If you do not specify a version, one will be generated '
            'for you.')
        parser.add_argument(
            '--force',
            action='store_true',
            help=('Force deploying, overriding any previous in-progress '
                  'deployments to this version.'))
        parser.add_argument(
            '--bucket',
            type=cloud_storage.GcsBucketArgument,
            help=
            ("The Google Cloud Storage bucket used to stage files associated "
             "with the deployment. If this argument is not specified, the "
             "application's default code bucket is used."))
        docker_build_group = parser.add_mutually_exclusive_group()
        docker_build_group.add_argument(
            '--docker-build',
            choices=['remote', 'local'],
            default=None,
            help=
            ("Perform a hosted ('remote') or local ('local') Docker build. To "
             "perform a local build, you must have your local docker "
             "environment configured correctly. The default is a hosted "
             "build."))
        deployables = parser.add_argument(
            'deployables',
            nargs='*',
            help='The yaml files for the services or configurations you want to '
            'deploy.')
        deployables.detailed_help = (
            'The yaml files for the services or configurations you want to deploy. '
            'If not given, defaults to `app.yaml` in the current directory. '
            'If that is not found, attempts to automatically generate necessary '
            'configuration files (such as app.yaml) in the current directory.')
        parser.add_argument('--repo-info-file',
                            metavar='filename',
                            help=argparse.SUPPRESS)
        unused_repo_info_file_help = (
            'The name of a file containing source context information for the '
            'services being deployed. If not specified, the source context '
            'information will be inferred from the directory containing the '
            'app.yaml file.')
        parser.add_argument(
            '--stop-previous-version',
            action='store_true',
            default=None,
            help=
            'Stop the previously running version when deploying a new version '
            'that receives all traffic (off by default).')
        parser.add_argument(
            '--image-url',
            help='Deploy with a specific Docker image.  Docker url must be '
            'from one of the valid gcr hostnames.')
        promote = parser.add_argument(
            '--promote',
            nargs=0,
            action=actions.StoreBooleanProperty(
                properties.VALUES.app.promote_by_default),
            help='Promote the deployed version to receive all traffic.')
        promote.detailed_help = (
            'Promote the deployed version to receive all traffic.\n\n'
            'True by default. To change the default behavior for your current '
            'environment, run:\n\n'
            '    $ gcloud config set app/promote_by_default false')
    def __AddBuiltinGlobalFlags(self, top_element):
        """Adds in calliope builtin global flags.

    This needs to happen immediately after the top group is loaded and before
    any other groups are loaded.  The flags must be present so when sub groups
    are loaded, the flags propagate down.

    Args:
      top_element: backend._CommandCommon, The root of the command tree.
    """
        calliope_base.FLAGS_FILE_FLAG.AddToParser(top_element.ai)
        calliope_base.FLATTEN_FLAG.AddToParser(top_element.ai)
        calliope_base.FORMAT_FLAG.AddToParser(top_element.ai)

        if self.__version_func is not None:
            top_element.ai.add_argument(
                '-v',
                '--version',
                do_not_propagate=True,
                category=calliope_base.COMMONLY_USED_FLAGS,
                action=actions.FunctionExitAction(self.__version_func),
                help=
                'Print version information and exit. This flag is only available'
                ' at the global level.')

        top_element.ai.add_argument('--configuration',
                                    metavar='CONFIGURATION',
                                    category=calliope_base.COMMONLY_USED_FLAGS,
                                    help="""\
        The configuration to use for this command invocation. For more
        information on how to use configurations, run:
        `gcloud topic configurations`.  You can also use the {0} environment
        variable to set the equivalent of this flag for a terminal
        session.""".format(config.CLOUDSDK_ACTIVE_CONFIG_NAME))

        top_element.ai.add_argument(
            '--verbosity',
            choices=log.OrderedVerbosityNames(),
            default=log.DEFAULT_VERBOSITY_STRING,
            category=calliope_base.COMMONLY_USED_FLAGS,
            help='Override the default verbosity for this command.',
            action=actions.StoreProperty(properties.VALUES.core.verbosity))

        # This should be a pure Boolean flag, but the alternate true/false explicit
        # value form is preserved for backwards compatibility. This flag and
        # is the only Cloud SDK outlier.
        # TODO(b/24095744): Add true/false deprecation message.
        top_element.ai.add_argument(
            '--user-output-enabled',
            metavar=
            ' ',  # Help text will look like the flag does not have a value.
            nargs='?',
            default=None,  # Tri-valued, None => don't override the property.
            const='true',
            choices=('true', 'false'),
            action=actions.StoreBooleanProperty(
                properties.VALUES.core.user_output_enabled),
            help='Print user intended output to the console.')

        top_element.ai.add_argument(
            '--log-http',
            default=None,  # Tri-valued, None => don't override the property.
            action=actions.StoreBooleanProperty(
                properties.VALUES.core.log_http),
            help='Log all HTTP server requests and responses to stderr.')

        top_element.ai.add_argument(
            '--authority-selector',
            default=None,
            action=actions.StoreProperty(
                properties.VALUES.auth.authority_selector),
            hidden=True,
            help='THIS ARGUMENT NEEDS HELP TEXT.')

        top_element.ai.add_argument(
            '--authorization-token-file',
            default=None,
            action=actions.StoreProperty(
                properties.VALUES.auth.authorization_token_file),
            hidden=True,
            help='THIS ARGUMENT NEEDS HELP TEXT.')

        top_element.ai.add_argument(
            '--credential-file-override',
            action=actions.StoreProperty(
                properties.VALUES.auth.credential_file_override),
            hidden=True,
            help='THIS ARGUMENT NEEDS HELP TEXT.')

        # Timeout value for HTTP requests.
        top_element.ai.add_argument('--http-timeout',
                                    default=None,
                                    action=actions.StoreProperty(
                                        properties.VALUES.core.http_timeout),
                                    hidden=True,
                                    help='THIS ARGUMENT NEEDS HELP TEXT.')

        # --flags-file source line number hook.
        FLAG_INTERNAL_FLAG_FILE_LINE.AddToParser(top_element.ai)
Example #6
0
    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.')
Example #7
0
def _CommonArgs(parser):
    """Register flags for this command.

  Args:
    parser: argparse.ArgumentParser to register arguments with.
  """
    image_args = parser.add_mutually_exclusive_group(required=True)
    image_building_args = image_args.add_argument_group()
    parser.add_argument(
        'template_file_gcs_path',
        metavar='TEMPLATE_FILE_GCS_PATH',
        help=('The Google Cloud Storage location of the flex template file.'
              'Overrides if file already exists.'),
        type=arg_parsers.RegexpValidator(r'^gs://.*',
                                         'Must begin with \'gs://\''))

    image_args.add_argument(
        '--image',
        help=('Path to the any image registry location of the prebuilt flex '
              'template image.'))

    parser.add_argument('--sdk-language',
                        help=('SDK language of the flex template job.'),
                        choices=['JAVA', 'PYTHON'],
                        required=True)

    parser.add_argument(
        '--metadata-file',
        help='Local path to the metadata json file for the flex template.',
        type=arg_parsers.FileContents())

    parser.add_argument(
        '--print-only',
        help=('Prints the container spec to stdout. Does not save in '
              'Google Cloud Storage.'),
        default=False,
        action=actions.StoreBooleanProperty(
            properties.VALUES.dataflow.print_only))

    image_building_args.add_argument(
        '--image-gcr-path',
        help=('The Google Container Registry location to store the flex '
              'template image to be built.'),
        type=arg_parsers.RegexpValidator(
            r'^(.*\.){0,1}gcr.io/.*',
            ('Must begin with \'[multi-region.]gcr.io/\'. Please check '
             'https://cloud.google.com/container-registry/docs/overview '
             'for available multi-regions')),
        required=True)

    image_building_args.add_argument(
        '--jar',
        metavar='JAR',
        type=arg_parsers.ArgList(),
        action=arg_parsers.UpdateAction,
        help=('Local path to your dataflow pipeline jar file and all their '
              'dependent jar files required for the flex template classpath. '
              'You can pass them as a comma separated list or repeat '
              'individually with --jar flag. Ex: --jar="code.jar,dep.jar" or '
              '--jar code.jar, --jar dep.jar.'),
        required=True)

    image_building_args.add_argument(
        '--flex-template-base-image',
        help=('Flex template base image to be used while building the '
              'container image. Allowed choices are JAVA8, JAVA11 or gcr.io '
              'path of the specific version of the base image. For JAVA8 and '
              'JAVA11 option, we use the latest base image version to build '
              'the container. You can also provide a specific version from '
              'this link  https://gcr.io/dataflow-templates-base/'),
        type=arg_parsers.RegexpValidator(
            r'^JAVA11$|^JAVA8$|^gcr.io/.*',
            'Must be JAVA11 or JAVA8 or begin with \'gcr.io/\''),
        required=True)

    image_building_args.add_argument(
        '--env',
        metavar='ENV',
        type=arg_parsers.ArgDict(),
        action=arg_parsers.UpdateAction,
        help=
        ('Environment variables to create for the Dockerfile. '
         'You can pass them as a comma separated list or repeat individually '
         'with --env flag. Ex: --env="A=B,C=D" or --env A=B, --env C=D.'
         'You can find the list of supported environment variables in this '
         'link. https://cloud.google.com/dataflow/docs/guides/templates/'
         'troubleshooting-flex-templates'
         '#setting_required_dockerfile_environment_variables'),
        required=True)
Example #8
0
    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.
        """)
        # 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.')
        trace_group.add_argument(
            '--capture-session-file',
            default=None,
            action=actions.StoreProperty(
                properties.VALUES.core.capture_session_file),
            hidden=True,
            help='THIS ARGUMENT NEEDS HELP TEXT.')
def ArgsDeploy(parser):
    """Get arguments for this command.

  Args:
    parser: argparse.ArgumentParser, the parser for this command.
  """
    flags.SERVER_FLAG.AddToParser(parser)
    flags.IGNORE_CERTS_FLAG.AddToParser(parser)
    flags.DOCKER_BUILD_FLAG.AddToParser(parser)
    flags.IGNORE_FILE_FLAG.AddToParser(parser)
    parser.add_argument(
        '--version',
        '-v',
        type=flags.VERSION_TYPE,
        help='The version of the app that will be created or replaced by this '
        'deployment.  If you do not specify a version, one will be generated for '
        'you.')
    parser.add_argument(
        '--bucket',
        type=storage_util.BucketReference.FromArgument,
        help=('The Google Cloud Storage bucket used to stage files associated '
              'with the deployment. If this argument is not specified, the '
              "application's default code bucket is used."))
    parser.add_argument('deployables',
                        nargs='*',
                        help="""\
      The yaml files for the services or configurations you want to deploy.
      If not given, defaults to `app.yaml` in the current directory.
      If that is not found, attempts to automatically generate necessary
      configuration files (such as app.yaml) in the current directory.""")
    parser.add_argument('--stop-previous-version',
                        action=actions.StoreBooleanProperty(
                            properties.VALUES.app.stop_previous_version),
                        help="""\
      Stop the previously running version when deploying a new version that
      receives all traffic.

      Note that if the version is running on an instance
      of an auto-scaled service in the App Engine Standard
      environment, using `--stop-previous-version` will not work
      and the previous version will continue to run because auto-scaled service
      instances are always running.""")
    parser.add_argument(
        '--image-url',
        help='(App Engine flexible environment only.) Deploy with a specific '
        'Docker image. Docker url must be from one of the valid Container '
        'Registry hostnames.')
    parser.add_argument(
        '--appyaml',
        help='Deploy with a specific app.yaml that will replace '
        'the one defined in the DEPLOYABLE.')
    parser.add_argument(
        '--promote',
        action=actions.StoreBooleanProperty(
            properties.VALUES.app.promote_by_default),
        help='Promote the deployed version to receive all traffic.')
    parser.add_argument(
        '--no-cache',
        action='store_true',
        default=False,
        help='Skip caching mechanisms involved in the deployment process, in '
        'particular do not use cached dependencies during the build step.')
    staging_group = parser.add_mutually_exclusive_group(hidden=True)
    staging_group.add_argument('--skip-staging',
                               action='store_true',
                               default=False,
                               help='THIS ARGUMENT NEEDS HELP TEXT.')
    staging_group.add_argument('--staging-command',
                               help='THIS ARGUMENT NEEDS HELP TEXT.')