in 5-app-infra/3-artifact-publish/docker/cdmc/tag_engine_api/main.py [0:0]
def choose_config_action():
if 'credentials' not in session:
return redirect('/')
template_id = request.form['template_id']
template_project = request.form['template_project']
template_region = request.form['template_region']
service_account = request.form['service_account']
config_uuid = request.form['config_uuid']
config_type = request.form['config_type']
action = request.form['action']
print('template_id:', template_id)
print('template_project:', template_project)
print('template_region:', template_region)
print('service_account:', service_account)
print('config_uuid:', config_uuid)
print('config_type:', config_type)
print('action:', action)
if action == "View Job History":
jobs = store.read_jobs_by_config(config_uuid)
return render_template(
'job_history.html',
jobs=jobs,
config_uuid=config_uuid,
config_type=config_type,
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account)
if action == "Trigger Job":
job_uuid = jm.create_job(tag_creator_account=service_account, tag_invoker_account=session['user_email'], config_uuid=config_uuid, config_type=config_type)
job = jm.get_job_status(job_uuid)
entries = get_log_entries(service_account)
return render_template(
'job_status.html',
job_uuid=job_uuid,
entries=entries,
job_status=job['job_status'],
config_uuid=config_uuid,
config_type=config_type,
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account)
if action == "View Configs":
print("View Configs")
if action == "Delete Config":
store.delete_config(service_account, config_uuid, config_type)
return view_remaining_configs(service_account, template_id, template_project, template_region)
# action == Update Config
config = store.read_config(service_account, config_uuid, config_type)
print("config: " + str(config))
credentials, success = get_target_credentials(service_account)
if success == False:
print('Error acquiring credentials from', service_account)
dcc = controller.DataCatalogController(credentials, None, None, template_id, template_project, template_region)
template_fields = dcc.get_template()
#print('template_fields:', template_fields)
if config_type == "STATIC_TAG_ASSET":
return render_template(
'update_static_asset_config.html',
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account,
fields=template_fields,
config=config,
current_time=datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S'))
if config_type == "DYNAMIC_TAG_TABLE":
return render_template(
'update_dynamic_table_config.html',
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account,
fields=template_fields,
config=config)
if config_type == "DYNAMIC_TAG_COLUMN":
return render_template(
'update_dynamic_column_config.html',
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account,
fields=template_fields,
config=config)
if config_type == "ENTRY_CREATE":
return render_template(
'update_entry_config.html',
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account,
fields=template_fields,
config=config)
if config_type == "GLOSSARY_TAG_ASSET":
return render_template(
'update_glossary_asset_config.html',
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account,
fields=template_fields,
config=config)
if config_type == "SENSITIVE_TAG_COLUMN":
return render_template(
'update_sensitive_column_config.html',
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account,
fields=template_fields,
config=config)
if config_type == "TAG_IMPORT":
return render_template(
'update_import_config.html',
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account,
config=config)
if config_type == "TAG_RESTORE":
return render_template(
'update_restore_config.html',
template_id=template_id,
template_project=template_project,
template_region=template_region,
service_account=service_account,
config=config)