claw89 opened a new pull request, #43446:
URL: https://github.com/apache/airflow/pull/43446

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   # Google Cloud Financial Services API Operators
   
   This PR adds operators to interact with the [GCP Financial Services 
Anti-Money Laundering AI 
API](https://cloud.google.com/financial-services/anti-money-laundering/docs).
   
   ## New Features
   
   ### Hooks
   
   #### Financial Services Hook
   
   `providers/src/airflow/providers/google/cloud/hooks/financial_services.py` 
adds a hook for calling the Financial Services API. The methods implemented in 
this PR are 
[create](https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/rest/v1/projects.locations.instances/create),
 
[get](https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/rest/v1/projects.locations.instances/get),
 and [delete 
](https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/rest/v1/projects.locations.instances/delete)
 on the [instances 
](https://cloud.google.com/financial-services/anti-money-laundering/docs/reference/rest/v1/projects.locations.instances)
 endpoint.
   
   Note: To initialize the hook, the API discovery document must be provided as 
an argument in json format. This is because the Financial Services API is not 
currently publically General Available (customers must be allow-listed by 
Google), and requests to retrieve the discovery document require a developer 
key associated with that project. This discovery document does not contain any 
information beyond that already available from the public documentation and we 
have permission from a Google representative to check it in.
   
   ### Operators
   
   #### Financial Services Create Instance Operator
   
   
`providers/src/airflow/providers/google/cloud/operators/financial_services.py::FinancialServicesCreateInstanceOperator`
 can be used for airflow tasks that create a new Financial Services instance. 
This call creates a long-running operation and returns the name of the 
operation for monitoring.
   
   #### Financial Services Get Instance Operator
   
   
`providers/src/airflow/providers/google/cloud/operators/financial_services.py::FinancialServicesGetInstanceOperator`
 can be used for airflow tasks that fetch an existing Financial Services 
instance. This call returns the instance resource data.
   
   #### Financial Services Delete Instance Operator
   
   
`providers/src/airflow/providers/google/cloud/operators/financial_services.py::FinancialServicesDeleteInstanceOperator`
 can be used for airflow tasks that delete a Financial Services instance. This 
call creates a long-running operation and returns the name of the operation for 
monitoring.
   
   
   ### Sensors
   
   #### Financial Services Operation Sensor
   
   
`providers/src/airflow/providers/google/cloud/sensors/financial_services.py::FinancialServicesOperationSensor`
 can be used to monitor the status of Financial Services operations. The `poke` 
method access the `done` field of the operation and completes when `done=true`. 
   
   
   ## Tests
   
   ### Unit Tests
   Unit tests added for the new hook, operator, and sensor features. 
   
   ### System Tests
   An example DAG is added to the system tests directory. This DAG creates an 
instance, fetches the instance, and finally deletes it, with operation sensors 
for the create and delete operations. 
   
   Running the system test requires access to the Financial Services API. Some 
environment variables should also be set:
   - SYSTEM_TESTS_GCP_PROJECT
   - SYSTEM_TESTS_GCP_LOCATION
   - SYSTEM_TESTS_GCP_KMS_KEY
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a 
newsfragment file, named `{pr_number}.significant.rst` or 
`{issue_number}.significant.rst`, in 
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to