MCPcopy Index your code
hub / github.com/coder/coder / verifyLicense

Method verifyLicense

enterprise/cli/boundary.go:36–60  ·  view source on GitHub ↗
(inv *serpent.Invocation)

Source from the content-addressed store, hash-verified

34}
35
36func (r *RootCmd) verifyLicense(inv *serpent.Invocation) error {
37 client, err := r.InitClient(inv)
38 if err != nil {
39 return err
40 }
41
42 entitlements, err := client.Entitlements(inv.Context())
43 if cerr, ok := codersdk.AsError(err); ok && cerr.StatusCode() == http.StatusNotFound {
44 return xerrors.Errorf("your deployment appears to be an AGPL deployment, so you cannot use the boundary command")
45 } else if err != nil {
46 return xerrors.Errorf("failed to get entitlements: %w", err)
47 }
48
49 feature := entitlements.Features[codersdk.FeatureBoundary]
50 if feature.Entitlement == codersdk.EntitlementNotEntitled {
51 return xerrors.Errorf("your license is not entitled to use the boundary feature")
52 }
53 if !feature.Enabled {
54 // Feature is entitled but disabled (shouldn't happen for FeatureBoundary
55 // since it's in AlwaysEnable(), but handle it gracefully).
56 return xerrors.Errorf("the boundary feature is disabled in your deployment configuration")
57 }
58
59 return nil
60}
61
62func (r *RootCmd) boundary() *serpent.Command {
63 version := getBoundaryVersion()

Callers 1

boundaryMethod · 0.95

Calls 6

InitClientMethod · 0.95
AsErrorFunction · 0.92
EntitlementsMethod · 0.80
ContextMethod · 0.65
StatusCodeMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected