Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions cli/cmd/channel_adoption.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,25 @@ func (r *runners) channelAdoption(cmd *cobra.Command, args []string) error {
}
chanID := args[0]

appChan, _, err := r.platformAPI.GetChannel(r.appID, chanID)
appType, err := r.api.GetAppType(r.appID)
if err != nil {
return err
}

if err = print.ChannelAdoption(r.w, appChan.Adoption); err != nil {
return err
if appType == "platform" {
appChan, _, err := r.platformAPI.GetChannel(r.appID, chanID)
if err != nil {
return err
}

if err = print.ChannelAdoption(r.w, appChan.Adoption); err != nil {
return err
}

} else if appType == "ship" {
return errors.New("This feature is not supported for Ship applications.")
} else if appType == "kots" {
return errors.New("This feature is not supported for Kots applications.")
}

return nil
Expand Down
17 changes: 14 additions & 3 deletions cli/cmd/channel_counts.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,24 @@ func (r *runners) channelCounts(cmd *cobra.Command, args []string) error {
}
chanID := args[0]

appChan, _, err := r.platformAPI.GetChannel(r.appID, chanID)
appType, err := r.api.GetAppType(r.appID)
if err != nil {
return err
}

if err = print.LicenseCounts(r.w, appChan.LicenseCounts); err != nil {
return err
if appType == "platform" {
appChan, _, err := r.api.GetChannel(r.appID, chanID)
if err != nil {
return err
}

if err = print.LicenseCounts(r.w, appChan.LicenseCounts); err != nil {
return err
}
} else if appType == "ship" {
return errors.New("This feature is not supported for Ship applications.")
} else if appType == "kots" {
return errors.New("This feature is not supported for Kots applications.")
}

return nil
Expand Down
18 changes: 15 additions & 3 deletions cli/cmd/channel_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,25 @@ func (r *runners) channelReleases(cmd *cobra.Command, args []string) error {
}
chanID := args[0]

_, releases, err := r.platformAPI.GetChannel(r.appID, chanID)
appType, err := r.api.GetAppType(r.appID)
if err != nil {
return err
}

if err = print.ChannelReleases(r.w, releases); err != nil {
return err
if appType == "platform" {

_, releases, err := r.api.GetChannel(r.appID, chanID)
if err != nil {
return err
}

if err = print.ChannelReleases(r.w, releases); err != nil {
return err
}
} else if appType == "ship" {
return errors.New("This feature is not supported for Ship applications.")
} else if appType == "kots" {
return errors.New("This feature is not supported for Kots applications.")
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/release_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (r *runners) releaseInspect(cmd *cobra.Command, args []string) error {
return fmt.Errorf("Failed to parse sequence argument %s", args[0])
}

release, err := r.platformAPI.GetRelease(r.appID, seq)
release, err := r.api.GetRelease(r.appID, seq)
if err != nil {
if err == platformclient.ErrNotFound {
return fmt.Errorf("No such release %d", seq)
Expand Down
17 changes: 15 additions & 2 deletions client/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package client
import (
"errors"

releases "github.com/replicatedhq/replicated/gen/go/v1"
"github.com/replicatedhq/replicated/pkg/types"
)

Expand Down Expand Up @@ -143,8 +144,20 @@ func (c *Client) UpdateRelease(appID string, sequence int64, yaml string) error
return errors.New("unknown app type")
}

func (c *Client) GetRelease(appID string, sequence int64) (interface{}, error) {
return nil, nil
func (c *Client) GetRelease(appID string, sequence int64) (*releases.AppRelease, error) {
appType, err := c.GetAppType(appID)
if err != nil {
return nil, err
}

if appType == "platform" {
return c.PlatformClient.GetRelease(appID, sequence)
} else if appType == "ship" {
return nil, errors.New("This feature is not supported for Ship applications.")
} else if appType == "kots" {
return nil, errors.New("This feature is not supported for Kots applications.")
}
return nil, errors.New("unknown app type")
}

func (c *Client) PromoteRelease(appID string, sequence int64, label string, notes string, required bool, channelIDs ...string) error {
Expand Down