@@ -2,13 +2,14 @@ package client
22
33import (
44 "fmt"
5+
56 "github.com/pkg/errors"
67
78 channels "github.com/replicatedhq/replicated/gen/go/v1"
89 "github.com/replicatedhq/replicated/pkg/types"
910)
1011
11- func (c * Client ) ListChannels (appID string , appType string , appSlug string ) ([]types.Channel , error ) {
12+ func (c * Client ) ListChannels (appID string , appType string , appSlug string , channelName string ) ([]types.Channel , error ) {
1213
1314 if appType == "platform" {
1415 platformChannels , err := c .PlatformClient .ListChannels (appID )
@@ -33,7 +34,7 @@ func (c *Client) ListChannels(appID string, appType string, appSlug string) ([]t
3334 } else if appType == "ship" {
3435 return c .ShipClient .ListChannels (appID )
3536 } else if appType == "kots" {
36- return c .KotsHTTPClient .ListChannels (appID , appSlug )
37+ return c .KotsHTTPClient .ListChannels (appID , appSlug , channelName )
3738 }
3839
3940 return nil , errors .New ("unknown app type" )
@@ -71,7 +72,7 @@ func (c *Client) CreateChannel(appID string, appType string, appSlug string, nam
7172 if err := c .PlatformClient .CreateChannel (appID , name , description ); err != nil {
7273 return nil , err
7374 }
74- return c .ListChannels (appID , appType , appSlug )
75+ return c .ListChannels (appID , appType , appSlug , name )
7576 } else if appType == "ship" {
7677 if _ , err := c .ShipClient .CreateChannel (appID , name , description ); err != nil {
7778 return nil , err
@@ -81,14 +82,14 @@ func (c *Client) CreateChannel(appID string, appType string, appSlug string, nam
8182 if _ , err := c .KotsClient .CreateChannel (appID , name , description ); err != nil {
8283 return nil , err
8384 }
84- return c .KotsHTTPClient .ListChannels (appID , appSlug )
85+ return c .KotsHTTPClient .ListChannels (appID , appSlug , name )
8586 }
8687
8788 return nil , errors .New ("unknown app type" )
8889}
8990
9091func (c * Client ) GetOrCreateChannelByName (appID string , appType string , appSlug string , name string , description string , createIfAbsent bool ) (* types.Channel , error ) {
91- allChannels , err := c .ListChannels (appID , appType , appSlug )
92+ allChannels , err := c .ListChannels (appID , appType , appSlug , name )
9293 if err != nil {
9394 return nil , err
9495 }
0 commit comments