defectdojo

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 16 Imported by: 0

README

go-defectdojo

Library to simplify interacting with the DefectDojo API

Configuration

API Config

type APIConfig struct {
	Host     string       // DefectDojo Server, ex: https://demo.defectdojo.org
	APIToken string       // DefectDojo V2 API Token
	Client   *http.Client // Optional, can provide a custom HTTP Client, defaults to http.DefaultClient
	Verbose  bool         // Prints requests and stack traces on API errors
}

See examples for usage.

Pagination

DefectDojo API is paginated, so you must provide Offsets and Limits for any Get requests. Failure to do so may lead to truncated or missing results.

These offsets and limits as passed into a get function using the RequestOptions struct:

type RequestOptions struct {
	Offset int
	Limit  int
}

The API returns a pagination wrapper around the results:

type PaginatedList[L any] struct {
	Count    int    // Number of Results
	Next     string // URL to next set of results
	Previous string // URL to previous set of results
	Results  []*L
}

For example, if you'd like to iterate the results and print them out:

for i, v := range pgl.Results {
    fmt.Printf("[%d] Result: %#v\n", i, v)
}

There are additional helper functions for PaginatedLists, HasNext() which tells you if there are additional results and NextRequestOptions() which will generate the next RequestOptions with the correct limit/offset.

You can check out the get-all-products example for an approach to handling pagination.

For simple requests, you can use the default options:

var DefaultRequestOptions = &RequestOptions{
	Offset: 0,
	Limit:  100,
}

or your just create your own:

options := &RequestOptions{
	Offset: 0,
	Limit:  50,
}

But be careful modifying this as large limit sizes can tie up resources on the defectdojo server.

Examples

Provided are two examples, get-products and get-all-products in the examples folder.

get-products

This example shows basic library use and the dangers of pagination.

get-all-products

This example builds on the first, and shows an approach to handling pagination.

Search / Filtering

The struct passed into any Get... function are search parameters. The above examples, we use defectdojo.Product{}, which means we are searching for anything.

For instance:

p := &defectdojo.Product{
	Name: "name-i-am-looking-for",
}
products, err = api.GetProducts(ctx, p, options)

will return products with name-i-am-looking-for in their name.

API Docs

This library supports Endpoint, Engagement, Finding, Metadata, Product, ProductType, and Test with Get, Add, and Update.

Remove functionality is not implemented yet.

Endpoint
endpoint := &defectdojo.Endpoint{
	Host:        "host",
	Product: 0,
}
GetEndpoints
// Search for products matching provided Host and Product ID
pgl, err := api.GetEndpoints(ctx, endpoint, defectdojo.DefaultRequestOptions)

// Check for errors before using the result
if err != nil {
    ...
}
Engagement
engagement := &defectdojo.Engagement{
	Name:        "name",
	Description: "description",
}
GetEngagements
// Search for engagements matching provided Name and Description
pgl, err := api.GetEngagements(ctx, engagement, defectdojo.DefaultRequestOptions)

// Check for errors before using the result
if err != nil {
    ...
}
Finding
finding := &defectdojo.Finding{
	Title:        "title",
	Description: "description",
}
GetFindings
// Search for findings matching provided Title and Description
pgl, err := api.GetFindings(ctx, finding, defectdojo.DefaultRequestOptions)

// Check for errors before using the result
if err != nil {
    ...
}
ImportScan
scan := &defectdojo.ImportScan{
	ScanType:   "scanType",
	Engagement: 123,
	Tags:       []string{"tag1", "tag2"},
}
ImportScan
// Import a scan with a scan report (json, sarif, etc)
scan, err := api.ImportScan(ctx, scan, scanReport)
Metadata
metadata := &defectdojo.Metadata{
	Name:    "name",
	Value:   "value",
}
GetMetadatas
// Search for metadata matching provided Name and Value
pgl, err := api.GetMetadatas(ctx, metadata, options)

// Check for errors before using the result
if err != nil {
    ...
}
Product
product := &defectdojo.Product{
	Name:        "name",
	Description: "description",
}
GetProducts
// Search for products matching provided Name and Description
products, err := api.GetProducts(ctx, product, options)

