Skip to content

Commit

Permalink
new secops anonymization pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
simonebruzzechesse committed Jan 8, 2025
1 parent 0e87d10 commit ce431a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,12 @@ def trigger_export(export_date: str, export_start_datetime: str,
backstory_credentials = service_account.Credentials.from_service_account_file(
SECOPS_SOURCE_SA_KEY_SECRET_PATH, scopes=SCOPES)
secops_utils = SecOpsUtils(backstory_credentials)
previous_day = utils.get_previous_day(export_date) if export_date else None

export_ids = []
try:
if log_types is None:
export_response = secops_utils.create_data_export(
project=GCP_PROJECT_ID, export_date=previous_day,
project=GCP_PROJECT_ID, export_date=export_date,
export_start_datetime=export_start_datetime,
export_end_datetime=export_end_datetime)
LOGGER.info(export_response)
Expand All @@ -152,7 +151,7 @@ def trigger_export(export_date: str, export_start_datetime: str,
else:
for log_type in log_types:
export_response = secops_utils.create_data_export(
project=GCP_PROJECT_ID, export_date=previous_day,
project=GCP_PROJECT_ID, export_date=export_date,
export_start_datetime=export_start_datetime,
export_end_datetime=export_end_datetime, log_type=log_type)
LOGGER.info(export_response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ def format_date_time_range(date_input):
return formatted_start, formatted_end


def get_previous_day(date_input):
date_obj = datetime.strptime(date_input, "%Y-%m-%d")
previous_day = date_obj + timedelta(days=-1)
return previous_day.strftime("%Y-%m-%d")


def list_anonymized_folders(bucket_name, folder_name):
"""Lists all folders (prefixes) within a specified folder in a GCS bucket.
Expand Down

0 comments on commit ce431a6

Please sign in to comment.