You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/03 09:02:59 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #10121: Google Cloud Memorystore Memcached Operators

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



##########
File path: airflow/providers/google/cloud/hooks/cloud_memorystore.py
##########
@@ -501,3 +504,275 @@ def update_instance(
         )
         result.result()
         self.log.info("Instance updated: %s", instance.name)
+
+
+class CloudMemorystoreMemcachedHook(GoogleBaseHook):
+    """
+        Hook for Google Cloud Memorystore for Memcached service APIs.
+
+        All the methods in the hook where project_id is used must be called with
+        keyword arguments rather than positional.
+
+        :param gcp_conn_id: The connection ID to use when fetching connection info.
+        :type gcp_conn_id: str
+        :param delegate_to: The account to impersonate using domain-wide delegation of authority,
+            if any. For this to work, the service account making the request must have
+            domain-wide delegation enabled.
+        :type delegate_to: str
+        :param impersonation_chain: Optional service account to impersonate using short-term
+            credentials, or chained list of accounts required to get the access_token
+            of the last account in the list, which will be impersonated in the request.
+            If set as a string, the account must grant the originating account
+            the Service Account Token Creator IAM role.
+            If set as a sequence, the identities from the list must grant
+            Service Account Token Creator IAM role to the directly preceding identity, with first
+            account from the list granting this role to the originating account.
+        :type impersonation_chain: Union[str, Sequence[str]]
+        """
+
+    def __init__(
+        self,
+        gcp_conn_id: str = "google_cloud_default",
+        delegate_to: Optional[str] = None,
+        impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
+    ) -> None:
+        super().__init__(
+            gcp_conn_id=gcp_conn_id,
+            delegate_to=delegate_to,
+            impersonation_chain=impersonation_chain,
+        )
+        self._client = None  # type: Optional[CloudMemcacheClient]
+
+    def get_conn(self, ):
+        """
+        Retrieves client library object that allow access to Cloud Memorystore Memcached service.
+

Review comment:
       ```suggestion
   ```

##########
File path: airflow/providers/google/cloud/hooks/cloud_memorystore.py
##########
@@ -501,3 +504,275 @@ def update_instance(
         )
         result.result()
         self.log.info("Instance updated: %s", instance.name)
+
+
+class CloudMemorystoreMemcachedHook(GoogleBaseHook):
+    """
+        Hook for Google Cloud Memorystore for Memcached service APIs.
+
+        All the methods in the hook where project_id is used must be called with
+        keyword arguments rather than positional.
+
+        :param gcp_conn_id: The connection ID to use when fetching connection info.
+        :type gcp_conn_id: str
+        :param delegate_to: The account to impersonate using domain-wide delegation of authority,
+            if any. For this to work, the service account making the request must have
+            domain-wide delegation enabled.
+        :type delegate_to: str
+        :param impersonation_chain: Optional service account to impersonate using short-term
+            credentials, or chained list of accounts required to get the access_token
+            of the last account in the list, which will be impersonated in the request.
+            If set as a string, the account must grant the originating account
+            the Service Account Token Creator IAM role.
+            If set as a sequence, the identities from the list must grant
+            Service Account Token Creator IAM role to the directly preceding identity, with first
+            account from the list granting this role to the originating account.
+        :type impersonation_chain: Union[str, Sequence[str]]
+        """
+
+    def __init__(
+        self,
+        gcp_conn_id: str = "google_cloud_default",
+        delegate_to: Optional[str] = None,
+        impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
+    ) -> None:
+        super().__init__(
+            gcp_conn_id=gcp_conn_id,
+            delegate_to=delegate_to,
+            impersonation_chain=impersonation_chain,
+        )
+        self._client = None  # type: Optional[CloudMemcacheClient]

Review comment:
       ```suggestion
           self._client: Optional[CloudMemcacheClient] = None
   ```




----------------------------------------------------------------
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:
users@infra.apache.org