コード例 #1
0
def _Args(parser, support_global_access, support_l7_internal_load_balancing):
    """Add the flags to create a forwarding rule."""

    flags.AddUpdateArgs(
        parser,
        include_l7_internal_load_balancing=support_l7_internal_load_balancing)
    flags.AddIPProtocols(parser)
    flags.AddDescription(parser)
    flags.AddPortsAndPortRange(parser)
    flags.AddNetworkTier(parser,
                         supports_network_tier_flag=True,
                         for_update=False)

    if support_global_access:
        flags.AddAllowGlobalAccess(parser)

    flags.AddIsMirroringCollector(parser)

    parser.add_argument(
        '--service-label',
        help='(Only for Internal Load Balancing): '
        'https://cloud.google.com/compute/docs/load-balancing/internal/\n'
        'The DNS label to use as the prefix of the fully qualified domain '
        'name for this forwarding rule. The full name will be internally '
        'generated and output as dnsName. If this field is not specified, '
        'no DNS record will be generated and no DNS name will be output. ')
    flags.AddAddressesAndIPVersions(
        parser,
        required=False,
        include_l7_internal_load_balancing=support_l7_internal_load_balancing)
    forwarding_rule_arg = flags.ForwardingRuleArgument()
    forwarding_rule_arg.AddArgument(parser, operation_type='create')
    parser.display_info.AddCacheUpdater(flags.ForwardingRulesCompleter)
    return forwarding_rule_arg
コード例 #2
0
 def Args(cls, parser, include_l7_internal_load_balancing):
   """Adds flags to set the target of a forwarding rule."""
   cls.FORWARDING_RULE_ARG = flags.ForwardingRuleArgument()
   flags.AddUpdateArgs(
       parser,
       include_l7_internal_load_balancing=include_l7_internal_load_balancing)
   cls.FORWARDING_RULE_ARG.AddArgument(parser)
コード例 #3
0
def _Args(parser,
          include_beta,
          include_alpha=False,
          support_flex_port=False,
          support_global_access=False):
    """Argument parsing."""
    flags.AddUpdateArgs(parser,
                        include_beta=include_beta,
                        include_alpha=include_alpha)
    flags.AddIPProtocols(parser)
    flags.AddDescription(parser)
    flags.AddPortsAndPortRange(parser, supports_flex_port=support_flex_port)
    flags.AddNetworkTier(parser,
                         supports_network_tier_flag=True,
                         for_update=False)

    if support_global_access:
        flags.AddAllowGlobalAccess(parser)

    if include_beta:
        parser.add_argument(
            '--service-label',
            help='(Only for Internal Load Balancing): '
            'https://cloud.google.com/compute/docs/load-balancing/internal/\n'
            'The DNS label to use as the prefix of the fully qualified domain '
            'name for this forwarding rule. The full name will be internally '
            'generated and output as dnsName. If this field is not specified, '
            'no DNS record will be generated and no DNS name will be output. ')
