(context, zone_dict)
return resource
Generate one autoscaled_group resource Dict with a passed zone.
Generate one autoscaled_group resource Dict with a passed zone.
Generate one autoscaled_group resource Dict with a passed zone .
def GenerateAutscaledGroup(context, zone_dict):
  """Generate one autoscaled_group resource Dict with a passed zone."""
  name = context.env['name']
  project = context.env[PROJECT]
  prop = context.properties
  zone = zone_dict[default.ZONE]
  zone_abbrv = common.ShortenZoneName(zone)
  as_name = common.AutoName(name, default.AUTOSCALER, zone_abbrv)
  base_name = name + '-' + default.AKA[default.INSTANCE]
  igm_name = common.AutoName(name, default.IGM, zone_abbrv)
  max_num = zone_dict[MAX_NUM]
  project = context.env[default.PROJECT]
  size = zone_dict[SIZE]
  vm_template = prop[VM_TEMPLATE]

  # pyformat: disable
  resource = [
      {
          'name': igm_name,
          'type': default.IGM,
          'properties': {
              'project': project,
              'zone': zone,
              'targetSize': size,
              'baseInstanceName': base_name,
              'instanceTemplate': vm_template
          }
      }, {
          'name': as_name,
          'type': default.AUTOSCALER,
          'properties': {
              'project': project,
              'zone': zone,
              'target': common.Ref(igm_name),
              'autoscalingPolicy': {
                  'maxNumReplicas': max_num
              }
          }
      }
  ]
  # pyformat: enable
  return resource
def GenerateAutscaledGroup ( context , zone_dict ) : name = context . env [ 'name' ] project = context . env [ PROJECT ] prop = context . properties zone = zone_dict [ default . ZONE ] zone_abbrv = common . ShortenZoneName ( zone ) as_name = common . AutoName ( name , default . AUTOSCALER , zone_abbrv ) base_name = name + '-' + default . AKA [ default . INSTANCE ] igm_name = common . AutoName ( name , default . IGM , zone_abbrv ) max_num = zone_dict [ MAX_NUM ] project = context . env [ default . PROJECT ] size = zone_dict [ SIZE ] vm_template = prop [ VM_TEMPLATE ] # pyformat: disable resource = [ { 'name' : igm_name , 'type' : default . IGM , 'properties' : { 'project' : project , 'zone' : zone , 'targetSize' : size , 'baseInstanceName' : base_name , 'instanceTemplate' : vm_template } } , { 'name' : as_name , 'type' : default . AUTOSCALER , 'properties' : { 'project' : project , 'zone' : zone , 'target' : common . Ref ( igm_name ) , 'autoscalingPolicy' : { 'maxNumReplicas' : max_num } } } ] # pyformat: enable return resource