endpoints

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: Apache-2.0 Imports: 35 Imported by: 1

README

endpoints

Build Status Go Report Card GoDoc License PRs Welcome

endpoints

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EncryptionKey is used to encrypt/decrypt fields to/from the database
	EncryptionKey string

	// Ms is the database connection
	Ms domain.DatabaseConnection

	// AppConfig holds relevant fields from the app config
	AppConfig listenerConfig

	// WorkingDir defines the path to the Aegis directory, this is used over os.WorkingDir() as it is inconsistent
	WorkingDir string

	// OrgADConfigs holds the AD configurations for each organization. The AD configuration from the root of an
	// organizational hierarchy is used for the leaf organizations. The key is the organization ID
	OrgADConfigs map[string]*OrgConfigWrapper
)
View Source
var (
	// SigningKey is generated by the listener main method. It is used in the JWT for hash verification
	SigningKey string
)

Functions

func NewRouter

func NewRouter() *mux.Router

NewRouter registers all the endpoints with their associated handler functions. It returns a mux router which can then be used to start the server

Types

type ADConfig

type ADConfig struct {
	Servers             []string `json:"ad_servers"`
	ADLdapTLSPort       int      `json:"ad_ldap_tls_port"`
	ADBaseDN            string   `json:"ad_base_dn"`
	ADSkipTLSVerify     bool     `json:"ad_skip_verify"`
	ADMemberOfAttribute string   `json:"ad_member_of_attribute"`
	ADSearchString      string   `json:"ad_search_string"`
}

ADConfig holds the fields that are required to authenticate against AD as well as grab the groups that a user is a member of

type BulkUpdateFile

type BulkUpdateFile struct {
	Filename string `json:"name"`
	Contents string `json:"contents"`
}

BulkUpdateFile is a member of apiRequest and must be exported in order to be marshaled

type BulkUpdateJob

type BulkUpdateJob struct {
	Filenames  []string `json:"files"`
	ServiceURL string   `json:"serviceURL"`
}

BulkUpdateJob is a member of apiRequest and must be exported in order to be marshaled

type BurndownPackage

type BurndownPackage struct {
	MediumStats *BurndownStats `json:"medium"`
	HighStats   *BurndownStats `json:"high"`
	CritStats   *BurndownStats `json:"crit"`
}

BurndownPackage holds the information of the timelines in which tickets were closed in a particular project it populates the burndown pie char

type BurndownStats

type BurndownStats struct {
	ZeroToThirty  int  `json:"zero_thirty"`
	ThirtyToSixty int  `json:"thirty_sixty"`
	SixtyToNinety int  `json:"sixty_ninety"`
	NinetyPlus    int  `json:"ninety_up"`
	Overdue       int  `json:"overdue"`
	Done          bool `json:"done"`
}

BurndownStats is a member of BurndownPackage and must be exported

type Exception

type Exception struct {
	SourceID        string `json:"source_id"`
	OrganizationID  string `json:"org_id"`
	TypeID          int    `json:"type_id"`
	VulnerabilityID string `json:"vuln_id"`
	DeviceID        string `json:"device_id"`
	DueDate         string `json:"due_date,omitempty"`
	Approval        string `json:"approval,omitempty"`
	Active          bool   `json:"active"`
	Port            string `json:"port,omitempty"`
	DBCreatedDate   string `json:"created_date,omitempty"`
	DBUpdatedDate   string `json:"updated_date,omitempty"`
	CreatedBy       string `json:"created_by,omitempty"`
	UpdatedBy       string `json:"updated_by,omitempty"`
	Offset          int    `json:"offset,omitempty"`
	Limit           int    `json:"limit,omitempty"`
	SortedField     string `json:"sorted_field,omitempty"`
	SortOrder       string `json:"sort_order,omitempty"`
}

Exception is the struct that maps to the exceptions in the database

type ExceptionType

type ExceptionType struct {
	Code int    `json:"code"`
	Name string `json:"name,omitempty"`
}

ExceptionType is the type of the exception in the database

type GeneralResp

