zerosdk

package module
v0.0.0-...-cbf242d Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

README

zero-sdk

Pomerium Zero SDK

Documentation

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) 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
}

func (*DownloadConditional) SetHeaders

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

func (*DownloadConditional) Validate

func (c *DownloadConditional) Validate() error

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)

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

type WatchOption

type WatchOption = connect_mux.WatchOption

WatchOption defines which events to watch for

Directories

Path Synopsis
Package cluster provides primitives to interact with the openapi HTTP API.
Package cluster provides primitives to interact with the openapi HTTP API.
Package mux provides the way to listen for updates from the cloud
Package mux provides the way to listen for updates from the cloud

Jump to

Keyboard shortcuts

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