rest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package rest exposed the intel API using HTTP REST.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API exposes the Security Graph intel API as an HTTP REST endpoint.

func NewAPI

func NewAPI(intelAPI IntelAPI) API

NewAPI creates a new intel REST API that exposes the given Security Graph intel API.

func (API) BlastRadius

func (api API) BlastRadius(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

BlastRadius handles the endpoint that returns the blast radius given a specific asset.

func (API) ServeHTTP

func (api API) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves the routes exposed by the REST API.

type IntelAPI

type IntelAPI interface {
	// BlastRadius returns the blast radius of a given asset.
	BlastRadius(typ, identifier string) (intel.BlastRadiusResult, error)
}

IntelAPI includes the method set of intel.API. We do not expect to have multiple implementations, but depending on an interface makes easier to test this package.

Jump to

Keyboard shortcuts

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