def scrub_type_specific_properties()

in tools/genconfig/genconfig.py [0:0]


def scrub_type_specific_properties(props):
  """Scrubs fields that are unique to certain types."""

  # TargetPool specific stuff.
  props.pop('instances', None)

  # ForwardingRule specific stuff.
  props.pop('IPAddress', None)

  # IGM specific stuff.
  props.pop('currentActions', None)
  props.pop('instanceGroup', None)
  props.pop('autoscaler', None)

  # Instance specific stuff.
  props.pop('cpuPlatform', None)
  props.pop('labelFingerprint', None)

  # Clear all IP assignments from network interfaces. Especially in
  # accessConfigs, where it is assumed there is a static IP address with the
  # given IP if assigned.
  if 'networkInterfaces' in props:
    for i in props['networkInterfaces']:
      i.pop('networkIP', None)
      if 'accessConfigs' in i:
        for ac in i['accessConfigs']:
          # This currently cannot support user-provided static IP, only allows
          # for ephemeral.
          ac.pop('natIP', None)