@@ -9,14 +9,13 @@ import (
99
1010 "github.com/operator-framework/operator-registry/pkg/api"
1111 "github.com/operator-framework/operator-registry/pkg/api/grpc_health_v1"
12- "github.com/operator-framework/operator-registry/pkg/registry"
1312)
1413
1514type 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 )
2019 HealthCheck (ctx context.Context , reconnectTimeout time.Duration ) (bool , error )
2120 Close () error
2221}
@@ -29,40 +28,20 @@ type Client struct {
2928
3029var _ Interface = & Client {}
3130
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 })
3833}
3934
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 })
4637}
4738
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 })
5441}
5542
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 })
6645}
6746
6847func (c * Client ) Close () error {
0 commit comments