rest

package
v1.0.0-beta7 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Instance = Client{
	URL:      "http://localhost:8980/opennms",
	Username: "admin",
	Password: "admin",
	Timeout:  5,
}

Instance a global reference to the ReST Client instance

Functions

This section is empty.

Types

type Client

type Client struct {
	URL      string `yaml:"url"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Insecure bool   `yaml:"insecure"`
	Timeout  int    `yaml:"timeout"`
	Debug    bool   `yaml:"debug"`
}

Client OpenNMS ReST API configuration

func (Client) Delete

func (cli Client) Delete(path string) error

Delete sends an HTTP DELETE request

func (Client) Get

func (cli Client) Get(path string) ([]byte, error)

Get sends an HTTP GET request

func (Client) IsValid

func (cli Client) IsValid(response *http.Response) error

IsValid verifies HTTP response, return an error if it is not valid

func (Client) Post

func (cli Client) Post(path string, jsonBytes []byte) error

Post sends an HTTP POST request

func (Client) PostRaw

func (cli Client) PostRaw(path string, dataBytes []byte, contentType string) (*http.Response, error)

PostRaw sends an HTTP POST request, returning the raw response

func (Client) Put

func (cli Client) Put(path string, dataBytes []byte, contentType string) error

Put sends an HTTP PUT request

Jump to

Keyboard shortcuts

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