api

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: MIT Imports: 9 Imported by: 5

Documentation

Index

Constants

View Source
const (
	CORTEXCLOUD_API_URL_ENV_VAR                 = "CORTEXCLOUD_API_URL"
	CORTEXCLOUD_API_PORT_ENV_VAR                = "CORTEXCLOUD_API_PORT"
	CORTEXCLOUD_API_KEY_ENV_VAR                 = "CORTEXCLOUD_API_KEY"
	CORTEXCLOUD_API_KEY_ID_ENV_VAR              = "CORTEXCLOUD_API_KEY_ID"
	CORTEXCLOUD_HEADERS_ENV_VAR                 = "CORTEXCLOUD_HEADERS"
	CORTEXCLOUD_AGENT_ENV_VAR                   = "CORTEXCLOUD_AGENT"
	CORTEXCLOUD_SKIP_VERIFY_CERTIFICATE_ENV_VAR = "CORTEXCLOUD_SKIP_VERIFY_CERTIFICATE"
	CORTEXCLOUD_CONFIG_FILE_ENV_VAR             = "CORTEXCLOUD_CONFIG_FILE"
	CORTEXCLOUD_TIMEOUT_ENV_VAR                 = "CORTEXCLOUD_TIMEOUT"
	CORTEXCLOUD_MAX_RETRIES_ENV_VAR             = "CORTEXCLOUD_MAX_RETRIES"
	CORTEXCLOUD_RETRY_MAX_DELAY_ENV_VAR         = "CORTEXCLOUD_RETRY_MAX_DELAY"
	CORTEXCLOUD_CRASH_STACK_DIR_ENV_VAR         = "CORTEXCLOUD_CRASH_STACK_DIR"
	CORTEXCLOUD_LOG_LEVEL_ENV_VAR               = "CORTEXCLOUD_LOG_LEVEL"
	CORTEXCLOUD_SKIP_LOGGING_TRANSPORT_ENV_VAR  = "CORTEXCLOUD_SKIP_LOGGING_TRANSPORT"
	CORTEXCLOUD_SKIP_PRE_REQUEST_VALIDATION     = "CORTEXCLOUD_SKIP_PRE_REQUEST_VALIDATION"
)

Variables

View Source
var (
	GitCommit = "NOCOMMIT"
	GoVersion = runtime.Version()
	BuildDate = ""
)

Functions

This section is empty.

Types

type Config

type Config struct {
	ApiUrl                   string            `json:"api_url" validate:"required,url"`
	ApiKey                   string            `json:"api_key" validate:"required,base64"`
	ApiKeyId                 int               `json:"api_key_id" validate:"required,gte=1"`
	ApiPort                  int               `json:"api_port" validate:"gte=1,lte=65535"`
	Headers                  map[string]string `json:"headers"`
	Agent                    string            `json:"agent"`
	SkipVerifyCertificate    bool              `json:"skip_verify_certificate"`
	Transport                *http.Transport   `json:"-"`
	Timeout                  int               `json:"timeout"`
	MaxRetries               int               `json:"max_retries"`
	RetryMaxDelay            int               `json:"retry_max_delay"`
	CrashStackDir            string            `json:"crash_stack_dir"`
	LogLevel                 string            `json:"log_level"`
	Logger                   _log.Logger       `json:"-"`
	SkipLoggingTransport     bool              `json:"skip_logging_transport"`
	SkipPreRequestValidation bool              `json:"skip_pre_request_validation"`
}

func NewConfig

func NewConfig(apiUrl, apiKey string, apiKeyId int, checkEnvironment bool, opts ...Option) *Config

func NewConfigFromFile

func NewConfigFromFile(filepath string, checkEnvironment bool) (*Config, error)

func (Config) Validate

func (c Config) Validate() error

type Option

type Option func(*Config)

func WithAgent

func WithAgent(agent string) Option

WithAgent returns an Option that sets the Agent field.

func WithApiPort

func WithApiPort(port int) Option

WithApiPort returns an Option that sets the ApiPort field.

func WithCrashStackDir

func WithCrashStackDir(dir string) Option

WithCrashStackDir returns an Option that sets the CrashStackDir field.

func WithHeaders

func WithHeaders(headers map[string]string) Option

WithHeaders returns an Option that sets or adds to the Headers map.

func WithLogLevel

func WithLogLevel(level string) Option

WithLogLevel returns an Option that sets the LogLevel field.

func WithLogger

func WithLogger(l sdkLog.Logger) Option

WithLogger returns an Option that sets the Logger field.

func WithMaxRetries

func WithMaxRetries(retries int) Option

WithMaxRetries returns an Option that sets the MaxRetries field.

func WithRetryMaxDelay

func WithRetryMaxDelay(delay int) Option

WithRetryMaxDelay returns an Option that sets the RetryMaxDelay field (in seconds).

func WithSkipLoggingTransport

func WithSkipLoggingTransport(skip bool) Option

WithSkipLoggingTransport returns an Option that sets the SkipLoggingTransport field.

func WithSkipPreRequestValidation

func WithSkipPreRequestValidation(skip bool) Option

WithSkipPreRequestValidation returns an Option that sets the SkipPreRequestValidation field.

func WithSkipVerifyCertificate

func WithSkipVerifyCertificate(skip bool) Option

WithSkipVerifyCertificate returns an Option that sets the SkipVerifyCertificate field.

func WithTimeout

func WithTimeout(timeout int) Option

WithTimeout returns an Option that sets the Timeout field (in seconds).

func WithTransport

func WithTransport(transport *http.Transport) Option

WithTransport returns an Option that sets the Transport field.

Jump to

Keyboard shortcuts

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