// Check for errors before using the result
if err != nil {
    ...
}
// Use products.Results 
ProductType
productType := &defectdojo.ProductType{
	Name:        "name",
	Description: "description",
}
GetProductTypes
// Search for product types matching provided Name and Description
productTypes, err := api.GetProductTypes(ctx, productType, options)

// Check for errors before using the result
if err != nil {
    ...
}
// Use productTypes.Results
Test
productType := &defectdojo.Test{
	Title:       "title",
	Description: "description",
}
GetTests
// Search for product types matching provided Name and Description
tests, err := api.GetTests(ctx, product, options)

// Check for errors before using the result
if err != nil {
    ...
}
// Use tests.Results
User

Not yet implemented.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRequestOptions = &RequestOptions{
	Offset: 0,
	Limit:  100,
}
View Source
var ErrorInvalidOptions = errors.New("request options is invalid")
View Source
var ErrorNoResultsFound = errors.New("results returned no items, please check your search string")
View Source
var ErrorResponseNon200 = errors.New("api returned a non-200 response code")

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	Host     string       // DefectDojo Server, https://example.org
	APIToken string       // DefectDojo V2 API Token
	Client   *http.Client // Optional, can provide a custom HTTP Client, defaults to http.DefaultClient
	Verbose  bool         // Prints stack traces API request errors
}

type DefectDojoAPI

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

func New

func New(config APIConfig) *DefectDojoAPI

func (*DefectDojoAPI) AddEndpoint

func (d *DefectDojoAPI) AddEndpoint(ctx context.Context, endpoint *Endpoint) (*Endpoint, error)

func (*DefectDojoAPI) AddEngagement

func (d *DefectDojoAPI) AddEngagement(ctx context.Context, engagement *Engagement) (*Engagement, error)

func (*DefectDojoAPI) AddFinding

func (d *DefectDojoAPI) AddFinding(ctx context.Context, finding *Finding) (*Finding, error)

func (*DefectDojoAPI) AddMetadata

func (d *DefectDojoAPI) AddMetadata(ctx context.Context, metadata *Metadata) (*Metadata, error)

func (*DefectDojoAPI) AddProduct

func (d *DefectDojoAPI) AddProduct(ctx context.Context, product *Product) (*Product, error)

func (*DefectDojoAPI) AddProductType

func (d *DefectDojoAPI) AddProductType(ctx context.Context, productType *ProductType) (*ProductType, error)

func (*DefectDojoAPI) AddTest

func (d *DefectDojoAPI) AddTest(ctx context.Context, test *Test) (*Test, error)

func (*DefectDojoAPI) AddUser

func (d *DefectDojoAPI) AddUser(ctx context.Context, user *User) error

func (*DefectDojoAPI) GetAllProducts

func (d *DefectDojoAPI) GetAllProducts(ctx context.Context, product *Product, options *RequestOptions) (*PaginatedList[Product], error)

beta, using generics, use with caution

func (*DefectDojoAPI) GetEndpoints

func (d *DefectDojoAPI) GetEndpoints(ctx context.Context, endpoint *Endpoint, options *RequestOptions) (*PaginatedList[Endpoint], error)

func (*DefectDojoAPI) GetEngagements

func (d *DefectDojoAPI) GetEngagements(ctx context.Context, engagement *Engagement, options *RequestOptions) (*PaginatedList[Engagement], error)

func (*DefectDojoAPI) GetFindings

func (d *DefectDojoAPI) GetFindings(ctx context.Context, finding *Finding, options *RequestOptions) (*PaginatedList[Finding], error)

func (*DefectDojoAPI) GetMetadatas

func (d *DefectDojoAPI) GetMetadatas(ctx context.Context, metadata *Metadata, options *RequestOptions) (*PaginatedList[Metadata], error)

func (*DefectDojoAPI) GetProductTypes

func (d *DefectDojoAPI) GetProductTypes(ctx context.Context, productType *ProductType, options *RequestOptions) (*PaginatedList[ProductType], error)

func (*DefectDojoAPI) GetProducts

func (d *DefectDojoAPI) GetProducts(ctx context.Context, product *Product, options *RequestOptions) (*PaginatedList[Product], error)

func (*DefectDojoAPI) GetTests

func (d *DefectDojoAPI) GetTests(ctx context.Context, test *Test, options *RequestOptions) (*PaginatedList[Test], error)

func (*DefectDojoAPI) GetUsers

func (d *DefectDojoAPI) GetUsers(ctx context.Context, user *User) ([]*User, error)

func (*DefectDojoAPI) ImportScan

func (d *DefectDojoAPI) ImportScan(ctx context.Context, importScan *ImportScan, scanData string) (*ImportScan, error)

func (*DefectDojoAPI) RemoveEndpoint

func (d *DefectDojoAPI) RemoveEndpoint(ctx context.Context, endpoint *Endpoint) error

func (*DefectDojoAPI) RemoveEngagement

func (d *DefectDojoAPI) RemoveEngagement(ctx context.Context, engagement *Engagement) error

func (*DefectDojoAPI) RemoveFinding

func (d *DefectDojoAPI) RemoveFinding(ctx context.Context, finding *Finding) error

func (*DefectDojoAPI) RemoveMetadata

func (d *DefectDojoAPI) RemoveMetadata(ctx context.Context, metadata *Metadata) error

func (*DefectDojoAPI) RemoveProduct

func (d *DefectDojoAPI) RemoveProduct(ctx context.Context, product *Product) error

func (*DefectDojoAPI) RemoveTest

func (d *DefectDojoAPI) RemoveTest(ctx context.Context, test *Test) error

func (*DefectDojoAPI) RemoveUser

func (d *DefectDojoAPI) RemoveUser(ctx context.Context, user *User) error

func (*DefectDojoAPI) UpdateEndpoint

func (d *DefectDojoAPI) UpdateEndpoint(ctx context.Context, endpoint *Endpoint) (*Endpoint, error)

func (*DefectDojoAPI) UpdateEngagement

func (d *DefectDojoAPI) UpdateEngagement(ctx context.Context, engagement *Engagement) (*Engagement, error)

func (*DefectDojoAPI) UpdateFinding

func (d *DefectDojoAPI) UpdateFinding(ctx context.Context, finding *Finding) (*Finding, error)

func (*DefectDojoAPI) UpdateMetadata

func (d *DefectDojoAPI) UpdateMetadata(ctx context.Context, metadata *Metadata) (*Metadata, error)

func (*DefectDojoAPI) UpdateProduct

func (d *DefectDojoAPI) UpdateProduct(ctx context.Context, product *Product) (*Product, error)

func (*DefectDojoAPI) UpdateProductType

func (d *DefectDojoAPI) UpdateProductType(ctx context.Context, productType *ProductType) (*ProductType, error)

func (*DefectDojoAPI) UpdateTest

func (d *DefectDojoAPI) UpdateTest(ctx context.Context, test *Test) (*Test, error)

func (*DefectDojoAPI) UpdateUser

func (d *DefectDojoAPI) UpdateUser(ctx context.Context, user *User) error

type Endpoint

type Endpoint struct {
	Id             int      `json:"id,omitempty" url:"id,omitempty"`
	Tags           []string `json:"tags,omitempty" url:"tags,omitempty"`
	Protocol       string   `json:"protocol,omitempty" url:"protocol,omitempty"`
	UserInfo       string   `json:"userinfo,omitempty" url:"userinfo,omitempty"`
	Host           string   `json:"host,omitempty" url:"host,omitempty"`
	Port           int      `json:"port,omitempty" url:"port,omitempty"`
	Path           string   `json:"path,omitempty" url:"path,omitempty"`
	Query          string   `json:"query,omitempty" url:"query,omitempty"`
	Fragment       string   `json:"fragment,omitempty" url:"fragment,omitempty"`
	Mitigated      bool     `json:"mitigated,omitempty" url:"mitigated,omitempty"`
	Product        int      `json:"product,omitempty" url:"product,omitempty"`
	EndpointParams []int    `json:"endpoint_params,omitempty" url:"endpoint_params,omitempty"`
	EndpointStatus []int    `json:"endpoint_status,omitempty" url:"endpoint_status,omitempty"`
}

type Engagement

type Engagement struct {
	Id                         int      `json:"id,omitempty" url:"id,omitempty"`
	Tags                       []string `json:"tags,omitempty" url:"tags,omitempty"`
	Name                       string   `json:"name,omitempty" url:"name,omitempty"`
	Description                string   `json:"description,omitempty" url:"description,omitempty"`
	Version                    string   `json:"version,omitempty" url:"version,omitempty"`
	FirstContacted             string   `json:"first_contacted,omitempty" url:"first_contacted,omitempty"`
	TargetStart                string   `json:"target_start" url:"target_start"`
	TargetEnd                  string   `json:"target_end" url:"target_end"`
	Reason                     string   `json:"reason,omitempty" url:"reason,omitempty"`
	Tracker                    string   `json:"tracker,omitempty" url:"tracker,omitempty"`
	TestStrategy               string   `json:"test_strategy,omitempty" url:"test_strategy,omitempty"`
	ThreatModel                bool     `json:"threat_model,omitempty" url:"threat_model,omitempty"`
	APITest                    bool     `json:"api_test,omitempty" url:"api_test,omitempty"`
	PenTest                    bool     `json:"pen_test,omitempty" url:"pen_test,omitempty"`
	CheckList                  bool     `json:"check_list,omitempty" url:"check_list,omitempty"`
	Status                     string   `json:"status,omitempty" url:"status,omitempty"`
	EngagementType             string   `json:"engagement_type,omitempty" url:"engagement_type,omitempty"`
	BuildID                    string   `json:"build_id,omitempty" url:"build_id,omitempty"`
	CommitHash                 string   `json:"commit_hash,omitempty" url:"commit_hash,omitempty"`
	BranchTag                  string   `json:"branch_tag,omitempty" url:"branch_tag,omitempty"`
	SourceCodeManagementURI    string   `json:"source_code_management_uri,omitempty" url:"source_code_management_uri,omitempty"`
	DeduplicationOnEngagement  bool     `json:"deduplication_on_engagement,omitempty" url:"deduplication_on_engagement,omitempty"`
	Lead                       int      `json:"lead,omitempty" url:"lead,omitempty"`
	Requestor                  int      `json:"requester,omitempty" url:"requester,omitempty"`
	Preset                     int      `json:"preset,omitempty" url:"preset,omitempty"`
	ReportType                 int      `json:"report_type,omitempty" url:"report_type,omitempty"`
	Product                    int      `json:"product" url:"product"`
	BuildServer                int      `json:"build_server,omitempty" url:"build_server,omitempty"`
	SourceCodeManagementServer int      `json:"source_code_management_server,omitempty" url:"source_code_management_server,omitempty"`
	OrchestrationEngine        int      `json:"orchestration_engine,omitempty" url:"orchestration_engine,omitempty"`
	Notes                      []Note   `json:"notes,omitempty" url:"notes,omitempty"`
	Files                      []File   `json:"files,omitempty" url:"files,omitempty"`
	RiskAcceptance             []int    `json:"risk_acceptance,omitempty" url:"risk_acceptance,omitempty"`
}

type File

type File struct {
	Id    int    `json:"id,omitempty" url:"id,omitempty"`
	File  string `json:"file,omitempty" url:"file,omitempty"`
	Title string `json:"title,omitempty" url:"title,omitempty"`
}

type Finding

