Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Start a new "email" ConnectionConfig type [#1134] #1142

Merged
merged 8 commits into from
Aug 26, 2022

Conversation

pattisdr
Copy link
Contributor

@pattisdr pattisdr commented Aug 24, 2022

👉 Currently undocumented, the EmailConnector isn't fully fleshed out yet, that will come in a follow-up PR.
❗ Contains migration

Purpose

Add the foundation for a new email ConnectionConfig type. EmailConnector doesn't work yet here, that will be added in a follow-up PR.

Changes

  • Add a schema migration to add email to the ConnectionType enum
  • The expected secrets are is a to_email for the user that must be notified and an optional test_email to be used for the connection test
  • Add the beginnings of an EmailConnector class with most methods stubbed out.
  • Add an example dataset for future testing

Checklist

  • Update CHANGELOG.md file
    • Merge in main so the most recent CHANGELOG.md file is being appended to
    • Add description within the Unreleased section in an appropriate category. Add a new category from the list at the top of the file if the needed one isn't already there.
    • Add a link to this PR at the end of the description with the PR number as the text. example: #1
  • Applicable documentation updated (guides, quickstart, postman collections, tutorial, fidesdemo, database diagram.
  • If docs updated (select one):
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Good unit test/integration test coverage
  • This PR contains a DB migration. If checked, the reviewer should confirm with the author that the down_revision correctly references the previous migration before merging
  • The Run Unsafe PR Checks label has been applied, and checks have passed, if this PR touches any external services

Ticket

Fixes #1134

@pattisdr pattisdr marked this pull request as ready for review August 25, 2022 14:54
@seanpreston seanpreston self-assigned this Aug 25, 2022
Comment on lines +1 to +39
dataset:
- fides_key: email_dataset
name: Dataset not accessible automatically
description: Example of a email dataset with a collection waiting on postgres input
collections:
- name: daycare_customer
fields:
- name: id
data_categories: [system.operations]
fidesops_meta:
primary_key: true
- name: customer_id
data_categories: [user]
fidesops_meta:
references:
- dataset: postgres_example_test_dataset
field: customer.id
direction: from
- name: children
fields:
- name: id
data_categories: [system.operations]
fidesops_meta:
primary_key: true
- name: first_name
data_categories: [user.childrens]
- name: last_name
data_categories: [user.childrens]
- name: birthday
data_categories: [user.childrens]
fidesops_meta:
data_type: string
- name: parent_id
data_categories: [user]
fidesops_meta:
references:
- dataset: email_dataset
field: daycare_customer.id
direction: from
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contrived dataset that will be used for testing in a followup PR.

Comment on lines +9 to +15
class EmailSchema(ConnectionConfigSecretsSchema):
"""Schema to validate the secrets needed for the EmailConnector"""

to_email: str
test_email: Optional[str] # Email to send a connection test email

_required_components: List[str] = ["to_email"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently I'm thinking the user can just configure the single email that should be sent out (or we could do a list of emails, that's in an earlier commit). Additionally, if they have a "test_email" configured, I think they could send an email to themselves if they wanted with the same template they'd send to the user, just without the data in it, so they could preview if they wished.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current design just has this separately creating the single EmailConfig that Catherine developed, and using that resource to do the sending part.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To one email address is a fair assumption for now! And good thoughts on the test email for testing the connector.

Comment on lines +14 to +50

class EmailConnector(BaseConnector[None]):
def query_config(self, node: TraversalNode) -> ManualQueryConfig:
"""
Stub
"""

def create_client(self) -> None:
"""Stub"""

def close(self) -> None:
"""Stub"""

def test_connection(self) -> Optional[ConnectionTestStatus]:
"""
Override to skip connection test for now
"""
return ConnectionTestStatus.skipped

def retrieve_data( # type: ignore
self,
node: TraversalNode,
policy: Policy,
privacy_request: PrivacyRequest,
input_data: Dict[str, List[Any]],
) -> Optional[List[Row]]:
"""Access requests are not supported at this time."""
return []

def mask_data( # type: ignore
self,
node: TraversalNode,
policy: Policy,
privacy_request: PrivacyRequest,
rows: List[Row],
) -> Optional[int]:
"""Stub"""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all being fleshed out in a follow-up PR. "retrieve_data" won't do anything, "mask_data" will figure out what data we need to send to the user.

Normally "mask_data" has rows retrieved from the access portion, but we won't have that for an email connector, so the email we send will need to be a combination of access/erasure information, to both tell them how to locate the data (access) and how/which fields to mask.

CHANGELOG.md Outdated Show resolved Hide resolved
@seanpreston seanpreston merged commit 8ed11fa into main Aug 26, 2022
@seanpreston seanpreston deleted the fidesops_1134_email_connector_base branch August 26, 2022 18:01
sanders41 pushed a commit that referenced this pull request Sep 22, 2022
* Start a new "email" ConnectionConfig type.

* Hide "email" type from the get_connection_types endpoint for now, as the email connector isn't fleshed out yet.

* Update CHANGELOG.

* Simplify by sending one email to start?

* Update request body in postman collection.

* Fix CHANGELOG formatting.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Fidesops Email Connector and Example Email Dataset
2 participants