(context)
return config
Generates config.
Generates config.
Generates config .
def GenerateConfig(context):
  """Generates config."""

  lb_name = context.env['deployment'] + '-lb'
  region = context.properties['zones'][0]['zone'][:-2]

  config = {'resources': []}

  # A zonal service.py resource for each zone in the properties list.
  for deploy_zone in context.properties['zones']:
    zone_name = deploy_zone['zone']

    properties = {
        'currVersion': deploy_zone['curr'],
        'targetPool': lb_name + '-tp',
        'minSize': context.properties['minSize'],
        'maxSize': context.properties['maxSize'],
        'machineType': context.properties['machineType'],
        'zone': zone_name
    }

    service = {
        'name': context.env['deployment'] + '-service-' + zone_name,
        'type': 'service.py',
        'properties': properties
    }

    config['resources'].append(service)

  # A L3 load balancer setup for the HA service.
  lb = {
      'name': lb_name,
      'type': 'lb-l3.py',
      'properties': {
          'port': 8080,
          'region': region
      }
  }

  config['resources'].append(lb)

  return config
def GenerateConfig ( context ) : lb_name = context . env [ 'deployment' ] + '-lb' region = context . properties [ 'zones' ] [ 0 ] [ 'zone' ] [ : - 2 ] config = { 'resources' : [ ] } # A zonal service.py resource for each zone in the properties list. for deploy_zone in context . properties [ 'zones' ] : zone_name = deploy_zone [ 'zone' ] properties = { 'currVersion' : deploy_zone [ 'curr' ] , 'targetPool' : lb_name + '-tp' , 'minSize' : context . properties [ 'minSize' ] , 'maxSize' : context . properties [ 'maxSize' ] , 'machineType' : context . properties [ 'machineType' ] , 'zone' : zone_name } service = { 'name' : context . env [ 'deployment' ] + '-service-' + zone_name , 'type' : 'service.py' , 'properties' : properties } config [ 'resources' ] . append ( service ) # A L3 load balancer setup for the HA service. lb = { 'name' : lb_name , 'type' : 'lb-l3.py' , 'properties' : { 'port' : 8080 , 'region' : region } } config [ 'resources' ] . append ( lb ) return config