-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfactory.go
48 lines (43 loc) · 1.82 KB
/
factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (C) Fasten Health, Inc. - All Rights Reserved.
//
// THIS FILE IS GENERATED BY https://github.com/fastenhealth/fasten-sources-gen
// PLEASE DO NOT EDIT BY HAND
package factory
import (
"context"
"github.com/fastenhealth/fasten-sources/clients/internal"
fasten "github.com/fastenhealth/fasten-sources/clients/internal/fasten"
manual "github.com/fastenhealth/fasten-sources/clients/internal/manual"
models "github.com/fastenhealth/fasten-sources/clients/models"
definitionsModels "github.com/fastenhealth/fasten-sources/definitions/models"
pkg "github.com/fastenhealth/fasten-sources/pkg"
logrus "github.com/sirupsen/logrus"
)
func GetSourceClient(
env pkg.FastenLighthouseEnvType,
ctx context.Context,
globalLogger logrus.FieldLogger,
sourceCreds models.SourceCredential,
clientOptions ...func(options *models.SourceClientOptions),
) (models.SourceClient, error) {
switch sourceCreds.GetPlatformType() {
case pkg.PlatformTypeManual:
return manual.GetSourceClientManual(env, ctx, globalLogger, sourceCreds, clientOptions...)
case pkg.PlatformTypeFasten:
return fasten.GetSourceClientFasten(env, ctx, globalLogger, sourceCreds, clientOptions...)
case pkg.PlatformTypeHIE:
return fasten.GetSourceClientFasten(env, ctx, globalLogger, sourceCreds, clientOptions...)
default:
return internal.GetDynamicSourceClient(env, ctx, globalLogger, sourceCreds, clientOptions...)
}
}
func GetSourceClientWithDefinition(
env pkg.FastenLighthouseEnvType,
ctx context.Context,
globalLogger logrus.FieldLogger,
sourceCreds models.SourceCredential,
endpointDefinition *definitionsModels.LighthouseSourceDefinition,
clientOptions ...func(options *models.SourceClientOptions),
) (models.SourceClient, error) {
return internal.GetDynamicSourceClientWithDefinition(env, ctx, globalLogger, sourceCreds, endpointDefinition, clientOptions...)
}