rest

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRedirectCount = 10

Max number of times we will chase a redirect before failing.

Variables

View Source
var ServerCertificateFile = envDefault("EGO_CERT_FILE", "https-server.crt")

ServerCertificateFile is the default file name for the server certificate.

View Source
var ServerKeyFile = envDefault("EGO_KEY_FILE", "https-server.key")

ServerKeyFile is the default file name for the server key.

Functions

func AddAgent

func AddAgent(r *resty.Request, agentType string)

func AllowInsecure

func AllowInsecure(flag bool)

Externalized function that sets the "insecure" flag, which turns off server validation. This is called from the CLI parsing action when "--insecure" is specified as a global option in the Ego command line.

func Auth

func Auth(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Auth implements the Auth() rest function. When present, it accepts a username and password as parameters, and sets the rest client to use BasicAuth authentication, where the username and password are part of an Authentication header.

func Base

func Base(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Base implements the Base() rest function. This specifies a string that is used as the base prefix for any URL formed in a REST call. This lets you specify the protocol/host/port information once, and then have each Get(), Post(), etc. call just specify the endpoint.

func Close

func Close(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

func Debug

func Debug(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Debug implements the Debug() rest function. This specifies a boolean value that enables or disables debug logging for the client.

func Delete

func Delete(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Delete implements the Delete() rest function.

func Exchange

func Exchange(endpoint, method string, body interface{}, response interface{}, agentType string, mediaTypes ...string) error

Exchange is a helper wrapper around a rest call. This is generally used by all the CLI client operations _except_ the logon operation, since at that point the token is not known (or used).

func Get

func Get(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Get implements the rest Get() function. This must be provided with a URL or URL fragment (depending on whether Base() was called). The URL is constructed, and authentication set, and a GET HTTP operation is generated. The result is either a string (for media type of text) or a struct (media type of JSON).

func GetTLSConfiguration

func GetTLSConfiguration() (*tls.Config, error)

func Media

func Media(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Media implements the Media() function. This specifies a string containing the media type that the REST service expects. In it's simplest form, this can be "application/text" for free text responses, or "application/json" for JSON data payloads.

func New

func New(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

New implements the New() rest function.

func ParseURL

func ParseURL(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

func Post

func Post(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Post implements the Post() rest function.

func Status

func Status(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

func Token

func Token(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Token implements the Token() rest function. When present, it accepts a token string and sets the rest client to use Bearer token authentication using this token value.

func Verify

func Verify(s *symbols.SymbolTable, args []interface{}) (interface{}, error)

Verify implements the Verify() rest function. This accepts a boolean value and sets the TLS server certificate authentication accordingly. When set to true, a connection will not be made if the server's certificate cannot be authenticated. This is the default mode for HTTPS connections. During debugging, you may wish to turn this off when using self-generated certificates.

Types

This section is empty.

Jump to

Keyboard shortcuts

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