turbaszek commented on a change in pull request #10304:
URL: https://github.com/apache/airflow/pull/10304#discussion_r480967800



##########
File path: airflow/providers/google/cloud/hooks/dataprep.py
##########
@@ -50,26 +55,63 @@ def _headers(self) -> Dict[str, str]:
         }
         return headers
 
-    @property
-    def _token(self) -> str:
-        conn = self.get_connection(self.dataprep_conn_id)
-        token = conn.extra_dejson.get("token")
-        if token is None:
-            raise AirflowException(
-                "Dataprep token is missing or has invalid format. "
-                "Please make sure that Dataprep token is added to the Airflow 
Connections."
-            )
-        return token
-
     @retry(stop=stop_after_attempt(5), wait=wait_exponential(multiplier=1, 
max=10))
     def get_jobs_for_job_group(self, job_id: int) -> Dict[str, Any]:
         """
         Get information about the batch jobs within a Cloud Dataprep job.
 
-        :param job_id The ID of the job that will be fetched.
+        :param job_id The ID of the job that will be fetched
         :type job_id: int
         """
-        url: str = f"{self._url}/{job_id}/jobs"
+
+        endpoint_path = f"v4/jobGroups/{job_id}/jobs"
+        url: str = os.path.join(self._base_url, endpoint_path)
         response = requests.get(url, headers=self._headers)
-        response.raise_for_status()
+        self._raise_for_status(response)
+        return response.json()
+
+    @retry(stop=stop_after_attempt(5), wait=wait_exponential(multiplier=1, 
max=10))
+    def get_job_group(self, job_group_id: int, embed: str, include_deleted: 
bool) -> Dict[str, Any]:
+        """
+        Get the specified job group.
+        A job group is a job that is executed from a specific node in a flow.
+
+        :param job_group_id The ID of the job that will be fetched

Review comment:
       ```suggestion
           :param job_group_id: The ID of the job that will be fetched
   ```

##########
File path: airflow/providers/google/cloud/hooks/dataprep.py
##########
@@ -50,26 +55,63 @@ def _headers(self) -> Dict[str, str]:
         }
         return headers
 
-    @property
-    def _token(self) -> str:
-        conn = self.get_connection(self.dataprep_conn_id)
-        token = conn.extra_dejson.get("token")
-        if token is None:
-            raise AirflowException(
-                "Dataprep token is missing or has invalid format. "
-                "Please make sure that Dataprep token is added to the Airflow 
Connections."
-            )
-        return token
-
     @retry(stop=stop_after_attempt(5), wait=wait_exponential(multiplier=1, 
max=10))
     def get_jobs_for_job_group(self, job_id: int) -> Dict[str, Any]:
         """
         Get information about the batch jobs within a Cloud Dataprep job.
 
-        :param job_id The ID of the job that will be fetched.
+        :param job_id The ID of the job that will be fetched
         :type job_id: int
         """
-        url: str = f"{self._url}/{job_id}/jobs"
+
+        endpoint_path = f"v4/jobGroups/{job_id}/jobs"
+        url: str = os.path.join(self._base_url, endpoint_path)
         response = requests.get(url, headers=self._headers)
-        response.raise_for_status()
+        self._raise_for_status(response)
+        return response.json()
+
+    @retry(stop=stop_after_attempt(5), wait=wait_exponential(multiplier=1, 
max=10))
+    def get_job_group(self, job_group_id: int, embed: str, include_deleted: 
bool) -> Dict[str, Any]:
+        """
+        Get the specified job group.
+        A job group is a job that is executed from a specific node in a flow.
+
+        :param job_group_id The ID of the job that will be fetched
+        :type job_group_id: int
+        :param embed Comma-separated list of objects to pull in as part of the 
response

Review comment:
       ```suggestion
           :param embed: Comma-separated list of objects to pull in as part of 
the response
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to