Skip to content

Commit

Permalink
[DC] Okta Connector Enhancement (#282)
Browse files Browse the repository at this point in the history
* Enhances Okta ingestion with User and Group data
  • Loading branch information
sfc-gh-gbutzi authored and sfc-gh-afedorov committed Sep 10, 2019
1 parent ff8176e commit bc6db36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions migrations/v1_8_4-v1_8_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ALTER TABLE data.okta_default_groups_connection SET COMMENT='
'
~~~


## Azure Subscription Connector

### Supporting Gov Cloud
Expand Down
14 changes: 7 additions & 7 deletions src/connectors/okta.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@ def connect(connection_name, options):


def ingest(table_name, options):
ingest_type = ''
if table_name.endswith('_USERS_CONNECTION'):
ingest_type = 'users'
elif table_name.endswith('_GROUPS_CONNECTION'):
ingest_type = 'groups'
else:
ingest_type = 'logs'
ingest_type = (
'users' if table_name.endswith('_USERS_CONNECTION') else
'groups' if table_name.endswith('_GROUPS_CONNECTION') else
'logs'
)

landing_table = f'data.{table_name}'
api_key = options['api_key']
Expand Down Expand Up @@ -115,6 +113,7 @@ def ingest(table_name, options):

log.info(f'Inserted {len(result)} rows.')
yield len(result)

elif ingest_type == 'users':
while 1:
response = requests.get(url=url[ingest_type], headers=headers)
Expand Down Expand Up @@ -150,6 +149,7 @@ def ingest(table_name, options):

if len(url[ingest_type]) == 0:
break

else:
ts = db.fetch_latest(landing_table, 'event_time')
if ts is None:
Expand Down

0 comments on commit bc6db36

Please sign in to comment.