appinspect

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticateResult

type AuthenticateResult struct {
	StatusCode int    `json:"status_code"`
	Status     string `json:"status"`
	Msg        string `json:"msg"`
	Data       struct {
		Token string `json:"token"`
		User  struct {
			Name     string   `json:"name"`
			Email    string   `json:"email"`
			Username string   `json:"username"`
			Groups   []string `json:"groups"`
		} `json:"user"`
	} `json:"data"`
}

AuthenticateResult ...

func Authenticate

func Authenticate(username, password string) (*AuthenticateResult, error)

Authenticate ...

type Client

type Client struct {
	*resty.Client
	// contains filtered or unexported fields
}

Client to interface with the appinspect service

func New

func New() *Client

New client to interface with the appinspect service

func NewWithToken

func NewWithToken(token string) *Client

NewWithToken ...

func (*Client) Login

func (c *Client) Login(username, password string) error

Login to appinspect service

func (*Client) ReportHTML

func (c *Client) ReportHTML(reportBy interface{}) ([]byte, error)

ReportHTML of an app-package inspection

func (*Client) ReportJSON

func (c *Client) ReportJSON(reportBy interface{}) (*ReportJSONResult, error)

ReportJSON of an app-package inspection

func (*Client) SetToken

func (c *Client) SetToken(token string)

This is helpful for mocking appinspect client

func (*Client) Status

func (c *Client) Status(statusBy interface{}) (*StatusResult, error)

Status of an app-package inspection

func (*Client) Submit

func (c *Client) Submit(filename string, file io.Reader, isVictoria bool) (*SubmitResult, error)

Submit an app-package for inspection

type ClientInterface

type ClientInterface interface {
	Login(username string, password string) error
	SetToken(token string)
	Submit(filename string, file io.Reader, isVictoria bool) (*SubmitResult, error)
	Status(statusBy interface{}) (*StatusResult, error)
	ReportJSON(reportBy interface{}) (*ReportJSONResult, error)
	ReportHTML(reportBy interface{}) ([]byte, error)
}

type Error

type Error struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

Error ...

func (*Error) Error

func (e *Error) Error() string

type ReportJSONResult

type ReportJSONResult struct {
	RequestID string `json:"request_id"`
	Cloc      string `json:"cloc"`
	Reports   []struct {
		AppAuthor      string `json:"app_author"`
		AppDescription string `json:"app_description"`
		AppHash        string `json:"app_hash"`
		AppName        string `json:"app_name"`
		AppVersion     string `json:"app_version"`
		Metrics        struct {
			StartTime     string  `json:"start_time"`
			EndTime       string  `json:"end_time"`
			ExecutionTime float64 `json:"execution_time"`
		} `json:"metrics"`
		RunParameters struct {
			APIRequestID      string   `json:"api_request_id"`
			Identity          string   `json:"identity"`
			SplunkbaseID      string   `json:"splunkbase_id"`
			Version           string   `json:"version"`
			SplunkVersion     string   `json:"splunk_version"`
			StackID           string   `json:"stack_id"`
			APITimestamp      string   `json:"api_timestamp"`
			PackageLocation   string   `json:"package_location"`
			AppinspectVersion string   `json:"appinspect_version"`
			IncludedTags      []string `json:"included_tags"`
			ExcludedTags      []string `json:"excluded_tags"`
		} `json:"run_parameters"`
		Groups []struct {
			Checks []struct {
				Description string `json:"description"`
				Messages    []struct {
					Code            string      `json:"code"`
					Filename        string      `json:"filename"`
					Line            int         `json:"line"`
					Message         string      `json:"message"`
					Result          string      `json:"result"`
					MessageFilename string      `json:"message_filename"`
					MessageLine     interface{} `json:"message_line"`
				} `json:"messages"`
				Name   string   `json:"name"`
				Tags   []string `json:"tags"`
				Result string   `json:"result"`
			} `json:"checks"`
			Description string `json:"description"`
			Name        string `json:"name"`
		} `json:"groups"`
		Summary struct {
			Error         int `json:"error"`
			Failure       int `json:"failure"`
			Skipped       int `json:"skipped"`
			ManualCheck   int `json:"manual_check"`
			NotApplicable int `json:"not_applicable"`
			Warning       int `json:"warning"`
			Success       int `json:"success"`
		} `json:"summary"`
	} `json:"reports"`
	Summary struct {
		Error         int `json:"error"`
		Failure       int `json:"failure"`
		Skipped       int `json:"skipped"`
		ManualCheck   int `json:"manual_check"`
		NotApplicable int `json:"not_applicable"`
		Warning       int `json:"warning"`
		Success       int `json:"success"`
	} `json:"summary"`
	Metrics struct {
		StartTime     string  `json:"start_time"`
		EndTime       string  `json:"end_time"`
		ExecutionTime float64 `json:"execution_time"`
	} `json:"metrics"`
	RunParameters struct {
		APIRequestID      string   `json:"api_request_id"`
		Identity          string   `json:"identity"`
		SplunkbaseID      string   `json:"splunkbase_id"`
		Version           string   `json:"version"`
		SplunkVersion     string   `json:"splunk_version"`
		StackID           string   `json:"stack_id"`
		APITimestamp      string   `json:"api_timestamp"`
		PackageLocation   string   `json:"package_location"`
		AppinspectVersion string   `json:"appinspect_version"`
		IncludedTags      []string `json:"included_tags"`
		ExcludedTags      []string `json:"excluded_tags"`
	} `json:"run_parameters"`
	Links []struct {
		Rel  string `json:"rel"`
		Href string `json:"href"`
	} `json:"links"`
}

ReportJSONResult ...

type ShaId

type ShaId struct {
	Sha         string
	IncludeTags []string
}

type StatusResult

type StatusResult struct {
	RequestID  string `json:"request_id"`
	Sha        string `json:"sha"`
	StatusCode int    `json:"status_code"`
	Status     string `json:"status"`
	Info       struct {
		Error         int `json:"error"`
		Failure       int `json:"failure"`
		Skipped       int `json:"skipped"`
		ManualCheck   int `json:"manual_check"`
		NotApplicable int `json:"not_applicable"`
		Warning       int `json:"warning"`
		Success       int `json:"success"`
	} `json:"info"`
	Links []struct {
		Rel  string `json:"rel"`
		Href string `json:"href"`
	} `json:"links"`
}

StatusResult ...

type SubmitResult

type SubmitResult struct {
	RequestID string `json:"request_id"`
	Message   string `json:"message"`
	Links     []struct {
		Rel  string `json:"rel"`
		Href string `json:"href"`
	} `json:"links"`
}

SubmitResult ...

Jump to

Keyboard shortcuts

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