-
Notifications
You must be signed in to change notification settings - Fork 6
/
apisix.go
72 lines (58 loc) · 1.36 KB
/
apisix.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
package apisix
import (
"context"
"github.com/api7/adc/pkg/api/apisix/types"
)
type Cluster interface {
Route() Route
Service() Service
Consumer() Consumer
SSL() SSL
GlobalRule() GlobalRule
PluginConfig() PluginConfig
ConsumerGroup() ConsumerGroup
PluginMetadata() PluginMetadata
StreamRoute() StreamRoute
Upstream() Upstream
Ping() error
SupportValidate() (bool, error)
SupportStreamRoute() (bool, error)
}
type ResourceClient[T any] interface {
Get(ctx context.Context, name string) (*T, error)
List(ctx context.Context) ([]*T, error)
Create(ctx context.Context, ups *T) (*T, error)
Delete(ctx context.Context, name string) error
Update(ctx context.Context, ups *T) (*T, error)
Validate(ctx context.Context, resource *T) error
}
type Route interface {
ResourceClient[types.Route]
}
type Service interface {
ResourceClient[types.Service]
}
type Consumer interface {
ResourceClient[types.Consumer]
}
type SSL interface {
ResourceClient[types.SSL]
}
type GlobalRule interface {
ResourceClient[types.GlobalRule]
}
type PluginConfig interface {
ResourceClient[types.PluginConfig]
}
type ConsumerGroup interface {
ResourceClient[types.ConsumerGroup]
}
type PluginMetadata interface {
ResourceClient[types.PluginMetadata]
}
type StreamRoute interface {
ResourceClient[types.StreamRoute]
}
type Upstream interface {
ResourceClient[types.Upstream]
}