403Webshell
Server IP : 34.67.85.211  /  Your IP : 216.73.217.52
Web Server : Apache
System : Linux wordpress-1-vm 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
User : root ( 0)
PHP Version : 7.4.9
Disable Function : 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,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/google-cloud-sdk/lib/googlecloudsdk/command_lib/code/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/google-cloud-sdk/lib/googlecloudsdk/command_lib/code/flags.py
# -*- coding: utf-8 -*- #
# Copyright 2019 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.
"""Flags for serverless local development setup."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

from googlecloudsdk.calliope import actions
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.command_lib.util.args import map_util
from googlecloudsdk.core import exceptions
import six


def CommonFlags(parser):
  """Add common flags for local developement environments."""
  builder_group = parser.add_mutually_exclusive_group(required=False)
  builder_group.add_argument(
      '--dockerfile',
      default='Dockerfile',
      help='Dockerfile for the service image.')

  builder_group.add_argument(
      '--builder',
      help='Build with a given Cloud Native Computing Foundation Buildpack '
      'builder.')

  builder_group.add_argument(
      '--appengine',
      action='store_true',
      default=False,
      help='Build with a Cloud Native Computing Foundation Buildpack builder '
      'selected from gcr.io/gae-runtimes/buildpacks, according to the App '
      'Engine runtime specified in app.yaml.')

  parser.add_argument(
      '--service-name', required=False, help='Name of the service.')

  parser.add_argument(
      '--image', required=False, help='Name for the built image.')

  parser.add_argument(
      '--source',
      help='The directory containing the source to build. '
      'If not specified, the current directory is used.')

  credential_group = parser.add_mutually_exclusive_group(required=False)
  credential_group.add_argument(
      '--service-account',
      help='When connecting to Google Cloud Platform services, use a service '
      'account key.')

  credential_group.add_argument(
      '--application-default-credential',
      action='store_true',
      default=False,
      help='When connecting to Google Cloud Platform services, use the '
      'application default credential.')

  parser.add_argument(
      '--local-port',
      type=int,
      help='Local port to which the service connection is forwarded. If this '
      'flag is not set, then a random port is chosen.')

  parser.add_argument(
      '--cloudsql-instances',
      type=arg_parsers.ArgList(),
      metavar='CLOUDSQL_INSTANCE',
      help='Cloud SQL instance connection strings. Must be in the form '
      '<project>:<region>:<instance>.')

  parser.add_argument(
      '--cpu',
      type=arg_parsers.BoundedFloat(lower_bound=0.0),
      help='Container CPU limit. Limit is expressed as a number of CPUs. '
      'Fractional CPU limits are allowed (e.g. 1.5).')

  parser.add_argument(
      '--memory',
      type=arg_parsers.BinarySize(default_unit='B'),
      help='Container memory limit. Limit is expressed either as an integer '
      'representing the number of bytes or an integer followed by a unit '
      'suffix. Valid unit suffixes are "B", "KB", "MB", "GB", "TB", "KiB", '
      '"MiB", "GiB", "TiB", or "PiB".')

  env_var_group = parser.add_mutually_exclusive_group(required=False)
  env_var_group.add_argument(
      '--env-vars',
      metavar='KEY=VALUE',
      action=arg_parsers.UpdateAction,
      type=arg_parsers.ArgDict(
          key_type=six.text_type, value_type=six.text_type),
      help='List of key-value pairs to set as environment variables.')

  env_var_group.add_argument(
      '--env-vars-file',
      metavar='FILE_PATH',
      type=map_util.ArgDictFile(
          key_type=six.text_type, value_type=six.text_type),
      help='Path to a local YAML file with definitions for all environment '
      'variables.')

  # TODO(b/161154732): The following flags are deprecated and should be kept at
  # the bottom. They have the same dest at the replacement flags, and
  # moving them above their replacements may remove the new flags from the
  # help text.

  parser.add_argument(
      '--image-name',
      required=False,
      help='Name for the built docker image.',
      dest='image',
      action=actions.DeprecationAction(
          '--image-name',
          warn='The {flag_name} option is deprecated; use --image instead.',
          removed=False,
      ))

  parser.add_argument(
      '--cpu-limit',
      type=arg_parsers.BoundedFloat(lower_bound=0.0),
      help='Container CPU limit. Limit is expressed as a number of CPUs. '
      'Fractional CPU limits are allowed (e.g. 1.5).',
      dest='cpu',
      action=actions.DeprecationAction(
          '--cpu-limit',
          warn='The {flag_name} option is deprecated; use --cpu instead.',
          removed=False,
      ))

  parser.add_argument(
      '--memory-limit',
      type=arg_parsers.BinarySize(default_unit='B'),
      help='Container memory limit. Limit is expressed either as an integer '
      'representing the number of bytes or an integer followed by a unit '
      'suffix. Valid unit suffixes are "B", "KB", "MB", "GB", "TB", "KiB", '
      '"MiB", "GiB", "TiB", or "PiB".',
      dest='memory',
      action=actions.DeprecationAction(
          '--memory-limit',
          warn='The {flag_name} option is deprecated; use --memory instead.',
          removed=False,
      ))

  parser.add_argument(
      '--build-context-directory',
      help='If set, use this as the context directory when building the '
      'container image. If not specified, the current directory is used.',
      dest='source',
      action=actions.DeprecationAction(
          '--build-context-directory',
          warn='The {flag_name} option is deprecated; use --source instead.',
          removed=False,
      ))


class InvalidFlagError(exceptions.Error):
  """Flag settings are illegal."""


def Validate(namespace):
  """Validate flag requirements that cannot be handled by argparse."""
  if ('cloudsql_instances' in namespace and
      namespace.IsSpecified('cloudsql_instances') and
      not (namespace.IsSpecified('service_account') or
           namespace.IsSpecified('application_default_credential'))):
    raise InvalidFlagError('--cloudsql-instances requires --service-account or '
                           '--application-default-credential to be specified.')

Youez - 2016 - github.com/yon3zu
LinuXploit