From 342dc0a77b93a18ac4099d6e2476a48f8a70bec4 Mon Sep 17 00:00:00 2001 From: William-Rom Date: Tue, 4 Aug 2026 13:26:35 +0200 Subject: [PATCH] feat: make intility inference generally available --- pkg/clientset/clientset.go | 27 --------------------------- pkg/rootcommand/rootcommand.go | 3 +-- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/pkg/clientset/clientset.go b/pkg/clientset/clientset.go index 83eed65..58d402e 100644 --- a/pkg/clientset/clientset.go +++ b/pkg/clientset/clientset.go @@ -21,7 +21,6 @@ const homeAccountIDParts = 2 var ( errNotAuthenticatedPreHook = errors.New("you need to sign in before executing this operation") errInvalidHomeAccountID = errors.New("invalid HomeAccountID format") - errFeatureNotAvailable = errors.New("this feature is not available for your tenant") ) type Authenticator interface { @@ -109,32 +108,6 @@ func fqcn(cmd *cobra.Command) string { return name } -// EnsureAITenantPreHook is a pre-run hook that checks if the current tenant -// has access to AI features. It composes EnsureSignedIn so auth is checked first. -func (c *ClientSet) EnsureAITenantPreHook(cmd *cobra.Command, args []string) error { - return c.PreHooks(c.EnsureSignedIn, c.ensureAITenant)(cmd, args) -} - -func (c *ClientSet) ensureAITenant(cmd *cobra.Command, _ []string) error { - allowedTenants := map[string]bool{ - "9b5ff18e-53c0-45a2-8bc2-9c0c8f60b2c6": true, // intility - "f0a51c83-6cc9-4830-9d01-d4d18c068e32": true, // skoglab - } - - tenantID, err := c.GetTenantID(cmd.Context()) - if err != nil { - return fmt.Errorf("could not determine tenant: %w", err) - } - - if !allowedTenants[tenantID] { - cmd.SilenceUsage = true - - return errFeatureNotAvailable - } - - return nil -} - // GetTenantID extracts the tenant ID from the current account's HomeAccountID. // The HomeAccountID format is "." where tid is the tenant ID. func (c *ClientSet) GetTenantID(ctx context.Context) (string, error) { diff --git a/pkg/rootcommand/rootcommand.go b/pkg/rootcommand/rootcommand.go index e481ab7..baf9d10 100644 --- a/pkg/rootcommand/rootcommand.go +++ b/pkg/rootcommand/rootcommand.go @@ -176,8 +176,7 @@ func getAICommand(set clientset.ClientSet) *cobra.Command { Use: "ai", Short: "Manage Intility Developer Platform AI Deployments", Long: "Manage Intility Developer Platform AI Deployments", - Hidden: true, - PersistentPreRunE: set.EnsureAITenantPreHook, + PersistentPreRunE: set.EnsureSignedInPreHook, Run: showHelp, }