github.com/supabase/cli@v1.168.1/internal/restrictions/get/get.go (about)

     1  package get
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/go-errors/errors"
     8  	"github.com/supabase/cli/internal/utils"
     9  )
    10  
    11  func Run(ctx context.Context, projectRef string) error {
    12  	resp, err := utils.GetSupabase().GetNetworkRestrictionsWithResponse(ctx, projectRef)
    13  	if err != nil {
    14  		return errors.Errorf("failed to retrieve network restrictions: %w", err)
    15  	}
    16  	if resp.JSON200 == nil {
    17  		return errors.New("failed to retrieve network restrictions; received: " + string(resp.Body))
    18  	}
    19  
    20  	fmt.Printf("DB Allowed IPv4 CIDRs: %+v\n", resp.JSON200.Config.DbAllowedCidrs)
    21  	fmt.Printf("DB Allowed IPv6 CIDRs: %+v\n", resp.JSON200.Config.DbAllowedCidrsV6)
    22  	fmt.Printf("Restrictions applied successfully: %+v\n", resp.JSON200.Status == "applied")
    23  	return nil
    24  }