messages

package
v0.0.0-...-955e4e8 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SimplePOSTImpl

func SimplePOSTImpl(i interface{}) ([]byte, error)

Simply calls and returns the values of json.Marshal() with the given interface Used internally to not pollute import statements

Types

type BaseRequest

type BaseRequest struct {
	//Type of the request. It is basically always required
	Type string `json:"type"`
	//Command which is needed for some requests. It won't be marshaled if left empty.
	Command string `json:"command,omitempty"`
	//MBean which is needed for some requests. It won't be marshaled if left empty.
	MBean *java.MBean `json:"mbean,omitempty"`
}

BaseRequest represents the fields which will always be required in a request to Jolokia. Type should always be given, while Command or MBean may be left empty. If empty they will not be marshalled into JSON.

func (*BaseRequest) POSTBody

func (b *BaseRequest) POSTBody() ([]byte, error)

Returns a JSON representation of the struct to use as body when making POST requests Simply calls SimplePOSTImpl

type GETRequest

type GETRequest interface {
	// GetAppendix returns the string which should be concatenated with the base url of Jolokia to make the request
	GetAppendix() ([]byte, error)
}

GETRequest should be implemented by request-structs to support being send via get

type POSTRequest

type POSTRequest interface {
	// Returns the body of the POST request which will be send to Jolokia
	POSTBody() ([]byte, error)
}

POSTRequest should be implemented by request-structs to support being send via post. Since Jolokia expects a JSON as POST it's easy to simply use json.Marshal to marshal the struct

type ResponseError

type ResponseError struct {
	Type       string `json:"error_type"`
	Message    string `json:"error"`
	Stacktrace string `json:"stacktrace"`
}

ResponseError contains fields related to internal erros in Jolokia.

type ResponseRoot

type ResponseRoot struct {
	Status    int             `json:"status"`
	Timestamp int             `json:"timestamp"`
	Request   BaseRequest     `json:"request"`
	Value     json.RawMessage `json:"value"`
	History   json.RawMessage `json:"history"`
	ResponseError
}

ResponseRoot represents the root of the JSON Response. Value and History are not unmarshaled since their type will vary from request to request. To unmarshal Value and History fields define an own struct and unmarshal the fields accordingly.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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