-
Notifications
You must be signed in to change notification settings - Fork 239
/
empty.go
123 lines (92 loc) · 4.85 KB
/
empty.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
package registry
import (
"context"
"errors"
"github.com/operator-framework/operator-registry/pkg/api"
)
// EmptyQuery acts as a "zero value" implementation of the Query interface.
//
// EmptyQuery can be used as a substitute for any operation dependent on Query.
type EmptyQuery struct{}
func (EmptyQuery) ListTables(ctx context.Context) ([]string, error) {
return nil, errors.New("empty querier: cannot list tables")
}
func (EmptyQuery) ListPackages(ctx context.Context) ([]string, error) {
return nil, errors.New("empty querier: cannot list packages")
}
func (EmptyQuery) GetPackage(ctx context.Context, name string) (*PackageManifest, error) {
return nil, errors.New("empty querier: cannot get package")
}
func (EmptyQuery) GetDefaultPackage(ctx context.Context, name string) (string, error) {
return "", errors.New("empty querier: cannot get default package")
}
func (EmptyQuery) GetChannelEntriesFromPackage(ctx context.Context, packageName string) ([]ChannelEntryAnnotated, error) {
return nil, errors.New("empty querier: cannot get all channel entries for package")
}
func (EmptyQuery) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error) {
return nil, errors.New("empty querier: cannot get bundle")
}
func (EmptyQuery) GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (*api.Bundle, error) {
return nil, errors.New("empty querier: cannot get bundle for channel")
}
func (EmptyQuery) GetChannelEntriesThatReplace(ctx context.Context, name string) (entries []*ChannelEntry, err error) {
return nil, errors.New("empty querier: cannot get channel entries that replace")
}
func (EmptyQuery) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error) {
return nil, errors.New("empty querier: cannot get bundle that replaces")
}
func (EmptyQuery) GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error) {
return nil, errors.New("empty querier: cannot get channel entries that provide")
}
func (EmptyQuery) GetLatestChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*ChannelEntry, err error) {
return nil, errors.New("empty querier: cannot get latest channel entries that provide")
}
func (EmptyQuery) GetBundleThatProvides(ctx context.Context, group, version, kind string) (*api.Bundle, error) {
return nil, errors.New("empty querier: cannot get bundle that provides")
}
func (EmptyQuery) ListImages(ctx context.Context) ([]string, error) {
return nil, errors.New("empty querier: cannot get image list")
}
func (EmptyQuery) GetImagesForBundle(ctx context.Context, bundleName string) ([]string, error) {
return nil, errors.New("empty querier: cannot get image list")
}
func (EmptyQuery) GetApisForEntry(ctx context.Context, entryId int64) (provided []*api.GroupVersionKind, required []*api.GroupVersionKind, err error) {
return nil, nil, errors.New("empty querier: cannot apis")
}
func (EmptyQuery) GetBundleVersion(ctx context.Context, image string) (string, error) {
return "", errors.New("empty querier: cannot get version")
}
func (EmptyQuery) GetBundlePathsForPackage(ctx context.Context, pkgName string) ([]string, error) {
return nil, errors.New("empty querier: cannot get images")
}
func (EmptyQuery) GetBundlesForPackage(ctx context.Context, pkgName string) (map[BundleKey]struct{}, error) {
return nil, errors.New("empty querier: cannot get bundles")
}
func (EmptyQuery) GetDefaultChannelForPackage(ctx context.Context, pkgName string) (string, error) {
return "", errors.New("empty querier: cannot get default channel")
}
func (EmptyQuery) ListChannels(ctx context.Context, pkgName string) ([]string, error) {
return nil, errors.New("empty querier: cannot list channels")
}
func (EmptyQuery) GetCurrentCSVNameForChannel(ctx context.Context, pkgName, channel string) (string, error) {
return "", errors.New("empty querier: cannot get csv name for package and channel")
}
func (EmptyQuery) ListBundles(ctx context.Context) ([]*api.Bundle, error) {
return nil, errors.New("empty querier: cannot list bundles")
}
func (EmptyQuery) SendBundles(ctx context.Context, stream BundleSender) error {
return errors.New("empty querier: cannot stream bundles")
}
func (EmptyQuery) GetDependenciesForBundle(ctx context.Context, name, version, path string) (dependencies []*api.Dependency, err error) {
return nil, errors.New("empty querier: cannot get dependencies for bundle")
}
func (EmptyQuery) GetBundlePathIfExists(ctx context.Context, csvName string) (bundlePath string, err error) {
return "", errors.New("empty querier: cannot get bundle path for bundle")
}
func (EmptyQuery) ListRegistryBundles(ctx context.Context) ([]*Bundle, error) {
return nil, errors.New("empty querier: cannot list registry bundles")
}
var _ Query = &EmptyQuery{}
func NewEmptyQuerier() *EmptyQuery {
return &EmptyQuery{}
}