type Finding struct {
	Id                      int      `json:"id,omitempty" url:"id,omitempty"`
	Test                    int      `json:"test,omitempty" url:"test,omitempty"`
	ThreadId                int      `json:"thread_id,omitempty" url:"thread_id,omitempty"`
	FoundBy                 []int    `json:"found_by,omitempty" url:"found_by,omitempty"`
	Url                     string   `json:"url,omitempty" url:"url,omitempty"`
	Tags                    []string `json:"tags,omitempty" url:"tags,omitempty"`
	PushToJira              bool     `json:"push_to_jira,omitempty" url:"push_to_jira,omitempty"`
	Title                   string   `json:"title,omitempty" url:"title,omitempty"`
	Date                    string   `json:"date,omitempty" url:"date,omitempty"`
	SlaStartDate            string   `json:"sla_start_date,omitempty" url:"sla_start_date,omitempty"`
	Cwe                     int      `json:"cwe,omitempty" url:"cwe,omitempty"`
	Cve                     string   `json:"cve,omitempty" url:"cve,omitempty"`
	Cvssv3                  string   `json:"cvssv3,omitempty" url:"cvssv3,omitempty"`
	Cvssv3Score             float32  `json:"cvssv3_score,omitempty" url:"cvssv3_score,omitempty"`
	Severity                string   `json:"severity" url:"severity"`
	Description             string   `json:"description" url:"description"`
	Mitigation              string   `json:"mitigation,omitempty" url:"mitigation,omitempty"`
	Impact                  string   `json:"impact,omitempty" url:"impact,omitempty"`
	StepsToReproduce        string   `json:"steps_to_reproduce,omitempty" url:"steps_to_reproduce,omitempty"`
	SeverityJustification   string   `json:"severity_justification,omitempty" url:"severity_justification,omitempty"`
	References              string   `json:"references,omitempty" url:"references,omitempty"`
	IsTemplate              bool     `json:"is_template,omitempty" url:"is_template,omitempty"`
	Active                  bool     `json:"active,omitempty" url:"active,omitempty"`
	Verified                bool     `json:"verified,omitempty" url:"verified,omitempty"`
	FalseP                  bool     `json:"false_p,omitempty" url:"false_p,omitempty"`
	Duplicate               bool     `json:"duplicate,omitempty" url:"duplicate,omitempty"`
	OutOfScope              bool     `json:"out_of_scope,omitempty" url:"out_of_scope,omitempty"`
	RiskAccepted            bool     `json:"risk_accepted,omitempty" url:"risk_accepted,omitempty"`
	UnderReview             bool     `json:"under_review,omitempty" url:"under_review,omitempty"`
	UnderDefectReview       bool     `json:"under_defect_review,omitempty" url:"under_defect_review,omitempty"`
	IsMitigated             bool     `json:"is_mitigated,omitempty" url:"is_mitigated,omitempty"`
	NumericalSeverity       string   `json:"numerical_severity" url:"numerical_severity"`
	Line                    int      `json:"line,omitempty" url:"line,omitempty"`
	FilePath                string   `json:"file_path,omitempty" url:"file_path,omitempty"`
	ComponentName           string   `json:"component_name,omitempty" url:"component_name,omitempty"`
	ComponentVersion        string   `json:"component_version,omitempty" url:"component_version,omitempty"`
	StaticFinding           bool     `json:"static_finding,omitempty" url:"static_finding,omitempty"`
	DynamicFinding          bool     `json:"dynamic_finding,omitempty" url:"dynamic_finding,omitempty"`
	UniqueIdFromTool        string   `json:"unique_id_from_tool,omitempty" url:"unique_id_from_tool,omitempty"`
	VulnIdFromTool          string   `json:"vuln_id_from_tool,omitempty" url:"vuln_id_from_tool,omitempty"`
	SastSourceObject        string   `json:"sast_source_object,omitempty" url:"sast_source_object,omitempty"`
	SastSinkObject          string   `json:"sast_sink_object,omitempty" url:"sast_sink_object,omitempty"`
	SastSourceLine          int      `json:"sast_source_line,omitempty" url:"sast_source_line,omitempty"`
	SastSourceFilePath      string   `json:"sast_source_file_path,omitempty" url:"sast_source_file_path,omitempty"`
	Nb_occurences           int      `json:"nb_occurences,omitempty" url:"nb_occurences,omitempty"`
	PublishDate             string   `json:"publish_date,omitempty" url:"publish_date,omitempty"`
	ReviewRequestedBy       int      `json:"review_requested_by,omitempty" url:"review_requested_by,omitempty"`
	DefectReviewRequestedBy int      `json:"defect_review_requested_by,omitempty" url:"defect_review_requested_by,omitempty"`
	SonarqubeIssue          int      `json:"sonarqube_issue,omitempty" url:"sonarqube_issue,omitempty"`
	Endpoints               []int    `json:"endpoints,omitempty" url:"endpoints,omitempty"`
	EndpointStatus          []int    `json:"endpoint_status,omitempty" url:"endpoint_status,omitempty"`
	Reviewers               []int    `json:"reviewers,omitempty" url:"reviewers,omitempty"`
}

