Skip to content
Merged
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
17 changes: 16 additions & 1 deletion client/entitlements.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down