(context)
return {'resources': resources}
Creates configuration.
Creates configuration.
Creates configuration .
def GenerateConfig(context):
  """Creates configuration."""

  resources = []
  project = context.env['project']

  # create disks resources
  for disk_obj in context.properties['disks']:
    resources.append({'name': DiskName(context, disk_obj),
                      'type': 'compute.v1.disk',
                      'properties': {
                          'zone': context.properties['zone'],
                          'sizeGb': str(disk_obj['sizeGb']),
                          'type': ''.join([COMPUTE_URL_BASE,
                                           'projects/', project, '/zones/',
                                           context.properties['zone'],
                                           '/diskTypes/', disk_obj['diskType']])
                      }
                     })
  disks = []
  disks.append({'deviceName': 'boot',
                'type': 'PERSISTENT',
                'boot': True,
                'autoDelete': True,
                'initializeParams': {
                    'diskName': project + '-boot',
                    'sourceImage': ''.join([COMPUTE_URL_BASE, 'projects/',
                                            'debian-cloud/global/images/',
                                            'family/debian-9'])
                }
               })
  for disk_obj in context.properties['disks']:
    disks.append({'deviceName': DiskName(context, disk_obj),
                  'type': 'PERSISTENT',
                  'source': ''.join(['$(ref.', DiskName(context, disk_obj),
                                     '.selfLink)']),
                  'autoDelete': True})

  # create vm with disks
  resources.append({'name': context.env['deployment'] + '-vm',
                    'type': 'compute.v1.instance',
                    'properties': {
                        'zone': context.properties['zone'],
                        'machineType': ''.join([COMPUTE_URL_BASE, 'projects/',
                                                project, '/zones/',
                                                context.properties['zone'],
                                                '/machineTypes/f1-micro']),
                        'networkInterfaces': [{
                            'network': ''.join([COMPUTE_URL_BASE,
                                                'projects/', project,
                                                '/global/networks/default']),
                            'accessConfigs': [{
                                'name': 'External NAT',
                                'type': 'ONE_TO_ONE_NAT'}],
                        }],
                        'disks': disks
                    }
                   })
  return {'resources': resources}
def GenerateConfig ( context ) : resources = [ ] project = context . env [ 'project' ] # create disks resources for disk_obj in context . properties [ 'disks' ] : resources . append ( { 'name' : DiskName ( context , disk_obj ) , 'type' : 'compute.v1.disk' , 'properties' : { 'zone' : context . properties [ 'zone' ] , 'sizeGb' : str ( disk_obj [ 'sizeGb' ] ) , 'type' : '' . join ( [ COMPUTE_URL_BASE , 'projects/' , project , '/zones/' , context . properties [ 'zone' ] , '/diskTypes/' , disk_obj [ 'diskType' ] ] ) } } ) disks = [ ] disks . append ( { 'deviceName' : 'boot' , 'type' : 'PERSISTENT' , 'boot' : True , 'autoDelete' : True , 'initializeParams' : { 'diskName' : project + '-boot' , 'sourceImage' : '' . join ( [ COMPUTE_URL_BASE , 'projects/' , 'debian-cloud/global/images/' , 'family/debian-9' ] ) } } ) for disk_obj in context . properties [ 'disks' ] : disks . append ( { 'deviceName' : DiskName ( context , disk_obj ) , 'type' : 'PERSISTENT' , 'source' : '' . join ( [ '$(ref.' , DiskName ( context , disk_obj ) , '.selfLink)' ] ) , 'autoDelete' : True } ) # create vm with disks resources . append ( { 'name' : context . env [ 'deployment' ] + '-vm' , 'type' : 'compute.v1.instance' , 'properties' : { 'zone' : context . properties [ 'zone' ] , 'machineType' : '' . join ( [ COMPUTE_URL_BASE , 'projects/' , project , '/zones/' , context . properties [ 'zone' ] , '/machineTypes/f1-micro' ] ) , 'networkInterfaces' : [ { 'network' : '' . join ( [ COMPUTE_URL_BASE , 'projects/' , project , '/global/networks/default' ] ) , 'accessConfigs' : [ { 'name' : 'External NAT' , 'type' : 'ONE_TO_ONE_NAT' } ] , } ] , 'disks' : disks } } ) return { 'resources' : resources }