zero

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package zero contains the pomerium zero configuration API client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is a Pomerium Zero Cluster API client

func NewAPI

func NewAPI(ctx context.Context, opts ...Option) (*API, error)

NewAPI creates a new API client

func (*API) Connect

func (api *API) Connect(ctx context.Context, opts ...fanout.Option) error

Connect connects to the connect API and allows watching for changes

func (*API) DownloadClusterResourceBundle

func (api *API) DownloadClusterResourceBundle(
	ctx context.Context,
	dst io.Writer,
	id string,
	current *DownloadConditional,
) (*DownloadResult, error)

DownloadClusterResourceBundle downloads given cluster resource bundle to given writer.

func (*API) GetClusterBootstrapConfig

func (api *API) GetClusterBootstrapConfig(ctx context.Context) (*cluster_api.BootstrapConfig, error)

GetClusterBootstrapConfig fetches the bootstrap configuration from the cluster API

func (*API) GetClusterResourceBundles

func (api *API) GetClusterResourceBundles(ctx context.Context) (*cluster_api.GetBundlesResponse, error)

GetClusterResourceBundles fetches the resource bundles from the cluster API

func (*API) Report

func (api *API) Report(ctx context.Context, opts ...reporter.Option) error

Report runs metrics reporting to the cloud

func (*API) ReportBundleAppliedFailure

func (api *API) ReportBundleAppliedFailure(
	ctx context.Context,
	bundleID string,
	source cluster_api.BundleStatusFailureSource,
	err error,
) error

ReportBundleAppliedFailure reports a failed bundle application

func (*API) ReportBundleAppliedSuccess

func (api *API) ReportBundleAppliedSuccess(ctx context.Context, bundleID string, metadata map[string]string) error

ReportBundleAppliedSuccess reports a successful bundle application

func (*API) Watch

func (api *API) Watch(ctx context.Context, opts ...WatchOption) error

Watch dispatches API updates

type DownloadConditional

type DownloadConditional struct {
	ETag         string
	LastModified string
}

DownloadConditional contains the conditional headers for a download operation

func (*DownloadConditional) SetHeaders

func (c *DownloadConditional) SetHeaders(req *http.Request) error

SetHeaders sets the conditional headers on the given request

func (*DownloadConditional) Validate

func (c *DownloadConditional) Validate() error

Validate validates the conditional headers

type DownloadResult

type DownloadResult struct {
	// NotModified is true if the bundle has not been modified
	NotModified bool
	// DownloadConditional contains the new conditional
	*DownloadConditional
	// Metadata contains the metadata of the downloaded bundle
	Metadata map[string]string
}

DownloadResult contains the result of a download operation

type Option

type Option func(*config)

Option is a functional option for the SDK

func WithAPIToken

func WithAPIToken(token string) Option

WithAPIToken sets the API token

func WithClusterAPIEndpoint

func WithClusterAPIEndpoint(endpoint string) Option

WithClusterAPIEndpoint sets the cluster API endpoint

func WithConnectAPIEndpoint

func WithConnectAPIEndpoint(endpoint string) Option

WithConnectAPIEndpoint sets the connect API endpoint

func WithDownloadURLCacheTTL

func WithDownloadURLCacheTTL(ttl time.Duration) Option

WithDownloadURLCacheTTL sets the minimum TTL for download URL cache entries

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets the HTTP client

func WithOTELEndpoint

func WithOTELEndpoint(endpoint string) Option

WithOTELEndpoint sets the OTEL API endpoint

type WatchOption

type WatchOption = connect_mux.WatchOption

WatchOption defines which events to watch for

Jump to

Keyboard shortcuts

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