Skip to content

Commit

Permalink
adding a new source type, Fasten. Used to store resources that are cr…
Browse files Browse the repository at this point in the history
…eated within the Fasten UI.
  • Loading branch information
AnalogJ committed Dec 1, 2023
1 parent 713bae4 commit dc39abf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clients/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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...)
Expand Down
21 changes: 21 additions & 0 deletions clients/internal/fasten/client.go
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 2 additions & 0 deletions definitions/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pkg/source_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type SourceType string

const (
SourceTypeManual SourceType = "manual"
SourceTypeFasten SourceType = "fasten"
// platform
SourceTypeAdvancedmdSandbox SourceType = "advancedmd-sandbox"
SourceTypeAetna SourceType = "aetna"
Expand Down

0 comments on commit dc39abf

Please sign in to comment.