diff --git a/client/entitlements.go b/client/entitlements.go index d2b171dab..c6a28bf96 100644 --- a/client/entitlements.go +++ b/client/entitlements.go @@ -1,11 +1,26 @@ package client import ( + "errors" + "github.com/replicatedhq/replicated/pkg/types" ) func (c *Client) CreateEntitlementSpec(name string, spec string, appID string) (*types.EntitlementSpec, error) { - return c.ShipClient.CreateEntitlementSpec(appID, name, spec) + appType, err := c.GetAppType(appID) + if err != nil { + return nil, err + } + + if appType == "platform" { + return nil, errors.New("This feature is not supported for platform applications.") + } else if appType == "ship" { + c.ShipClient.CreateEntitlementSpec(appID, name, spec) + } 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) SetDefaultEntitlementSpec(specID string) error {