pb

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	GatewayKeyHeader  = "X-Pbctl-Gateway-Key"
	ImpersonateHeader = "X-Pbctl-As"
	GuardStatusPath   = "/api/pbctl/guard"
)

Variables

This section is empty.

Functions

func TokenClaims

func TokenClaims(token string) map[string]any

func TokenExpiry

func TokenExpiry(token string) time.Time

Types

type APIError

type APIError struct {
	Method  string
	Path    string
	Status  int
	Message string
	Data    map[string]any
}

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) FieldErrors

func (e *APIError) FieldErrors() []string

type AuthError

type AuthError struct {
	Reason string
}

func (*AuthError) Error

func (e *AuthError) Error() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(options Options) (*Client, error)

func (*Client) BaseURL

func (c *Client) BaseURL() string

func (*Client) Do

func (c *Client) Do(ctx context.Context, request Request) (*http.Response, error)

func (*Client) FileToken

func (c *Client) FileToken(ctx context.Context) (string, error)

func (*Client) GuardStatus

func (c *Client) GuardStatus(ctx context.Context) (*GuardStatus, error)

func (*Client) Host

func (c *Client) Host() string

func (*Client) JSON

func (c *Client) JSON(ctx context.Context, method, path string, query url.Values, body, out any) error

func (*Client) Login

func (c *Client) Login(ctx context.Context, collection, identity, password string) (string, error)

func (*Client) Token

func (c *Client) Token(ctx context.Context) (string, error)

func (*Client) URL

func (c *Client) URL(path string, query url.Values) string

type DryRunError

type DryRunError struct {
	Method string
	URL    string
	Body   []byte
}

func (*DryRunError) Error

func (e *DryRunError) Error() string

type GuardStatus

type GuardStatus struct {
	ReadOnly   bool   `json:"readOnly"`
	EnforcedBy string `json:"enforcedBy"`
}

type Options

type Options struct {
	ProfileName    string
	Profile        *config.Profile
	ReadOnlySource string
	DryRun         bool
	Timeout        time.Duration
	Impersonate    string
	Version        string
}

type Request

type Request struct {
	Method      string
	Path        string
	Query       url.Values
	Body        []byte
	BodyStream  io.Reader
	ContentType string
	Anonymous   bool
	Streaming   bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL