def testGetAllAPIs(self): all_apis = registry.GetAllAPIs() self.assertGreater(len(all_apis), 30) compute_apis = [a for a in all_apis if a.name == 'compute'] self.assertGreater(len(compute_apis), 1) default_compute_apis = [a for a in compute_apis if a.is_default] self.assertEqual(1, len(default_compute_apis))
def get_apitools_apis(self): """Returns all apitools collections and associated versions.""" apitools_apis = {} for api in registry.GetAllAPIs(): if api.name not in apitools_apis: apitools_apis[api.name] = [] apitools_apis[api.name].append(api.version) return apitools_apis
def get_apitools_collections(): """Returns all apitools collections and associated versions.""" collection_api_names = set() collection_api_versions = {} for api in registry.GetAllAPIs(): collection_api_names.add(api.name) if api.name not in collection_api_versions: collection_api_versions[api.name] = [] collection_api_versions[api.name].append(api.version) return collection_api_names, collection_api_versions
def Run(self, args): if not args.collection: collections = [ registry.GetAPICollections(api.name, api.version) for api in registry.GetAllAPIs() ] collections = list(itertools.chain.from_iterable(collections)) methods = [ registry.GetMethods(collection.full_name, api_version=collection.api_version) for collection in collections ] methods = list(itertools.chain.from_iterable(methods)) return methods return registry.GetMethods(args.collection, api_version=args.api_version)
def Run(self, args): return registry.GetAllAPIs()
def APICompleter(**_): return [a.name for a in registry.GetAllAPIs()]