From dc39abfad5cbadfd7163d1b6eefbf00fe33d10e6 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Fri, 1 Dec 2023 12:07:30 -0800 Subject: [PATCH] adding a new source type, Fasten. Used to store resources that are created within the Fasten UI. --- clients/factory/factory.go | 3 +++ clients/internal/fasten/client.go | 21 +++++++++++++++++++++ definitions/factory/factory.go | 2 ++ pkg/source_type.go | 1 + 4 files changed, 27 insertions(+) create mode 100644 clients/internal/fasten/client.go diff --git a/clients/factory/factory.go b/clients/factory/factory.go index 0b59c0e2d..f55946eea 100644 --- a/clients/factory/factory.go +++ b/clients/factory/factory.go @@ -8,6 +8,7 @@ package factory import ( "context" "fmt" + fasten "github.com/fastenhealth/fasten-sources/clients/internal/fasten" manual "github.com/fastenhealth/fasten-sources/clients/internal/manual" platform "github.com/fastenhealth/fasten-sources/clients/internal/platform" sandbox "github.com/fastenhealth/fasten-sources/clients/internal/sandbox" @@ -22,6 +23,8 @@ func GetSourceClient(env pkg.FastenLighthouseEnvType, sourceType pkg.SourceType, switch sourceType { case pkg.SourceTypeManual: return manual.GetSourceClientManual(env, ctx, globalLogger, sourceCreds, testHttpClient...) + case pkg.SourceTypeFasten: + return fasten.GetSourceClientFasten(env, ctx, globalLogger, sourceCreds, testHttpClient...) // platform case pkg.SourceTypeAdvancedmdSandbox: return platform.GetSourceClientAdvancedmdSandbox(env, ctx, globalLogger, sourceCreds, testHttpClient...) diff --git a/clients/internal/fasten/client.go b/clients/internal/fasten/client.go new file mode 100644 index 000000000..2ead39729 --- /dev/null +++ b/clients/internal/fasten/client.go @@ -0,0 +1,21 @@ +package fasten + +import ( + "context" + "github.com/fastenhealth/fasten-sources/clients/internal/manual" + "github.com/fastenhealth/fasten-sources/clients/models" + "github.com/fastenhealth/fasten-sources/pkg" + "github.com/sirupsen/logrus" + "net/http" +) + +type FastenClient struct { + models.SourceClient +} + +func GetSourceClientFasten(env pkg.FastenLighthouseEnvType, ctx context.Context, globalLogger logrus.FieldLogger, sourceCreds models.SourceCredential, testHttpClient ...*http.Client) (models.SourceClient, error) { + manualClient, err := manual.GetSourceClientManual(env, ctx, globalLogger, sourceCreds, testHttpClient...) + return &FastenClient{ + manualClient, + }, err +} diff --git a/definitions/factory/factory.go b/definitions/factory/factory.go index 67b8d4ac5..eaafa0ad1 100644 --- a/definitions/factory/factory.go +++ b/definitions/factory/factory.go @@ -18,6 +18,8 @@ func GetSourceConfig(env pkg.FastenLighthouseEnvType, sourceType pkg.SourceType, switch sourceType { case pkg.SourceTypeManual: return models.LighthouseSourceDefinition{SourceType: pkg.SourceTypeManual}, nil + case pkg.SourceTypeFasten: + return models.LighthouseSourceDefinition{SourceType: pkg.SourceTypeFasten}, nil // platform case pkg.SourceTypeAdvancedmdSandbox: return platform.GetSourceAdvancedmdSandbox(env, clientIdLookup) diff --git a/pkg/source_type.go b/pkg/source_type.go index d67b7506d..9e9a33118 100644 --- a/pkg/source_type.go +++ b/pkg/source_type.go @@ -9,6 +9,7 @@ type SourceType string const ( SourceTypeManual SourceType = "manual" + SourceTypeFasten SourceType = "fasten" // platform SourceTypeAdvancedmdSandbox SourceType = "advancedmd-sandbox" SourceTypeAetna SourceType = "aetna"