endpoint

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SCSConfigPath is the path to the exposed configuration information of an SCS / Singularity Enterprise instance.
	SCSConfigPath = "/assets/config/config.prod.json"
	// SCSDefaultCloudURI is the primary hostname for Sylabs Singularity Container Services.
	SCSDefaultCloudURI = "cloud.sylabs.io"
	// SCSDefaultLibraryURI is the URI for the library service in SCS.
	SCSDefaultLibraryURI = "https://library.sylabs.io"
	// SCSDefaultKeyserverURI is the URI for the keyserver service in SCS.
	SCSDefaultKeyserverURI = "https://keys.sylabs.io"
	// SCSDefaultBuilderURI is the URI for the remote build service in SCS.
	SCSDefaultBuilderURI = "https://build.sylabs.io"
)

Default Sylabs cloud service endpoints.

View Source
const (
	Consent   = "consent"
	Token     = "token"
	Library   = "library"
	Keystore  = "keystore" // alias for keyserver
	Keyserver = "keyserver"
	Builder   = "builder"
)

SCS cloud services - suffixed with 'API' in config.prod.json.

View Source
const RegistryURIConfigKey = "registryUri"

RegistryURIConfigKey is the config key for the library OCI registry URI

Variables

View Source
var DefaultEndpointConfig = &Config{
	URI:    SCSDefaultCloudURI,
	System: true,
}

DefaultEndpointConfig is the default remote configuration.

View Source
var ErrNoURI = errors.New("no URI set for endpoint")
View Source
var ErrStatusNotSupported = errors.New("status not supported")

ErrStatusNotSupported represents the error returned by a service which doesn't support SCS status check.

Functions

This section is empty.

Types

type Config

type Config struct {
	URI        string           `yaml:"URI,omitempty"` // hostname/path - no protocol expected
	Token      string           `yaml:"Token,omitempty"`
	System     bool             `yaml:"System"`             // Was this EndPoint set from system config file
	Exclusive  bool             `yaml:"Exclusive"`          // true if the endpoint must be used exclusively
	Insecure   bool             `yaml:"Insecure,omitempty"` // Allow use of http for service discovery
	Keyservers []*ServiceConfig `yaml:"Keyservers,omitempty"`
	// contains filtered or unexported fields
}

Config describes a single remote endpoint.

func (*Config) AddKeyserver

func (ep *Config) AddKeyserver(uri string, order uint32, insecure bool) error

AddKeyserver adds a keyserver for the corresponding remote endpoint.

func (*Config) BuilderClientConfig

func (ep *Config) BuilderClientConfig(uri string) (baseURI, authToken string, err error)

BuilderClientConfig returns the baseURI and authToken associated with ep, in the context of uri.

func (*Config) GetAllServices

func (ep *Config) GetAllServices() (map[string][]Service, error)

func (*Config) GetServiceURI

func (ep *Config) GetServiceURI(service string) (string, error)

GetServiceURI returns the URI for the service at the specified SCS endpoint Examples of services: consent, build, library, key, token

func (*Config) GetURL

func (e *Config) GetURL() (string, error)

GetUrl returns a URL with the correct https or http protocol for the endpoint. The protocol depends on whether the endpoint is set 'Insecure'.

func (*Config) KeyserverClientOpts

func (ep *Config) KeyserverClientOpts(uri string, op KeyserverOp) ([]keyclient.Option, error)

func (*Config) LibraryClientConfig

func (ep *Config) LibraryClientConfig(uri string) (*libclient.Config, error)

func (*Config) RegistryURI

func (ep *Config) RegistryURI() (string, error)

RegistryURI returns the URI of the backing OCI registry for the library service, associated with ep.

func (*Config) RemoveKeyserver

func (ep *Config) RemoveKeyserver(uri string) error

RemoveKeyserver removes a previously added keyserver.

func (*Config) SetCredentials

func (e *Config) SetCredentials(creds []*credential.Config)

func (*Config) UpdateKeyserversConfig

func (ep *Config) UpdateKeyserversConfig() error

UpdateKeyserversConfig updates the keyserver configuration for the corresponding remote endpoint.

func (*Config) VerifyToken

func (ep *Config) VerifyToken(token string) (err error)

VerifyToken returns an error if a token is not valid against an endpoint. If token is provided as an argument, it will verify the provided token. If token is "", it will attempt to verify the configured token for the endpoint.

type KeyserverOp

type KeyserverOp uint8

KeyserverOp represents a keyserver operation type.

const (
	// KeyserverPushOp represents a key push operation.
	KeyserverPushOp KeyserverOp = iota
	// KeyserverPullOp represents a key pull operation.
	KeyserverPullOp
	// KeyserverSearchOp represents a key search operation.
	KeyserverSearchOp
	// KeyserverVerifyOp represents a key verification operation.
	KeyserverVerifyOp
)

type Service

type Service interface {
	// URI returns the URI used to access the remote service.
	URI() string
	// Status returns the status of the remote service, if supported.
	Status() (string, error)
	// contains filtered or unexported methods
}

Service represents a remote service, accessible at Service.URI

type ServiceConfig

type ServiceConfig struct {
	URI      string `yaml:"URI"`
	Skip     bool   `yaml:"Skip"`
	External bool   `yaml:"External"`
	Insecure bool   `yaml:"Insecure"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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