HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/396/lib/googlecloudsdk/command_lib/source_manager/flags.py
# -*- coding: utf-8 -*- #
# Copyright 2022 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Flag helpers for the source-manager commands."""

from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

from googlecloudsdk.calliope import arg_parsers


def AddAllowMissing(
    parser,
    help_text="If set to true, and the resource is not found, the request will succeed but no action will be taken on the server.",
):
  parser.add_argument(
      "--allow-missing",
      dest="allow_missing",
      required=False,
      default=False,
      help=help_text,
      action="store_true",
  )


def AddValidateOnly(
    parser,
    help_text=(
        "If set to true, the request is validated and the user is provided with"
        " an expected result, but no actual change is made."
    ),
):
  parser.add_argument(
      "--validate-only",
      dest="validate_only",
      action="store_true",
      required=False,
      help=help_text,
  )


def AddInstance(
    parser,
    help_text="A Secure Source Manager instance ID.",
):
  parser.add_argument(
      "--instance", dest="instance", required=True, help=help_text
  )


def AddDescription(
    parser,
    help_text="Description of the repository. Cannot exceed 500 characters.",
):
  parser.add_argument(
      "--description", dest="description", required=False, help=help_text
  )


def AddInitialConfigGroup(
    parser, help_text="Repository initialization configuration."
):
  """Add flags for initial config."""
  group = parser.add_group(required=False, help=help_text)
  group.add_argument(
      "--default-branch",
      dest="default_branch",
      required=False,
      help="Default branch name of the repository.",
  )
  group.add_argument(
      "--gitignores",
      dest="gitignores",
      metavar="GITIGNORES",
      type=arg_parsers.ArgList(),
      required=False,
      default=[],
      help=(
          "List of gitignore template names user can choose from. Full list can"
          " be found here:"
          " https://cloud.google.com/secure-source-manager/docs/reference/rest/v1/projects.locations.repositories#InitialConfig"
      ),
  )
  group.add_argument(
      "--license",
      dest="license",
      required=False,
      help=(
          "License template name user can choose from. Full list can be found"
          " here:"
          " https://cloud.google.com/secure-source-manager/docs/reference/rest/v1/projects.locations.repositories#InitialConfig"
      ),
  )
  group.add_argument(
      "--readme",
      dest="readme",
      required=False,
      help="README template name. Valid template name(s) are: default.",
  )


def AddKmsKey(parser, help_text="KMS key used to encrypt instance optionally."):
  parser.add_argument(
      "--kms-key", dest="kms_key", required=False, help=help_text
  )


def AddMaxWait(
    parser,
    default_max_wait,
    help_text="Time to synchronously wait for the operation to complete, after which the operation continues asynchronously. Ignored if `--no-async` isn't specified. See $ gcloud topic datetimes for information on time formats.",
):
  parser.add_argument(
      "--max-wait",
      dest="max_wait",
      required=False,
      default=default_max_wait,
      help=help_text,
      type=arg_parsers.Duration(),
  )


def AddPrivateConfigGroup(parser, help_text="Private instance configuration."):
  """Add flags for private config."""
  group = parser.add_group(required=False, help=help_text)
  group.add_argument(
      "--is-private",
      dest="is_private",
      # Disables autogeneration of the inverted --no-is-private flag.
      action="store_const",
      const=True,
      required=True,
      help="Bool indicator for private instance.",
  )
  group.add_argument(
      "--ca-pool",
      dest="ca_pool",
      required=False,
      help="CA Pool path for private instance.",
  )
  group.add_argument(
      "--psc-allowed-projects",
      dest="psc_allowed_projects",
      required=False,
      metavar="PROJECTS",
      type=arg_parsers.ArgList(),
      help=(
          "List of additional projects allowed to connect to the instance via"
          " private service connect."
      ),
  )


def AddEnableWorkforceIdentityFederation(
    parser,
    help_text="Bool indicator for workforce identity federation instance.",
):
  parser.add_argument(
      "--enable-workforce-identity-federation",
      dest="enable_workforce_identity_federation",
      action="store_true",
      required=False,
      help=help_text,
  )