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 pathlaunch_plan.go
115 lines (97 loc) · 3.92 KB
/
launch_plan.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package mocks
import (
"context"
"github.com/lyft/flyteadmin/pkg/manager/interfaces"
"github.com/lyft/flyteidl/gen/pb-go/flyteidl/admin"
)
type CreateLaunchPlanFunc func(ctx context.Context, request admin.LaunchPlanCreateRequest) (
*admin.LaunchPlanCreateResponse, error)
type UpdateLaunchPlanFunc func(ctx context.Context, request admin.LaunchPlanUpdateRequest) (
*admin.LaunchPlanUpdateResponse, error)
type GetLaunchPlanFunc func(ctx context.Context, request admin.ObjectGetRequest) (
*admin.LaunchPlan, error)
type GetActiveLaunchPlanFunc func(ctx context.Context, request admin.ActiveLaunchPlanRequest) (
*admin.LaunchPlan, error)
type ListLaunchPlansFunc func(ctx context.Context, request admin.ResourceListRequest) (
*admin.LaunchPlanList, error)
type ListLaunchPlanIdsFunc func(ctx context.Context, request admin.NamedEntityIdentifierListRequest) (
*admin.NamedEntityIdentifierList, error)
type ListActiveLaunchPlansFunc func(ctx context.Context, request admin.ActiveLaunchPlanListRequest) (
*admin.LaunchPlanList, error)
type MockLaunchPlanManager struct {
createLaunchPlanFunc CreateLaunchPlanFunc
updateLaunchPlanFunc UpdateLaunchPlanFunc
getLaunchPlanFunc GetLaunchPlanFunc
getActiveLaunchPlanFunc GetActiveLaunchPlanFunc
listLaunchPlansFunc ListLaunchPlansFunc
listLaunchPlanIdsFunc ListLaunchPlanIdsFunc
listActiveLaunchPlansFunc ListActiveLaunchPlansFunc
}
func (r *MockLaunchPlanManager) SetCreateCallback(createFunction CreateLaunchPlanFunc) {
r.createLaunchPlanFunc = createFunction
}
func (r *MockLaunchPlanManager) CreateLaunchPlan(
ctx context.Context,
request admin.LaunchPlanCreateRequest) (*admin.LaunchPlanCreateResponse, error) {
if r.createLaunchPlanFunc != nil {
return r.createLaunchPlanFunc(ctx, request)
}
return nil, nil
}
func (r *MockLaunchPlanManager) SetUpdateLaunchPlan(updateFunction UpdateLaunchPlanFunc) {
r.updateLaunchPlanFunc = updateFunction
}
func (r *MockLaunchPlanManager) UpdateLaunchPlan(ctx context.Context, request admin.LaunchPlanUpdateRequest) (
*admin.LaunchPlanUpdateResponse, error) {
if r.updateLaunchPlanFunc != nil {
return r.updateLaunchPlanFunc(ctx, request)
}
return nil, nil
}
func (r *MockLaunchPlanManager) GetLaunchPlan(ctx context.Context, request admin.ObjectGetRequest) (
*admin.LaunchPlan, error) {
if r.getLaunchPlanFunc != nil {
return r.getLaunchPlanFunc(ctx, request)
}
return nil, nil
}
func (r *MockLaunchPlanManager) SetGetActiveLaunchPlanCallback(plansFunc GetActiveLaunchPlanFunc) {
r.getActiveLaunchPlanFunc = plansFunc
}
func (r *MockLaunchPlanManager) GetActiveLaunchPlan(ctx context.Context, request admin.ActiveLaunchPlanRequest) (
*admin.LaunchPlan, error) {
if r.getActiveLaunchPlanFunc != nil {
return r.getActiveLaunchPlanFunc(ctx, request)
}
return nil, nil
}
func (r *MockLaunchPlanManager) SetListLaunchPlansCallback(listLaunchPlansFunc ListLaunchPlansFunc) {
r.listLaunchPlansFunc = listLaunchPlansFunc
}
func (r *MockLaunchPlanManager) ListLaunchPlans(ctx context.Context, request admin.ResourceListRequest) (
*admin.LaunchPlanList, error) {
if r.listLaunchPlansFunc != nil {
return r.listLaunchPlansFunc(ctx, request)
}
return nil, nil
}
func (r *MockLaunchPlanManager) SetListActiveLaunchPlansCallback(plansFunc ListActiveLaunchPlansFunc) {
r.listActiveLaunchPlansFunc = plansFunc
}
func (r *MockLaunchPlanManager) ListActiveLaunchPlans(ctx context.Context, request admin.ActiveLaunchPlanListRequest) (
*admin.LaunchPlanList, error) {
if r.listActiveLaunchPlansFunc != nil {
return r.listActiveLaunchPlansFunc(ctx, request)
}
return nil, nil
}
func (r *MockLaunchPlanManager) ListLaunchPlanIds(ctx context.Context, request admin.NamedEntityIdentifierListRequest) (
*admin.NamedEntityIdentifierList, error) {
if r.listLaunchPlanIdsFunc != nil {
return r.ListLaunchPlanIds(ctx, request)
}
return nil, nil
}
func NewMockLaunchPlanManager() interfaces.LaunchPlanInterface {
return &MockLaunchPlanManager{}
}