core

package
v0.0.0-...-989e0f7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

This package contains the implementation of the commands used to test each IL2 API.

This package contains the implementation of the commands used to test each IL2 API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatRequestResponseCommandError

func FormatRequestResponseCommandError(err error) error

Formats the errors returned by the API calls in a human readable form that is them wrapped into an error that can be returned to Cobra framework.

This is a quick and dirty way to implement error handling using this framework but may not be the best way to do so.

func LoadJSONFile

func LoadJSONFile(file string, value any) error

Loads a JSON file from a file.

func PrintAsJSON

func PrintAsJSON(o any)

Prints the given object as a JSON into stdout.

func ToPrettyJSON

func ToPrettyJSON(o any) string

Converts the object o into a formatted JSON. It is used to output JSON responses when necessary.

Types

type ApplicationCore

type ApplicationCore struct {
	Config Configuration
}

The application's core type.

var AppCore ApplicationCore

This is the application's core singleton.

func (*ApplicationCore) LoadConfig

func (c *ApplicationCore) LoadConfig(configFile string) error

Loads the configuration from the file.

func (*ApplicationCore) NewClient

func (c *ApplicationCore) NewClient() (*client.APIClient, error)

Creates a new API client based on the loaded configuration.

type Configuration

type Configuration struct {
	Loaded                 bool   `json:"-"`
	BasePath               string `json:"basePath"`
	SkipServerVerification bool   `json:"skipServerVerification"`
	CertFile               string `json:"certFile"`
	KeyFile                string `json:"keyFile"`
	PFXFile                string `json:"pfxFile"`
	PFXPassword            string `json:"pfxPassword"`
}

Structure of the configuration file used by this program.

func (*Configuration) Defaults

func (c *Configuration) Defaults()

Loads the default values.

func (*Configuration) Load

func (c *Configuration) Load(file string) error

Loads the configuration from a file. Missing fields in the file will be set to their default values. On success, the field Loaded will be set to true.

Jump to

Keyboard shortcuts

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