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

     1  package get
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/go-errors/errors"
     8  	"github.com/spf13/afero"
     9  	"github.com/supabase/cli/internal/utils"
    10  )
    11  
    12  func Run(ctx context.Context, projectRef string, fsys afero.Fs) error {
    13  	// 1. Sanity checks.
    14  	// 2. get network bans
    15  	{
    16  		resp, err := utils.GetSupabase().GetNetworkBansWithResponse(ctx, projectRef)
    17  		if err != nil {
    18  			return errors.Errorf("failed to retrieve network bans: %w", err)
    19  		}
    20  		if resp.JSON201 == nil {
    21  			return errors.New("Unexpected error retrieving network bans: " + string(resp.Body))
    22  		}
    23  		fmt.Printf("DB banned IPs: %+v\n", resp.JSON201.BannedIpv4Addresses)
    24  		return nil
    25  	}
    26  }