Skip to content

Commit 1f033db

Browse files
authored
platform and kots entitlement error msg (#69)
1 parent 8abf647 commit 1f033db

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

client/entitlements.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
package client
22

33
import (
4+
"errors"
5+
46
"github.com/replicatedhq/replicated/pkg/types"
57
)
68

79
func (c *Client) CreateEntitlementSpec(name string, spec string, appID string) (*types.EntitlementSpec, error) {
8-
return c.ShipClient.CreateEntitlementSpec(appID, name, spec)
10+
appType, err := c.GetAppType(appID)
11+
if err != nil {
12+
return nil, err
13+
}
14+
15+
if appType == "platform" {
16+
return nil, errors.New("This feature is not supported for platform applications.")
17+
} else if appType == "ship" {
18+
c.ShipClient.CreateEntitlementSpec(appID, name, spec)
19+
} else if appType == "kots" {
20+
return nil, errors.New("This feature is not supported for kots applications.")
21+
}
22+
23+
return nil, errors.New("unknown app type")
924
}
1025

1126
func (c *Client) SetDefaultEntitlementSpec(specID string) error {

0 commit comments

Comments
 (0)