type GeneralResp struct {
	Response interface{} `json:"response,omitempty"`
	Message  string      `json:"message,omitempty"`
	Success  bool        `json:"success,omitempty"`
	// TODO return permissions by marshalling dal object
	Permissions  *PublicPermission `json:"permissions,omitempty"`
	TotalRecords int               `json:"totalrecords,omitempty"`
}

GeneralResp acts as a container for the response to a user's API apiRequest

type Histories

type Histories struct {
	Offset    int    `json:"offset,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	JobID     int    `json:"job_id"`
	JobHistID int    `json:"history_id"`
	ConfigID  string `json:"config_id"`
	StatusID  int    `json:"status"`
	Payload   string `json:"payload"`
}

Histories is a member of apiRequest and must be exported in order to be marshaled

type Job

type Job struct {
	Code int    `json:"code,omitempty"`
	Name string `json:"name,omitempty"`
}

Job is a member of apiRequest and must be exported in order to be marshaled

type JobConfig

type JobConfig struct {
	JobID                 int    `json:"job_id"`
	ConfigID              string `json:"config_id"`
	PriorityOverride      int    `json:"priority_override"`
	DataInSourceConfigID  string `json:"data_in_source_config_id"`
	DataOutSourceConfigID string `json:"data_out_source_config_id"`
	Continuous            bool   `json:"continuous"`
	WaitInSeconds         int    `json:"wait_in_seconds"`
	MaxInstances          int    `json:"max_instances"`
	AutoStart             bool   `json:"autostart"`
	Active                bool   `json:"active"`
	Payload               string `json:"payload"`
	Code                  int    `json:"code,omitempty"`
	Name                  string `json:"name,omitempty"`
	CreatedDate           string `json:"created_date"`
	CreatedBy             string `json:"created_by"`
	UpdatedDate           string `json:"updated_date,omitempty"`
	UpdatedBy             string `json:"updated_by,omitempty"`
	LastJobStart          string `json:"last_job_start,omitempty"`
	JobName               string `json:"job_name,omitempty"`
	SourceInName          string `json:"srcin_name,omitempty"`
}

JobConfig is a member of apiRequest and must be exported in order to be marshaled

type JobConfigRequest

type JobConfigRequest struct {
	JobConfig
	Offset      int    `json:"offset,omitempty"`
	Limit       int    `json:"limit,omitempty"`
	SortedField string `json:"sorted_field,omitempty"`
	SortOrder   string `json:"sort_order,omitempty"`
}

JobConfigRequest is a member of apiRequest and must be exported in order to be marshaled

type JobHistory

type JobHistory struct {
	JobHistID string `json:"history_id"`
	JobID     int    `json:"job_id"`
	ConfigID  string `json:"config_id"`
	StatusID  int    `json:"status"`
	Payload   string `json:"payload"`
}

JobHistory is a member of apiRequest and must be exported in order to be marshaled

type Log

type Log struct {
	ID           int    `json:"id"`
	TypeID       int    `json:"typeId"`
	Log          string `json:"log"`
	Error        string `json:"error"`
	JobHistoryID string `json:"jobHistoryId"`
	Date         string `json:"date"`
}

Log is a member of apiRequest and must be exported in order to be marshaled

type LogType

type LogType struct {
	ID   int    `json:"id"`
	Type string `json:"type"`
	Name string `json:"name"`
}

LogType is a member of apiRequest and must be exported in order to be marshaled

type OrgConfigWrapper

type OrgConfigWrapper struct {
	Org domain.Organization
	Con *ADConfig
}

OrgConfigWrapper ties together an organization along with it's AD configuration

type Organization

type Organization struct {
	ID             string  `json:"org_id,omitempty"`
	Code           string  `json:"code,omitempty"`
	Description    string  `json:"description,omitempty"`
	TimeZoneOffset float32 `json:"timezone_offset,omitempty"`
}

Organization is a member of apiRequest and must be exported in order to be marshaled

type Permission

type Permission struct {
	Name  string `json:"name"`
	Value bool   `json:"value"`
}

Permission is a member of apiRequest and must be exported in order to be marshaled

type PieChartContents

type PieChartContents struct {
	Labels []string `json:"labels"`
	Data   []int    `json:"data"`
}

PieChartContents is a member of pieChartInfo and must be exported in order to be marshaled

type PublicPermission

type PublicPermission struct {
	CanDeleteJob        bool `json:"candeletejob,omitempty"`
	CanDeleteConfig     bool `json:"candeleteconfig,omitempty"`
	CanUpdateSource     bool `json:"canupdatesource,omitempty"`
	CanReadJobHistories bool `json:"canreadjobhistories,omitempty"`
	UserID              int  `json:"userid,omitempty"`
	CanCreateJob        bool `json:"cancreatejob,omitempty"`
	CanCreateSource     bool `json:"cancreatesource,omitempty"`
	CanDeleteOrg        bool `json:"candeleteorg,omitempty"`
	CanCreateConfig     bool `json:"cancreateconfig,omitempty"`
	CanUpdateConfig     bool `json:"canupdateconfig,omitempty"`
	CanUpdateJob        bool `json:"canupdatejob,omitempty"`
	CanDeleteSource     bool `json:"candeletesource,omitempty"`
	CanCreateOrg        bool `json:"cancreateorg,omitempty"`
	CanUpdateOrg        bool `json:"canupdateorg ,omitempty"`
}

PublicPermission is a member of GeneralResp and must be exported in order to be marshaled

type ScanSummary

type ScanSummary struct {
	ScanID    string `json:"scan_id"`
	Status    string `json:"status"`
	Tickets   string `json:"tickets"`
	Devices   string `json:"devices"`
	StartTime string `json:"start"`
	Duration  string `json:"duration"`
	GroupName string `json:"group_name"`
	GroupID   int    `json:"group_id"`
	Source    string `json:"source"`
}

ScanSummary is a member of apiRequest and must be exported in order to be marshaled

type Source

type Source struct {
	ID       string `json:"id,omitempty"`
	Source   string `json:"source,omitempty"`
	Address  string `json:"address,omitempty"`
	Port     int    `json:"port,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Payload  string `json:"payload,omitempty"`

	// fields for Oauth (optional)
	PrivateKey  string `json:"private_key,omitempty"`
	ConsumerKey string `json:"consumer_key,omitempty"`
	Token       string `json:"token,omitempty"`
}