コード例 #4
0
ファイル: create.py プロジェクト: TobiahRex/Wingman
def _Args(parser, include_alpha_targets, include_beta_targets):
  """Argument parsing."""
  flags.AddCommonFlags(parser)
  flags.AddUpdateArgs(parser, include_alpha_targets, include_beta_targets)

  address = parser.add_argument(
      '--address',
      help='The external IP address that the forwarding rule will serve.')
  address.detailed_help = """\
      The external IP address that the forwarding rule will
      serve. All traffic sent to this IP address is directed to the
      target pointed to by the forwarding rule. If the address is
      reserved, it must either (1) reside in the global scope if the
      forwarding rule is being configured to point to a target HTTP
      proxy or (2) reside in the same region as the forwarding rule
      if the forwarding rule is being configured to point to a
      target pool or target instance. If this flag is omitted, an
      ephemeral IP address is assigned.
      """
  v1_messages = core_apis.GetMessagesModule('compute', 'v1')
  ip_protocol = parser.add_argument(
      '--ip-protocol',
      choices=_SupportedProtocols(v1_messages),
      type=lambda x: x.upper(),
      help='The IP protocol that the rule will serve.')
  ip_protocol.detailed_help = """\
      The IP protocol that the rule will serve. If left empty, TCP
      is used. Supported protocols are: {0}.
      """.format(', '.join(_SupportedProtocols(v1_messages)))

  parser.add_argument(
      '--description',
      help='An optional textual description for the forwarding rule.')

  ports_scope = parser.add_mutually_exclusive_group()
  ports = ports_scope.add_argument(
      '--ports',
      metavar='[PORT | PORT-PORT]',
      help=('If specified, only packets addressed to the ports or '
            'port ranges will be forwarded.'),
      type=arg_parsers.ArgList(
          min_length=1, element_type=arg_parsers.Range.Parse),
      default=[])

  ports.detailed_help = """\
          If specified, only packets addressed to ports in the specified
          list will be forwarded. If not specified for regional forwarding
          rules, all ports are matched. This flag is required for global
          forwarding rules and accepts a single continuous set of ports.

          Individual ports and ranges can be specified,
          for example (`--ports 8000-8004` or `--ports 80`).
          """
  port_range = ports_scope.add_argument(
      '--port-range',
      type=arg_parsers.Range.Parse,
      help='DEPRECATED, use --ports. If specified, only packets addressed to '
           'the port or ports in the specified range will be forwarded.',
      metavar='[PORT | PORT-PORT]')
  port_range.detailed_help = """\
コード例 #5
0
def _Args(parser, include_beta, include_alpha=False):
    """Argument parsing."""
    flags.AddCommonFlags(parser)
    flags.AddUpdateArgs(parser, include_beta=include_beta)
    flags.AddAddress(parser)
    flags.AddIPProtocols(parser, include_alpha=include_alpha)
    flags.AddDescription(parser)
    flags.AddPortsAndPortRange(parser)
コード例 #6
0
def _Args(parser, support_global_access, support_psc_global_access,
          support_l7_internal_load_balancing, support_psc_google_apis,
          support_all_protocol, support_target_service_attachment,
          support_l3_default, support_source_ip_range,
          support_disable_automate_dns_zone, support_regional_tcp_proxy):
  """Add the flags to create a forwarding rule."""

  flags.AddUpdateArgs(
      parser,
      include_l7_internal_load_balancing=support_l7_internal_load_balancing,
      include_psc_google_apis=support_psc_google_apis,
      include_target_service_attachment=support_target_service_attachment,
      include_regional_tcp_proxy=support_regional_tcp_proxy)
  flags.AddIPProtocols(parser, support_all_protocol, support_l3_default)
  flags.AddDescription(parser)
  flags.AddPortsAndPortRange(parser)
  flags.AddNetworkTier(
      parser, supports_network_tier_flag=True, for_update=False)

  if support_global_access:
    flags.AddAllowGlobalAccess(parser)

  if support_psc_global_access:
    flags.AddAllowPscGlobalAccess(parser)

  if support_source_ip_range:
    flags.AddSourceIpRanges(parser)

  if support_disable_automate_dns_zone:
    flags.AddDisableAutomateDnsZone(parser)

  flags.AddIsMirroringCollector(parser)
  flags.AddServiceDirectoryRegistration(parser)

  parser.add_argument(
      '--service-label',
      help='(Only for Internal Load Balancing): '
      'https://cloud.google.com/load-balancing/docs/dns-names/\n'
      'The DNS label to use as the prefix of the fully qualified domain '
      'name for this forwarding rule. The full name will be internally '
      'generated and output as dnsName. If this field is not specified, '
      'no DNS record will be generated and no DNS name will be output. '
      'You cannot use the `--service-label` flag  if the forwarding rule '
      'references an internal IP address that has the '
      '`--purpose=SHARED_LOADBALANCER_VIP` flag set.')
  flags.AddAddressesAndIPVersions(
      parser,
      required=False,
      include_l7_internal_load_balancing=support_l7_internal_load_balancing)
  forwarding_rule_arg = flags.ForwardingRuleArgument()
  forwarding_rule_arg.AddArgument(parser, operation_type='create')
  parser.display_info.AddCacheUpdater(flags.ForwardingRulesCompleter)
  return forwarding_rule_arg
コード例 #7
0
def _Args(parser, include_beta, include_alpha=False):
    """Argument parsing."""
    flags.AddUpdateArgs(parser, include_beta=include_beta)
    flags.ADDRESS_ARG.AddArgument(parser)
    flags.AddIPProtocols(parser)
    flags.AddDescription(parser)
    flags.AddPortsAndPortRange(parser)
    if include_alpha:
        parser.add_argument(
            '--service-label',
            help='(Only for Internal Load Balancing): '
            'https://cloud.google.com/compute/docs/load-balancing/internal/\n'
            'The DNS label to use as the prefix of the fully qualified domain '
            'name for this forwarding rule. The full name will be internally '
            'generated and output as dnsName. If this field is not specified, '
            'no DNS record will be generated and no DNS name will be output. ')
コード例 #8
0
ファイル: create.py プロジェクト: bopopescu/SDK
def _Args(parser, include_alpha_targets):
    """Argument parsing."""
    flags.AddCommonFlags(parser)
    flags.AddUpdateArgs(parser, include_alpha_targets)

    address = parser.add_argument(
        '--address',
        help='The external IP address that the forwarding rule will serve.')
    address.detailed_help = """\
      The external IP address that the forwarding rule will
      serve. All traffic sent to this IP address is directed to the
      target pointed to by the forwarding rule. If the address is
      reserved, it must either (1) reside in the global scope if the
      forwarding rule is being configured to point to a target HTTP
      proxy or (2) reside in the same region as the forwarding rule
      if the forwarding rule is being configured to point to a
      target pool or target instance. If this flag is omitted, an
      ephemeral IP address is assigned.
      """
    v1_messages = core_apis.GetMessagesModule('compute', 'v1')
    ip_protocol = parser.add_argument(
        '--ip-protocol',
        choices=_SupportedProtocols(v1_messages),
        type=lambda x: x.upper(),
        help='The IP protocol that the rule will serve.')
    ip_protocol.detailed_help = """\
      The IP protocol that the rule will serve. If left empty, TCP
      is used. Supported protocols are: {0}.
      """.format(', '.join(_SupportedProtocols(v1_messages)))

    parser.add_argument(
        '--description',
        help='An optional textual description for the forwarding rule.')

    port_range = parser.add_argument(
        '--port-range',
        help=('If specified, only packets addressed to the port or '
              'ports in the specified range will be forwarded.'),
        metavar='[PORT | PORT-PORT]')
    port_range.detailed_help = """\
コード例 #9
0
 def Args(cls, parser):
     cls.FORWARDING_RULE_ARG = flags.ForwardingRuleArgument()
     flags.AddUpdateArgs(parser, include_beta=True)
     cls.FORWARDING_RULE_ARG.AddArgument(parser)
コード例 #10
0
ファイル: set_target.py プロジェクト: TobiahRex/Wingman
 def Args(parser):
   flags.AddCommonFlags(parser)
   flags.AddUpdateArgs(parser,
                       include_alpha_targets=True,
                       include_beta_targets=True)
コード例 #11
0
 def Args(parser):
     flags.AddCommonFlags(parser)
     flags.AddUpdateArgs(parser, include_beta=True)
コード例 #12
0
 def Args(parser):
     flags.AddCommonFlags(parser)
     flags.AddUpdateArgs(parser, include_alpha_targets=False)