in services/library/src/main/java/com/google/cloud/pso/bq_snapshot_manager/functions/f04_tagger/Tagger.java [64:121]
public TaggerResponse execute(
TaggerRequest request,
String pubSubMessageId
) throws NonRetryableApplicationException, RetryableApplicationException, IOException {
// run common service start logging and checks
Utils.runServiceStartRoutines(
logger,
request,
persistentSet,
// This service might be called twice in case of the "Both" backup method. We need to differentiate the key
String.format("%s/%s", persistentSetObjectPrefix, request.getAppliedBackupMethod()),
request.getTrackingId()
);
BackupState updatedState = new BackupState(
request.getLastBackUpAt(),
request.getAppliedBackupMethod().equals(BackupMethod.BIGQUERY_SNAPSHOT)?
request.getBigQuerySnapshotTableSpec().toResourceUrl(): null,
request.getAppliedBackupMethod().equals(BackupMethod.GCS_SNAPSHOT)?
request.getGcsSnapshotUri(): null
);
BackupPolicyAndState updatedPolicyAndState = new BackupPolicyAndState(
request.getBackupPolicyAndState().getPolicy(),
updatedState
);
if(!request.isDryRun()){
// update the tag
// API Calls
backupPolicyService.createOrUpdateBackupPolicyAndStateForTable(
request.getTargetTable(),
updatedPolicyAndState
);
}
// run common service end logging and adding pubsub message to processed list
Utils.runServiceEndRoutines(
logger,
request,
persistentSet,
// This service might be called twice in case of the "Both" backup method. We need to differentiate the key
String.format("%s/%s", persistentSetObjectPrefix, request.getAppliedBackupMethod()),
request.getTrackingId()
);
return new TaggerResponse(
request.getTargetTable(),
request.getRunId(),
request.getTrackingId(),
request.isDryRun(),
request.getBackupPolicyAndState(),
updatedPolicyAndState
);
}