type FindingGroup

type FindingGroup struct {
	Id        int       `json:"id,omitempty" url:"id,omitempty"`
	Name      string    `json:"name,omitempty" url:"name,omitempty"`
	Test      int       `json:"test,omitempty" url:"test,omitempty"`
	JiraIssue JiraIssue `json:"jira_issue,omitempty" url:"jira_issue,omitempty"`
}

type ImportScan

type ImportScan struct {
	ScanDate         string   `json:"scan_date,omitempty" url:"scan_date,omitempty"`
	MinimumSeverity  string   `json:"minimum_severity,omitempty" url:"minimum_severity,omitempty"`
	Active           bool     `json:"active,omitempty" url:"active,omitempty"`
	Verified         bool     `json:"verified,omitempty" url:"verified,omitempty"`
	ScanType         string   `json:"scan_type,omitempty" url:"scan_type,omitempty"`
	EndpointToAdd    int      `json:"endpoint_to_add,omitempty" url:"endpoint_to_add,omitempty"`
	File             string   `json:"file,omitempty" url:"file,omitempty"`
	Engagement       int      `json:"engagement,omitempty" url:"engagement,omitempty"`
	Lead             int      `json:"lead,omitempty" url:"lead,omitempty"`
	Tags             []string `json:"tags,omitempty" url:"tags,omitempty"`
	CloseOldFindings bool     `json:"close_old_findings,omitempty" url:"close_old_findings,omitempty"`
	PushToJira       bool     `json:"push_to_jira,omitempty" url:"push_to_jira,omitempty"`
	Environment      string   `json:"environment,omitempty" url:"environment,omitempty"`
	Version          string   `json:"version,omitempty" url:"version,omitempty"`
	BuildID          string   `json:"build_id,omitempty" url:"build_id,omitempty"`
	BranchTag        string   `json:"branch_tag,omitempty" url:"branch_tag,omitempty"`
	CommitHash       string   `json:"commit_hash,omitempty" url:"commit_hash,omitempty"`
	Test             int      `json:"test,omitempty" url:"test,omitempty"`
	GroupBy          string   `json:"group_by,omitempty" url:"group_by,omitempty"`
}

type JiraIssue

type JiraIssue struct {
	Id           int    `json:"id,omitempty" url:"id,omitempty"`
	Url          string `json:"url,omitempty" url:"url,omitempty"`
	JiraId       string `json:"jira_id,omitempty" url:"jira_id,omitempty"`
	JiraKey      string `json:"jira_key,omitempty" url:"jira_key,omitempty"`
	JiraCreation string `json:"jira_creation,omitempty" url:"jira_creation,omitempty"`
	JiraChange   string `json:"jira_change,omitempty" url:"jira_change,omitempty"`
	JiraProject  int    `json:"jira_project,omitempty" url:"jira_project,omitempty"`
	Finding      int    `json:"finding,omitempty" url:"finding,omitempty"`
	Engagement   int    `json:"engagement,omitempty" url:"engagement,omitempty"`
	FindingGroup int    `json:"finding_group,omitempty" url:"finding_group,omitempty"`
}

type Metadata

type Metadata struct {
	Id       int    `json:"id,omitempty" url:"id,omitempty"`
	Product  int    `json:"product,omitempty" url:"product,omitempty"`
	Endpoint int    `json:"endpoint,omitempty" url:"endpoint,omitempty"`
	Finding  int    `json:"finding,omitempty" url:"finding,omitempty"`
	Name     string `json:"name" url:"name"`
	Value    string `json:"value" url:"value"`
}

