def process()

in processors/cloudrun.py [0:0]


    def process(self, output_var='cloudrun'):
        if 'mode' not in self.config:
            raise NotConfiguredException('No Cloud Run operation specified.')
        if 'location' not in self.config:
            raise NotConfiguredException('No Cloud Run location specified.')

        credentials, credentials_project_id = google.auth.default()
        project = self._jinja_expand_string(
            self.config['project'],
            'project') if 'project' in self.config else credentials_project_id
        if not project:
            project = credentials.quota_project_id

        run_service = discovery.build('run',
                                      'v2',
                                      http=self._get_branded_http(credentials))

        location = self._jinja_expand_string(self.config['location'])
        job = self._jinja_expand_string(self.config['job'])

        if self.config['mode'] == 'jobs.executions.list':
            parent = f"projects/{project}/locations/{location}/jobs/{job}"
            request_params = {"parent": parent}
            ret = []
            while True:
                run_request = run_service.projects().locations().jobs(
                ).executions().list(**request_params)
                run_response = run_request.execute()
                if 'executions' in run_response:
                    ret += run_response['executions']
                if 'nextPageToken' in run_response:
                    request_params['pageToken'] = run_response['nextPageToken']
                else:
                    break
            return {output_var: ret}

        if self.config['mode'] == 'jobs.executions.get':
            execution = self._jinja_expand_string(self.config['execution'])
            name = f"projects/{project}/locations/{location}/jobs/{job}/executions/{execution}"
            run_request = run_service.projects().locations().jobs().executions(
            ).get(name=name)
            run_response = run_request.execute()
            return {output_var: run_response}

        if self.config['mode'] == 'jobs.executions.cancel':
            execution = self._jinja_expand_string(self.config['execution'])
            name = f"projects/{project}/locations/{location}/jobs/{job}/executions/{execution}"
            run_request = run_service.projects().locations().jobs().executions(
            ).cancel(name=name, body={"validateOnly": False})
            run_response = run_request.execute()
            return {output_var: run_response}

        if self.config['mode'] == 'jobs.run':
            name = f"projects/{project}/locations/{location}/jobs/{job}"
            overrides = {}
            if 'overrides' in self.config:
                overrides = self._jinja_expand_dict_all(
                    self.config['overrides'])
            request_body = {
                'validateOnly': False,
                'overrides': overrides,
            }
            run_request = run_service.projects().locations().jobs().run(
                name=name, body=request_body)
            run_response = run_request.execute()
            return {output_var: run_response}

        return {output_var: None}