api

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: EPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

Index

Constants

View Source
const (
	BOOTSTRAP_PROPERTY_NAME_REMOTE_API_SERVER_URL              string = "framework.api.server.url"
	BOOTSTRAP_PROPERTY_NAME_LOCAL_JVM_LAUNCH_OPTIONS           string = "galasactl.jvm.local.launch.options"
	BOOTSTRAP_PROPERTY_NAME_LOCAL_JVM_LAUNCH_OPTIONS_SEPARATOR string = " "

	// A uint32 value, says which port will be used when the testcase JVM connects to a Java Debugger.
	BOOTSTRAP_PROPERTY_NAME_LOCAL_JVM_LAUNCH_DEBUG_PORT string = "galasactl.jvm.local.launch.debug.port"
	// When the JVM connects to a Java Debugger, should it :
	// 'listen' on the debug port, waiting for the java debugger to connect,
	// or
	// 'attach' to the debug port, which already has the java debugger set up.
	BOOTSTRAP_PROPERTY_NAME_LOCAL_JVM_LAUNCH_DEBUG_MODE string = "galasactl.jvm.local.launch.debug.mode"
)

Variables

This section is empty.

Functions

func GetBootstrapLocation added in v0.34.0

func GetBootstrapLocation(env spi.Environment, galasaHome spi.GalasaHome, explicitUserBootstrap string) string

func InitialiseAPI

func InitialiseAPI(apiServerUrl string) *galasaapi.APIClient

func InitialiseAuthenticatedAPI

func InitialiseAuthenticatedAPI(apiServerUrl string, bearerToken string) *galasaapi.APIClient

Types

type APICommsClient added in v0.40.0

type APICommsClient interface {
	RunCommandWithRateLimitRetries(commandExecutionFunc func() error) error
	RunAuthenticatedCommandWithRateLimitRetries(commandExecutionFunc func(apiClient *galasaapi.APIClient) error) error

	GetBootstrapData() *BootstrapData
	GetAuthenticator() spi.Authenticator
}

APICommsClient acts as a smarter client for API server communications with the ability to retry functions that send requests to the Galasa API server in the event of rate-limiting or auth-related errors. It also loads the bootstrap information from a given location so that consumers can pull the bootstrap data out from this comms client as needed.

func NewAPICommsClient added in v0.40.0

func NewAPICommsClient(
	bootstrap string,
	maxAttempts int,
	retryBackoffSeconds float64,
	factory spi.Factory,
	galasaHome spi.GalasaHome,
) (APICommsClient, error)

func NewMockAPICommsClient added in v0.40.0

func NewMockAPICommsClient(apiServerUrl string) APICommsClient

type APICommsClientImpl added in v0.40.0

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

func (*APICommsClientImpl) GetAuthenticator added in v0.40.0

func (commsClient *APICommsClientImpl) GetAuthenticator() spi.Authenticator

func (*APICommsClientImpl) GetBootstrapData added in v0.40.0

func (commsClient *APICommsClientImpl) GetBootstrapData() *BootstrapData

func (*APICommsClientImpl) RunAuthenticatedCommandWithRateLimitRetries added in v0.40.0

func (commsClient *APICommsClientImpl) RunAuthenticatedCommandWithRateLimitRetries(
	commandExecutionFunc func(apiClient *galasaapi.APIClient) error,
) error

RunAuthenticatedCommandWithRateLimitRetries tries to run a given execution function until we've tried enough, it worked, or it has failed too many times with rate limit or auth issues. If an unauthorized error is encountered, then this function will attempt to re-authenticate with the API server.

func (*APICommsClientImpl) RunCommandWithRateLimitRetries added in v0.40.0

func (commsClient *APICommsClientImpl) RunCommandWithRateLimitRetries(
	commandExecutionFunc func() error,
) error

RunCommandWithRateLimitRetries keeps trying until we've tried enough, it worked, or it's failed too many times with rate limit issues.

type BootstrapData

type BootstrapData struct {
	// Path - the raw path that a user has given us, either from the command-line
	// option or the GALASA_BOOTSTRAP environment variable.
	Path string

	// URL - The URL on which can be followed to reach the bootstrap contents.
	ApiServerURL string

	// Properties - The properties which are read from the bootstrap
	Properties props.JavaProperties
}

func LoadBootstrap

func LoadBootstrap(
	galasaHome spi.GalasaHome,
	fileSystem spi.FileSystem,
	env spi.Environment,
	bootstrapPath string,
	urlResolutionService UrlResolutionService,
) (*BootstrapData, error)

loadBootstrap - Loads the contents of a bootstrap file into memory. bootstrapPath - Where do we find the bootstrap contents from ? This can be a URL must end in /bootstrap

type RealUrlResolutionService

type RealUrlResolutionService struct {
}

func (*RealUrlResolutionService) Get

get - Gets the string contents from a URL

type UrlResolutionService

type UrlResolutionService interface {
	Get(url string) (string, error)
}

Jump to

Keyboard shortcuts

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