This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathmock_cloud_watch_event_client.go
71 lines (59 loc) · 2.18 KB
/
mock_cloud_watch_event_client.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package mocks
import (
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
"github.com/lyft/flyteadmin/pkg/async/schedule/aws/interfaces"
)
type putRuleFunc func(input *cloudwatchevents.PutRuleInput) (*cloudwatchevents.PutRuleOutput, error)
type putTargetsFunc func(input *cloudwatchevents.PutTargetsInput) (*cloudwatchevents.PutTargetsOutput, error)
type deleteRuleFunc func(input *cloudwatchevents.DeleteRuleInput) (*cloudwatchevents.DeleteRuleOutput, error)
type removeTargetsFunc func(input *cloudwatchevents.RemoveTargetsInput) (*cloudwatchevents.RemoveTargetsOutput, error)
// A mock implementation of CloudWatchEventClient for use in tests.
type MockCloudWatchEventClient struct {
putRule putRuleFunc
putTargets putTargetsFunc
deleteRule deleteRuleFunc
removeTargets removeTargetsFunc
}
func (c *MockCloudWatchEventClient) SetPutRuleFunc(putRule putRuleFunc) {
c.putRule = putRule
}
func (c *MockCloudWatchEventClient) PutRule(input *cloudwatchevents.PutRuleInput) (
*cloudwatchevents.PutRuleOutput, error) {
if c.putRule != nil {
return c.putRule(input)
}
return nil, nil
}
func (c *MockCloudWatchEventClient) SetPutTargetsFunc(putTargets putTargetsFunc) {
c.putTargets = putTargets
}
func (c *MockCloudWatchEventClient) PutTargets(input *cloudwatchevents.PutTargetsInput) (
*cloudwatchevents.PutTargetsOutput, error) {
if c.putTargets != nil {
return c.putTargets(input)
}
return nil, nil
}
func (c *MockCloudWatchEventClient) SetDeleteRuleFunc(deleteRule deleteRuleFunc) {
c.deleteRule = deleteRule
}
func (c *MockCloudWatchEventClient) DeleteRule(input *cloudwatchevents.DeleteRuleInput) (
*cloudwatchevents.DeleteRuleOutput, error) {
if c.deleteRule != nil {
return c.deleteRule(input)
}
return nil, nil
}
func (c *MockCloudWatchEventClient) SetRemoveTargetsFunc(removeTargets removeTargetsFunc) {
c.removeTargets = removeTargets
}
func (c *MockCloudWatchEventClient) RemoveTargets(input *cloudwatchevents.RemoveTargetsInput) (
*cloudwatchevents.RemoveTargetsOutput, error) {
if c.removeTargets != nil {
return c.removeTargets(input)
}
return nil, nil
}
func NewMockCloudWatchEventClient() interfaces.CloudWatchEventClient {
return &MockCloudWatchEventClient{}
}