forked from kyma-project/kyma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.go
158 lines (128 loc) · 6.39 KB
/
interfaces.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package servicecatalog
import (
"github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1"
api "github.com/kyma-project/kyma/components/binding-usage-controller/pkg/apis/servicecatalog/v1alpha1"
"github.com/kyma-project/kyma/components/ui-api-layer/internal/domain/content/storage"
"github.com/kyma-project/kyma/components/ui-api-layer/internal/domain/servicecatalog/status"
"github.com/kyma-project/kyma/components/ui-api-layer/internal/gqlschema"
"github.com/kyma-project/kyma/components/ui-api-layer/internal/pager"
"github.com/kyma-project/kyma/components/ui-api-layer/pkg/resource"
)
// Content
//go:generate mockery -name=AsyncApiSpecGetter -output=automock -outpkg=automock -case=underscore
type AsyncApiSpecGetter interface {
Find(kind, id string) (*storage.AsyncApiSpec, error)
}
//go:generate mockery -name=ApiSpecGetter -output=automock -outpkg=automock -case=underscore
type ApiSpecGetter interface {
Find(kind, id string) (*storage.ApiSpec, error)
}
//go:generate mockery -name=ContentGetter -output=automock -outpkg=automock -case=underscore
type ContentGetter interface {
Find(kind, id string) (*storage.Content, error)
}
// Class
//go:generate mockery -name=classGetter -output=automock -outpkg=automock -case=underscore
type classGetter interface {
Find(name string) (*v1beta1.ClusterServiceClass, error)
FindByExternalName(externalName string) (*v1beta1.ClusterServiceClass, error)
}
//go:generate mockery -name=classListGetter -output=automock -outpkg=automock -case=underscore
type classListGetter interface {
classGetter
List(pagingParams pager.PagingParams) ([]*v1beta1.ClusterServiceClass, error)
}
//go:generate mockery -name=gqlClassConverter -output=automock -outpkg=automock -case=underscore
type gqlClassConverter interface {
ToGQL(in *v1beta1.ClusterServiceClass) (*gqlschema.ServiceClass, error)
ToGQLs(in []*v1beta1.ClusterServiceClass) ([]gqlschema.ServiceClass, error)
}
// Instance
//go:generate mockery -name=instanceGetter -output=automock -outpkg=automock -case=underscore
type instanceGetter interface {
Find(name, environment string) (*v1beta1.ServiceInstance, error)
}
//go:generate mockery -name=instanceLister -output=automock -outpkg=automock -case=underscore
type instanceLister interface {
List(environment string, pagingParams pager.PagingParams) ([]*v1beta1.ServiceInstance, error)
ListForStatus(environment string, pagingParams pager.PagingParams, status *status.ServiceInstanceStatusType) ([]*v1beta1.ServiceInstance, error)
}
//go:generate mockery -name=instanceSvc -inpkg -case=underscore
type instanceSvc interface {
instanceGetter
instanceLister
Create(params instanceCreateParameters) (*v1beta1.ServiceInstance, error)
Delete(name, namespace string) error
IsBindable(relatedClass *v1beta1.ClusterServiceClass, relatedPlan *v1beta1.ClusterServicePlan) bool
Subscribe(listener resource.Listener)
Unsubscribe(listener resource.Listener)
}
//go:generate mockery -name=classInstanceLister -output=automock -outpkg=automock -case=underscore
type classInstanceLister interface {
ListForClass(className, externalClassName string) ([]*v1beta1.ServiceInstance, error)
}
//go:generate mockery -name=gqlInstanceConverter -inpkg -case=underscore
type gqlInstanceConverter interface {
ToGQL(in *v1beta1.ServiceInstance) *gqlschema.ServiceInstance
ToGQLs(in []*v1beta1.ServiceInstance) []gqlschema.ServiceInstance
GQLCreateInputToInstanceCreateParameters(in *gqlschema.ServiceInstanceCreateInput) *instanceCreateParameters
ServiceStatusTypeToGQLStatusType(in status.ServiceInstanceStatusType) gqlschema.InstanceStatusType
GQLStatusTypeToServiceStatusType(in gqlschema.InstanceStatusType) status.ServiceInstanceStatusType
GQLStatusToServiceStatus(in *gqlschema.ServiceInstanceStatus) *status.ServiceInstanceStatus
ServiceStatusToGQLStatus(in *status.ServiceInstanceStatus) *gqlschema.ServiceInstanceStatus
}
// Plan
//go:generate mockery -name=planGetter -output=automock -outpkg=automock -case=underscore
type planGetter interface {
Find(name string) (*v1beta1.ClusterServicePlan, error)
FindByExternalNameForClass(planExternalName, className string) (*v1beta1.ClusterServicePlan, error)
}
//go:generate mockery -name=planLister -output=automock -outpkg=automock -case=underscore
type planLister interface {
ListForClass(name string) ([]*v1beta1.ClusterServicePlan, error)
}
//go:generate mockery -name=gqlPlanConverter -output=automock -outpkg=automock -case=underscore
type gqlPlanConverter interface {
ToGQL(item *v1beta1.ClusterServicePlan) (*gqlschema.ServicePlan, error)
ToGQLs(in []*v1beta1.ClusterServicePlan) ([]gqlschema.ServicePlan, error)
}
// Broker
//go:generate mockery -name=brokerGetter -output=automock -outpkg=automock -case=underscore
type brokerGetter interface {
Find(name string) (*v1beta1.ClusterServiceBroker, error)
}
//go:generate mockery -name=brokerLister -output=automock -outpkg=automock -case=underscore
type brokerLister interface {
List(pagingParams pager.PagingParams) ([]*v1beta1.ClusterServiceBroker, error)
}
//go:generate mockery -name=brokerListGetter -output=automock -outpkg=automock -case=underscore
type brokerListGetter interface {
brokerGetter
brokerLister
}
//go:generate mockery -name=gqlBrokerConverter -output=automock -outpkg=automock -case=underscore
type gqlBrokerConverter interface {
ToGQL(in *v1beta1.ClusterServiceBroker) (*gqlschema.ServiceBroker, error)
ToGQLs(in []*v1beta1.ClusterServiceBroker) ([]gqlschema.ServiceBroker, error)
}
// Notifier
type notifier interface {
AddListener(observer resource.Listener)
DeleteListener(observer resource.Listener)
}
// Binding
//go:generate mockery -name=serviceBindingOperations -output=automock -outpkg=automock -case=underscore
type serviceBindingOperations interface {
Create(env string, sb *v1beta1.ServiceBinding) (*v1beta1.ServiceBinding, error)
Delete(env string, name string) error
Find(env string, name string) (*v1beta1.ServiceBinding, error)
ListForServiceInstance(env string, instanceName string) ([]*v1beta1.ServiceBinding, error)
}
// Binding usage
//go:generate mockery -name=serviceBindingUsageOperations -output=automock -outpkg=automock -case=underscore
type serviceBindingUsageOperations interface {
Create(env string, sb *api.ServiceBindingUsage) (*api.ServiceBindingUsage, error)
Delete(env string, name string) error
Find(env string, name string) (*api.ServiceBindingUsage, error)
ListForServiceInstance(env string, instanceName string) ([]*api.ServiceBindingUsage, error)
}