Source is a member of apiRequest and must be exported in order to be marshaled

type SourceConfig

type SourceConfig struct {
	Code string `json:"code,omitempty"`
	Name string `json:"name,omitempty"`
}

SourceConfig maps to the source config db tables

type Src

type Src struct {
	Code string `json:"code"`
	Name string `json:"name,omitempty"`
}

Src returns the ... TODO:

type TagMap

type TagMap struct {
	CloudSource  string `json:"cloud_source"`
	CloudTag     string `json:"cloud_tag"`
	TicketSource string `json:"ticket_source"`
	TicketTag    string `json:"ticket_tag"`
	Option       string `json:"option"`
	Overwrite    bool   `json:"overwrite,omitempty"`
}

TagMap is a member of apiRequest and must be exported in order to be marshaled

type User

type User struct {
	ID         string `json:"id"`
	Username   string `json:"username"`
	FirstName  string `json:"firstname"`
	LastName   string `json:"lastname"`
	Email      string `json:"email"`
	IsDisabled bool   `json:"isdisabled"`
}

User is a member of apiRequest and must be exported in order to be marshaled

type Vulnerability

type Vulnerability struct {
	SourceID string  `json:"source_id"`
	Title    string  `json:"title"`
	CVSS     float32 `json:"cvss"`
}

Vulnerability is a member of apiRequest and must be exported in order to be marshaled

type VulnerabilityMatch

type VulnerabilityMatch struct {
	NexposeTitle    string `json:"nexpose_title"`
	NexposeID       string `json:"nexpose_id"`
	QualysTitle     string `json:"qualys_title"`
	QualysID        string `json:"qualys_id"`
	MatchConfidence int    `json:"match_confidence"`
	MatchReason     string `json:"match_reason"`
}

VulnerabilityMatch is a member of apiRequest and must be exported in order to be marshaled

Jump to

Keyboard shortcuts

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