{"modulePath":"github.com/galasa-dev/cli","version":"v0.41.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\n\\* Copyright contributors to the Galasa project \\* \\* SPDX-License-Identifier: EPL-2.0\n\n\\* Copyright contributors to the Galasa project \\* \\* SPDX-License-Identifier: EPL-2.0\n\n\\* Copyright contributors to the Galasa project \\* \\* SPDX-License-Identifier: EPL-2.0\n\n\\* Copyright contributors to the Galasa project \\* \\* SPDX-License-Identifier: EPL-2.0\n\n## Constants\n\n```go\nconst (\n\tBOOTSTRAP_PROPERTY_NAME_REMOTE_API_SERVER_URL              string = \"framework.api.server.url\"\n\tBOOTSTRAP_PROPERTY_NAME_LOCAL_JVM_LAUNCH_OPTIONS           string = \"galasactl.jvm.local.launch.options\"\n\tBOOTSTRAP_PROPERTY_NAME_LOCAL_JVM_LAUNCH_OPTIONS_SEPARATOR string = \" \"\n\n\t// A uint32 value, says which port will be used when the testcase JVM connects to a Java Debugger.\n\tBOOTSTRAP_PROPERTY_NAME_LOCAL_JVM_LAUNCH_DEBUG_PORT string = \"galasactl.jvm.local.launch.debug.port\"\n\t// When the JVM connects to a Java Debugger, should it :\n\t// 'listen' on the debug port, waiting for the java debugger to connect,\n\t// or\n\t// 'attach' to the debug port, which already has the java debugger set up.\n\tBOOTSTRAP_PROPERTY_NAME_LOCAL_JVM_LAUNCH_DEBUG_MODE string = \"galasactl.jvm.local.launch.debug.mode\"\n)\n```\n\n## Functions\n\n```go\nfunc GetBootstrapLocation(env spi.Environment, galasaHome spi.GalasaHome, explicitUserBootstrap string) string\n```\n\n```go\nfunc InitialiseAPI(apiServerUrl string) *galasaapi.APIClient\n```\n\n```go\nfunc InitialiseAuthenticatedAPI(apiServerUrl string, bearerToken string) *galasaapi.APIClient\n```\n\n## Types\n\n```go\ntype APICommsClient interface {\n\tRunCommandWithRateLimitRetries(commandExecutionFunc func() error) error\n\tRunAuthenticatedCommandWithRateLimitRetries(commandExecutionFunc func(apiClient *galasaapi.APIClient) error) error\n\n\tGetBootstrapData() *BootstrapData\n\tGetAuthenticator() spi.Authenticator\n}\n```\nAPICommsClient 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.\n\n```go\nfunc NewAPICommsClient(\n\tbootstrap string,\n\tmaxAttempts int,\n\tretryBackoffSeconds float64,\n\tfactory spi.Factory,\n\tgalasaHome spi.GalasaHome,\n) (APICommsClient, error)\n```\n\n```go\nfunc NewMockAPICommsClient(apiServerUrl string) APICommsClient\n```\n\n```go\ntype APICommsClientImpl struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (commsClient *APICommsClientImpl) GetAuthenticator() spi.Authenticator\n```\n\n```go\nfunc (commsClient *APICommsClientImpl) GetBootstrapData() *BootstrapData\n```\n\n```go\nfunc (commsClient *APICommsClientImpl) RunAuthenticatedCommandWithRateLimitRetries(\n\tcommandExecutionFunc func(apiClient *galasaapi.APIClient) error,\n) error\n```\nRunAuthenticatedCommandWithRateLimitRetries 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.\n\n```go\nfunc (commsClient *APICommsClientImpl) RunCommandWithRateLimitRetries(\n\tcommandExecutionFunc func() error,\n) error\n```\nRunCommandWithRateLimitRetries keeps trying until we've tried enough, it worked, or it's failed too many times with rate limit issues.\n\n```go\ntype BootstrapData struct {\n\t// Path - the raw path that a user has given us, either from the command-line\n\t// option or the GALASA_BOOTSTRAP environment variable.\n\tPath string\n\n\t// URL - The URL on which can be followed to reach the bootstrap contents.\n\tApiServerURL string\n\n\t// Properties - The properties which are read from the bootstrap\n\tProperties props.JavaProperties\n}\n```\n\n```go\nfunc LoadBootstrap(\n\tgalasaHome spi.GalasaHome,\n\tfileSystem spi.FileSystem,\n\tenv spi.Environment,\n\tbootstrapPath string,\n\turlResolutionService UrlResolutionService,\n) (*BootstrapData, error)\n```\nloadBootstrap - 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\n\n```go\ntype RealUrlResolutionService struct {\n}\n```\n\n```go\nfunc (*RealUrlResolutionService) Get(url string) (string, error)\n```\nget - Gets the string contents from a URL\n\n```go\ntype UrlResolutionService interface {\n\tGet(url string) (string, error)\n}\n```\n\n","path":"github.com/galasa-dev/cli/pkg/api","name":"api","synopsis":"* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0","isRedistributable":true}