type Note

type Note struct {
	Id       int           `json:"id,omitempty" url:"id,omitempty"`
	Author   User          `json:"author,omitempty" url:"author,omitempty"`
	Editor   User          `json:"editor,omitempty" url:"editor,omitempty"`
	History  []NoteHistory `json:"history,omitempty" url:"history,omitempty"`
	Entry    string        `json:"entry,omitempty" url:"entry,omitempty"`
	Date     string        `json:"date,omitempty" url:"date,omitempty"`
	Private  bool          `json:"private,omitempty" url:"private,omitempty"`
	Edited   bool          `json:"edited,omitempty" url:"edited,omitempty"`
	EditTime string        `json:"edit_time,omitempty" url:"edit_time,omitempty"`
	NoteType int           `json:"note_type,omitempty" url:"note_type,omitempty"`
}

type NoteHistory

type NoteHistory struct {
	Id            int    `json:"id,omitempty" url:"id,omitempty"`
	CurrentEditor User   `json:"current_editor,omitempty" url:"current_editor,omitempty"`
	Data          string `json:"data,omitempty" url:"data,omitempty"`
	Time          string `json:"time,omitempty" url:"time,omitempty"`
	NoteType      int    `json:"note_type,omitempty" url:"note_type,omitempty"`
}

type PaginatedList

type PaginatedList[L any] struct {
	Count    int    // Number of Results
	Next     string // URL to next set of results
	Previous string // URL to previous set of results
	Results  []*L
	// contains filtered or unexported fields
}

func (*PaginatedList[L]) HasNext

func (p *PaginatedList[L]) HasNext() bool

func (*PaginatedList[L]) NextRequestOptions

func (p *PaginatedList[L]) NextRequestOptions() (*RequestOptions, error)

func (*PaginatedList[L]) RestoreResults

func (p *PaginatedList[L]) RestoreResults()

func (*PaginatedList[L]) SaveResults

func (p *PaginatedList[L]) SaveResults()

beta feature a trick/hack to persist results avoids json.unmarshal clobbering the results on multiple invocations should probably be a cleaner way to do this

type PaginatedLister

type PaginatedLister interface {
	NextRequestOptions() (*RequestOptions, error)
	SaveResults()
	RestoreResults()
	HasNext() bool
}

type Product

type Product struct {
	Id                         int         `json:"id,omitempty" url:"id,omitempty"`
	Tags                       []string    `json:"tags,omitempty" url:"tags,omitempty"`
	Name                       string      `json:"name" url:"name"`
	Description                string      `json:"description,omitempty" url:"description,omitempty"`
	ProdNumericGrade           int         `json:"prod_numeric_grade,omitempty" url:"prod_numeric_grade,omitempty"`
	BusinessCriticality        string      `json:"business_criticality,omitempty" url:"business_criticality,omitempty"`
	Platform                   string      `json:"platform,omitempty" url:"platform,omitempty"`
	Lifecycle                  string      `json:"lifecycle,omitempty" url:"lifecycle,omitempty"`
	Origin                     string      `json:"origin,omitempty" url:"origin,omitempty"`
	UserRecords                int         `json:"user_records,omitempty" url:"user_records,omitempty"`
	Revenue                    string      `json:"revenue,omitempty" url:"revenue,omitempty"`
	ExternalAudience           bool        `json:"external_audience,omitempty" url:"external_audience,omitempty"`
	InternetAccessible         bool        `json:"internet_accessible,omitempty" url:"internet_accessible,omitempty"`
	EnableSimpleRiskAcceptance bool        `json:"enable_simple_risk_acceptance,omitempty" url:"enable_simple_risk_acceptance,omitempty"`
	EnableFullRiskAcceptance   bool        `json:"enable_full_risk_acceptance,omitempty" url:"enable_full_risk_acceptance,omitempty"`
	ProductManager             int         `json:"product_manager,omitempty" url:"product_manager,omitempty"`
	TechnicalContact           int         `json:"technical_contact,omitempty" url:"technical_contact,omitempty"`
	TeamManager                int         `json:"team_manager,omitempty" url:"team_manager,omitempty"`
	ProdType                   int         `json:"prod_type,omitempty" url:"prod_type,omitempty"`
	Regulations                []int       `json:"regulations,omitempty" url:"regulations,omitempty"`
	ProductMeta                []*Metadata `json:"product_meta,omitempty" url:"product_meta,omitempty"`
	Prefetch                   interface{} `json:"prefetch,omitempty" url:"prefetch,omitempty"`
}

