forked from ethyca/fides
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start a new "email" ConnectionConfig type [ethyca#1134] (ethyca#1142)
* 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.
- Loading branch information
Showing
16 changed files
with
408 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/fidesops/ops/migrations/versions/c2f7a29c4780_email_connection_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""email_connection_config | ||
Revision ID: c2f7a29c4780 | ||
Revises: 97801300fedd | ||
Create Date: 2022-08-24 14:02:25.096312 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "c2f7a29c4780" | ||
down_revision = "97801300fedd" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.execute("alter type connectiontype rename to connectiontype_old") | ||
op.execute( | ||
"create type connectiontype as enum('postgres', 'mongodb', 'mysql', 'https', 'snowflake', 'redshift', 'mssql', 'mariadb', 'bigquery', 'saas', 'manual', 'email')" | ||
) | ||
op.execute( | ||
( | ||
"alter table connectionconfig alter column connection_type type connectiontype using " | ||
"connection_type::text::connectiontype" | ||
) | ||
) | ||
op.execute("drop type connectiontype_old") | ||
|
||
|
||
def downgrade(): | ||
op.execute("alter type connectiontype rename to connectiontype_old") | ||
op.execute( | ||
"create type connectiontype as enum('postgres', 'mongodb', 'mysql', 'https', 'snowflake', 'redshift', 'mssql', 'mariadb', 'bigquery', 'saas', 'manual')" | ||
) | ||
op.execute( | ||
( | ||
"alter table connectionconfig alter column connection_type type connectiontype using " | ||
"connection_type::text::connectiontype" | ||
) | ||
) | ||
op.execute("drop type connectiontype_old") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/fidesops/ops/schemas/connection_configuration/connection_secrets_email.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from typing import List, Optional | ||
|
||
from fidesops.ops.schemas.base_class import NoValidationSchema | ||
from fidesops.ops.schemas.connection_configuration.connection_secrets import ( | ||
ConnectionConfigSecretsSchema, | ||
) | ||
|
||
|
||
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"] | ||
|
||
|
||
class EmailDocsSchema(EmailSchema, NoValidationSchema): | ||
"""EmailDocsSchema Secrets Schema for API Docs""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import logging | ||
from typing import Any, Dict, List, Optional | ||
|
||
from fidesops.ops.graph.traversal import TraversalNode | ||
from fidesops.ops.models.connectionconfig import ConnectionTestStatus | ||
from fidesops.ops.models.policy import Policy | ||
from fidesops.ops.models.privacy_request import PrivacyRequest | ||
from fidesops.ops.service.connectors.base_connector import BaseConnector | ||
from fidesops.ops.service.connectors.query_config import ManualQueryConfig | ||
from fidesops.ops.util.collection_util import Row | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
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""" |
Oops, something went wrong.