-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
45 lines (36 loc) · 998 Bytes
/
main.go
File metadata and controls
45 lines (36 loc) · 998 Bytes
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
package awsmocker
// Start the mocker
func Start(t TestingT, optFns ...MockerOptionFunc) MockerInfo {
if h, ok := t.(tHelper); ok {
h.Helper()
}
options := newOptions()
for _, optFn := range optFns {
// makes transitioning somewhat easier
if optFn == nil {
continue
}
optFn(options)
}
mocks := make([]*MockedEndpoint, 0, len(options.Mocks))
for i := range options.Mocks {
if options.Mocks[i] == nil {
continue
}
mocks = append(mocks, options.Mocks[i])
}
server := &mocker{
t: t,
timeout: options.Timeout,
verbose: options.Verbose,
debugTraffic: getDebugMode(), // options.DebugTraffic,
doNotOverrideCreds: options.DoNotOverrideCreds,
doNotFailUnhandled: options.DoNotFailUnhandledRequests,
noMiddleware: options.noMiddleware,
mocks: mocks,
// usingAwsConfig: true,
}
server.Start()
server.awsConfig = server.buildAwsConfig(options.AwsConfigOptions...)
return server
}