github.com/supabase/cli@v1.168.1/internal/sso/list/list.go (about) 1 package list 2 3 import ( 4 "context" 5 "net/http" 6 "os" 7 8 "github.com/go-errors/errors" 9 "github.com/supabase/cli/internal/sso/internal/render" 10 "github.com/supabase/cli/internal/utils" 11 ) 12 13 func Run(ctx context.Context, ref, format string) error { 14 resp, err := utils.GetSupabase().ListAllProvidersWithResponse(ctx, ref) 15 if err != nil { 16 return errors.Errorf("failed to list sso providers: %w", err) 17 } 18 19 if resp.JSON200 == nil { 20 if resp.StatusCode() == http.StatusNotFound { 21 return errors.New("Looks like SAML 2.0 support is not enabled for this project. Please use the dashboard to enable it.") 22 } 23 24 return errors.New("unexpected error listing identity providers: " + string(resp.Body)) 25 } 26 27 switch format { 28 case utils.OutputPretty: 29 return render.ListMarkdown(resp.JSON200.Items) 30 31 default: 32 return utils.EncodeOutput(format, os.Stdout, map[string]any{ 33 "providers": resp.JSON200.Items, 34 }) 35 } 36 }