@@ -9,14 +9,13 @@ import (
9
9
10
10
"github.com/operator-framework/operator-registry/pkg/api"
11
11
"github.com/operator-framework/operator-registry/pkg/api/grpc_health_v1"
12
- "github.com/operator-framework/operator-registry/pkg/registry"
13
12
)
14
13
15
14
type Interface interface {
16
- GetBundle (ctx context.Context , packageName , channelName , csvName string ) (* registry .Bundle , error )
17
- GetBundleInPackageChannel (ctx context.Context , packageName , channelName string ) (* registry .Bundle , error )
18
- GetReplacementBundleInPackageChannel (ctx context.Context , currentName , packageName , channelName string ) (* registry .Bundle , error )
19
- GetBundleThatProvides (ctx context.Context , group , version , kind string ) (* registry .Bundle , error )
15
+ GetBundle (ctx context.Context , packageName , channelName , csvName string ) (* api .Bundle , error )
16
+ GetBundleInPackageChannel (ctx context.Context , packageName , channelName string ) (* api .Bundle , error )
17
+ GetReplacementBundleInPackageChannel (ctx context.Context , currentName , packageName , channelName string ) (* api .Bundle , error )
18
+ GetBundleThatProvides (ctx context.Context , group , version , kind string ) (* api .Bundle , error )
20
19
HealthCheck (ctx context.Context , reconnectTimeout time.Duration ) (bool , error )
21
20
Close () error
22
21
}
@@ -29,40 +28,20 @@ type Client struct {
29
28
30
29
var _ Interface = & Client {}
31
30
32
- func (c * Client ) GetBundle (ctx context.Context , packageName , channelName , csvName string ) (* registry.Bundle , error ) {
33
- bundle , err := c .Registry .GetBundle (ctx , & api.GetBundleRequest {PkgName : packageName , ChannelName : channelName , CsvName : csvName })
34
- if err != nil {
35
- return nil , err
36
- }
37
- return registry .NewBundleFromStrings (bundle .CsvName , bundle .PackageName , bundle .ChannelName , bundle .Object )
31
+ func (c * Client ) GetBundle (ctx context.Context , packageName , channelName , csvName string ) (* api.Bundle , error ) {
32
+ return c .Registry .GetBundle (ctx , & api.GetBundleRequest {PkgName : packageName , ChannelName : channelName , CsvName : csvName })
38
33
}
39
34
40
- func (c * Client ) GetBundleInPackageChannel (ctx context.Context , packageName , channelName string ) (* registry.Bundle , error ) {
41
- bundle , err := c .Registry .GetBundleForChannel (ctx , & api.GetBundleInChannelRequest {PkgName : packageName , ChannelName : channelName })
42
- if err != nil {
43
- return nil , err
44
- }
45
- return registry .NewBundleFromStrings (bundle .CsvName , packageName , channelName , bundle .Object )
35
+ func (c * Client ) GetBundleInPackageChannel (ctx context.Context , packageName , channelName string ) (* api.Bundle , error ) {
36
+ return c .Registry .GetBundleForChannel (ctx , & api.GetBundleInChannelRequest {PkgName : packageName , ChannelName : channelName })
46
37
}
47
38
48
- func (c * Client ) GetReplacementBundleInPackageChannel (ctx context.Context , currentName , packageName , channelName string ) (* registry.Bundle , error ) {
49
- bundle , err := c .Registry .GetBundleThatReplaces (ctx , & api.GetReplacementRequest {CsvName : currentName , PkgName : packageName , ChannelName : channelName })
50
- if err != nil {
51
- return nil , err
52
- }
53
- return registry .NewBundleFromStrings (bundle .CsvName , packageName , channelName , bundle .Object )
39
+ func (c * Client ) GetReplacementBundleInPackageChannel (ctx context.Context , currentName , packageName , channelName string ) (* api.Bundle , error ) {
40
+ return c .Registry .GetBundleThatReplaces (ctx , & api.GetReplacementRequest {CsvName : currentName , PkgName : packageName , ChannelName : channelName })
54
41
}
55
42
56
- func (c * Client ) GetBundleThatProvides (ctx context.Context , group , version , kind string ) (* registry.Bundle , error ) {
57
- bundle , err := c .Registry .GetDefaultBundleThatProvides (ctx , & api.GetDefaultProviderRequest {Group : group , Version : version , Kind : kind })
58
- if err != nil {
59
- return nil , err
60
- }
61
- parsedBundle , err := registry .NewBundleFromStrings (bundle .CsvName , bundle .PackageName , bundle .ChannelName , bundle .Object )
62
- if err != nil {
63
- return nil , err
64
- }
65
- return parsedBundle , nil
43
+ func (c * Client ) GetBundleThatProvides (ctx context.Context , group , version , kind string ) (* api.Bundle , error ) {
44
+ return c .Registry .GetDefaultBundleThatProvides (ctx , & api.GetDefaultProviderRequest {Group : group , Version : version , Kind : kind })
66
45
}
67
46
68
47
func (c * Client ) Close () error {
0 commit comments