def handleList(self, conf_info): logger.info("start list google projects") if not self.callerArgs or not self.callerArgs[gpc.google_credentials]: logger.error("Missing Google credentials") return creds = self.callerArgs[gpc.google_credentials][0] creds = scu.unescape_json_control_chars(base64.b64decode(creds)) creds = json.loads(creds) config = { gpc.google_credentials: creds, } res_mgr = grm.GoogleResourceManager(logger, config) projects = [project["name"] for project in res_mgr.projects()] conf_info["google_projects"].append("projects", projects) logger.info("end list google projects")
def handleList(self, conf_info): logger.info("start list google subscriptions") for required in self.valid_params: if not self.callerArgs or not self.callerArgs[required]: logger.error("Missing Google credentials") return creds = self.callerArgs[gpc.google_credentials][0] creds = scu.unescape_json_control_chars(base64.b64decode(creds)) creds = json.loads(creds) project = self.callerArgs[gpc.google_project][0] config = { gpc.google_credentials: creds, gpc.google_project: project, } ps = gpw.GooglePubSub(logger, config) subscriptions = [sub["name"].split("/")[-1] for sub in ps.subscriptions()] conf_info["google_subscriptions"].append( "subscriptions", subscriptions) logger.info("end list google subscriptions")