コード例 #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(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