Esempio n. 1
0
  def testGetZonalResourcesDicts(self):
    service = self.compute.instances
    project = 'my-project'
    requested_zones = ['my-zone']
    filter_expr = ''
    http = object()
    batch_url = object()
    errors = []

    self.assertIs(self.result,
                  lister.GetZonalResourcesDicts(
                      service=service,
                      project=project,
                      requested_zones=requested_zones,
                      filter_expr=filter_expr,
                      http=http,
                      batch_url=batch_url,
                      errors=errors))

    self.assertListEqual(errors, [])
    self.list_json.assert_called_once_with(
        requests=[(service, 'List', self.messages.ComputeInstancesListRequest(
            filter=filter_expr,
            maxResults=500,
            project=project,
            zone='my-zone'))],
        http=http,
        batch_url=batch_url,
        errors=errors)
Esempio n. 2
0
 def GetResources(self, args, errors):
   zone_names = [
       self.CreateGlobalReference(zone, resource_type='zones').Name()
       for zone in args.zones]
   return lister.GetZonalResourcesDicts(
       service=self.service,
       project=self.project,
       requested_zones=zone_names,
       filter_expr=self.GetFilterExpr(args),
       http=self.http,
       batch_url=self.batch_url,
       errors=errors)