api

package
v0.0.0-...-23b4524 Latest Latest
Warning

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

Go to latest
Published: May 16, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package api is used to communicate with SecurityCenter's REST JSON API, in the context of a command line application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Keys map[string]string

	Data map[string]interface{}
	// contains filtered or unexported fields
}

Request to be sent to SecurityCenter API

func NewRequest

func NewRequest(method, path string, data ...map[string]interface{}) *Request

NewRequest forms a new request to send to the SecurityCenter API

func (*Request) Do

func (r *Request) Do(c *cli.Context) (*Result, error)

Do performs the request and returns the result and any errors.

func (*Request) WithAuth

func (r *Request) WithAuth(keys map[string]string) *Request

WithAuth loads the authentication keys given into the request for the request to be authenticated as a user. As of SecurityCenter v5, this requires a "session" key with the value of the TNS_SESSION cookie, and a "token" key with the value of the X-SecurityCenter request header.

type Result

type Result struct {
	// Status code of the HTTP request made
	Status int
	// URL of the HTTP request made
	URL string
	// Data response from the API in simplejson/json format
	Data *simplejson.Json
	// HTTPRes is the raw net/http request for easy request customizations
	HTTPRes *http.Response
}

Result from SecurityCenter API

Jump to

Keyboard shortcuts

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