type ProductType

type ProductType struct {
	Id                  int    `json:"id,omitempty" url:"id,omitempty"`
	Name                string `json:"name,omitempty" url:"name,omitempty"`
	Description         string `json:"description,omitempty" url:"description,omitempty"`
	CriticalProduct     bool   `json:"critical_product,omitempty" url:"critical_product,omitempty"`
	KeyProduct          bool   `json:"key_product,omitempty" url:"key_product,omitempty"`
	Updated             string `json:"updated,omitempty" url:"updated,omitempty"`
	Created             string `json:"created,omitempty" url:"created,omitempty"`
	Members             []int  `json:"members,omitempty" url:"members,omitempty"`
	AuthorizationGroups []int  `json:"authorization_groups,omitempty" url:"authorization_groups,omitempty"`
}

type RequestOptions

type RequestOptions struct {
	Offset int
	Limit  int
}

type Test

type Test struct {
	Id              int            `json:"id,omitempty" url:"id,omitempty"`
	Tags            []string       `json:"tags,omitempty" url:"tags,omitempty"`
	TestTypeName    string         `json:"test_type_name,omitempty" url:"test_type_name,omitempty"`
	FindingGroups   []FindingGroup `json:"finding_groups,omitempty" url:"finding_groups,omitempty"`
	Title           string         `json:"title,omitempty" url:"title,omitempty"`
	Description     string         `json:"description,omitempty" url:"description,omitempty"`
	TargetStart     string         `json:"target_start,omitempty" url:"target_start,omitempty"`
	TargetEnd       string         `json:"target_end,omitempty" url:"target_end,omitempty"`
	EstimatedTime   string         `json:"estimated_time,omitempty" url:"estimated_time,omitempty"`
	ActualTime      string         `json:"actual_time,omitempty" url:"actual_time,omitempty"`
	PercentComplete int            `json:"percent_complete,omitempty" url:"percent_complete,omitempty"`
	Updated         string         `json:"updated,omitempty" url:"updated,omitempty"`
	Created         string         `json:"created,omitempty" url:"created,omitempty"`
	Version         string         `json:"version,omitempty" url:"version,omitempty"`
	BuildId         string         `json:"build_id,omitempty" url:"build_id,omitempty"`
	CommitHash      string         `json:"commit_hash,omitempty" url:"commit_hash,omitempty"`
	BranchTag       string         `json:"branch_tag,omitempty" url:"branch_tag,omitempty"`
	Engagement      int            `json:"engagement,omitempty" url:"engagement,omitempty"`
	Lead            int            `json:"lead,omitempty" url:"lead,omitempty"`
	TestType        int            `json:"test_type,omitempty" url:"test_type,omitempty"`
	Environment     int            `json:"environment,omitempty" url:"environment,omitempty"`
	Notes           []Note         `json:"notes,omitempty" url:"notes,omitempty"`
	Files           []File         `json:"files,omitempty" url:"files,omitempty"`
}

type User

type User struct {
	UserName    string `json:"username" url:"username"`
	FirstName   string `json:"first_name,omitempty" url:"first_name,omitempty"`
	LastName    string `json:"last_name,omitempty" url:"last_name,omitempty"`
	Email       string `json:"email,omitempty" url:"email,omitempty"`
	IsActive    bool   `json:"is_active,omitempty" url:"is_active,omitempty"`
	IsStaff     bool   `json:"is_staff,omitempty" url:"is_staff,omitempty"`
	IsSuperuser bool   `json:"is_superuser,omitempty" url:"is_superuser,omitempty"`
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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