client

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package client contains a client implementation for interfacing with the Phobos server

Index

Constants

View Source
const ServiceDiscoveryPath = "/.well-known/phobos.json"

ServiceDiscoveryPath is the path to the service discovery document.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	AuthSettingsClient       pb.AuthSettingsClient
	OrganizationsClient      pb.OrganizationsClient
	JobsClient               pb.JobsClient
	TeamsClient              pb.TeamsClient
	ProjectsClient           pb.ProjectsClient
	ProjectVariablesClient   pb.ProjectVariablesClient
	PipelinesClient          pb.PipelinesClient
	PipelineTemplatesClient  pb.PipelineTemplatesClient
	AgentsClient             pb.AgentsClient
	EnvironmentsClient       pb.EnvironmentsClient
	ServiceAccountsClient    pb.ServiceAccountsClient
	LifecycleTemplatesClient pb.LifecycleTemplatesClient
	ReleaseLifecyclesClient  pb.ReleaseLifecyclesClient
	ReleasesClient           pb.ReleasesClient
	PluginRegistryClient     pb.PluginRegistryClient
	VCSProvidersClient       pb.VCSProvidersClient
	VersionClient            pb.VersionClient
	// contains filtered or unexported fields
}

Client is the gateway to interact with the Phobos API.

func New

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

New returns a new Client struct.

func (*Client) Close

func (c *Client) Close() error

Close closes any underlying connections for this client.

type Config

type Config struct {
	TokenGetter   TokenGetter
	HTTPEndpoint  string
	TLSSkipVerify bool
	Logger        LeveledLogger
	UserAgent     string
}

Config is used to configure the client

type GRPCDiscoveryDocument

type GRPCDiscoveryDocument struct {
	Host              string `json:"host"`
	TransportSecurity string `json:"transport_security"`
	Port              string `json:"port"`
}

GRPCDiscoveryDocument represents the contents of the GRPC discovery document.

func NewGRPCDiscoveryDocument

func NewGRPCDiscoveryDocument(ctx context.Context, endpoint string, options ...GRPCDiscoveryOption) (*GRPCDiscoveryDocument, error)

NewGRPCDiscoveryDocument returns a new GRPC discovery document. The HTTP get request of the discovery document is done in this function.

func (*GRPCDiscoveryDocument) HasTransportSecurity

func (d *GRPCDiscoveryDocument) HasTransportSecurity() bool

HasTransportSecurity returns true if the GRPC endpoint has transport security enabled.

type GRPCDiscoveryOption added in v0.10.0

type GRPCDiscoveryOption func(*grpcDiscoveryOptions)

GRPCDiscoveryOption is a function that sets options for the GRPC discovery document.

func WithLogger added in v0.10.0

func WithLogger(logger LeveledLogger) GRPCDiscoveryOption

WithLogger sets the logger for the GRPC discovery document.

type LeveledLogger added in v0.10.0

type LeveledLogger interface {
	Error(msg string, keysAndValues ...interface{})
	Info(msg string, keysAndValues ...interface{})
	Debug(msg string, keysAndValues ...interface{})
	Warn(msg string, keysAndValues ...interface{})
}

LeveledLogger is an interface that can be implemented by any logger or a logger wrapper to provide leveled logging. The methods accept a message string and a variadic number of key-value pairs. For log.Printf style formatting where message string contains a format specifier, use Logger interface. This interface has been copied from the retryablehttp package.

type TokenGetter

type TokenGetter interface {
	Token(ctx context.Context) (string, error)
}

TokenGetter is an interface for retrieving and renewing a service account token.

Jump to

Keyboard shortcuts

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