(inv *serpent.Invocation)
| 34 | } |
| 35 | |
| 36 | func (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 | |
| 62 | func (r *RootCmd) boundary() *serpent.Command { |
| 63 | version := getBoundaryVersion() |
no test coverage detected