nexusiq

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Overview

Package nexusiq provides a number of functions that interact with the Nexus IQ REST API. All functions require a new RM instance which can be instantiated as such:

iq, err := nexusiq.New("http://localhost:8070", "username", "password")
if err != nil {
    panic(err)
}

Index

Examples

Constants

View Source
const (

	// RemediationTypeNoViolations is a type of remediation version change where the version does not violate any policies
	RemediationTypeNoViolations = "next-no-violations"
	// RemediationTypeNonFailing is a type of remediation version change where the version does not fail any policies, even if it violates them
	RemediationTypeNonFailing = "next-non-failing"
)
View Source
const (
	StageProxy                = "proxy"
	StageDevelop              = "develop"
	StageBuild                = "build"
	StageStageRelease         = "stage-release"
	StageRelease              = "release"
	StageOperate              = "operate"
	StageContinuousMonitoring = "continuous-monitoring"
)

Provides a constants for the IQ stages

View Source
const (
	MemberTypeUser  = "USER"
	MemberTypeGroup = "GROUP"
)

Constants to describe a Member Type

View Source
const (

	// RootOrganization is the ID of the ... Root ... Organization
	RootOrganization = "ROOT_ORGANIZATION_ID"
)

Variables

This section is empty.

Functions

func ComponentLabelApply added in v0.30.0

func ComponentLabelApply(iq IQ, comp Component, appID, label string) error

ComponentLabelApply adds an existing label to a component for a given application

func ComponentLabelUnapply added in v0.30.0

func ComponentLabelUnapply(iq IQ, comp Component, appID, label string) error

ComponentLabelUnapply removes an existing association between a label and a component

func ComponentVersions added in v0.29.0

func ComponentVersions(iq IQ, comp Component) (versions []string, err error)

ComponentVersions returns all known versions of a given component

func CreateApplication

func CreateApplication(iq IQ, name, id, organizationID string) (string, error)

CreateApplication creates an application in IQ with the given name and identifier

Example
iq, err := New("http://localhost:8070", "user", "password")
if err != nil {
	panic(err)
}

appID, err := CreateApplication(iq, "name", "id", "organization")
if err != nil {
	panic(err)
}
fmt.Printf("Application ID: %s\n", appID)
Output:

func CreateOrganization

func CreateOrganization(iq IQ, name string) (string, error)

CreateOrganization creates an organization in IQ with the given name

Example
iq, err := New("http://localhost:8070", "user", "password")
if err != nil {
	panic(err)
}

orgID, err := CreateOrganization(iq, "DatabaseTeam")
if err != nil {
	panic(err)
}
fmt.Printf("Organization ID: %s\n", orgID)
Output:

func CreateSourceControlEntry

func CreateSourceControlEntry(iq IQ, applicationID, repositoryURL, token string) error

CreateSourceControlEntry creates a source control entry in IQ

func DeleteApplication

func DeleteApplication(iq IQ, applicationID string) error

DeleteApplication deletes an application in IQ with the given id

func DeleteComponentLabelForApplication added in v0.58.0

func DeleteComponentLabelForApplication(iq IQ, appID, label string) error

DeleteComponentLabelForApplication deletes a label from an application

func DeleteComponentLabelForOrganization added in v0.58.0

func DeleteComponentLabelForOrganization(iq IQ, organization, label string) error

DeleteComponentLabelForOrganization deletes a label from an organization

func DeleteSourceControlEntry

func DeleteSourceControlEntry(iq IQ, applicationID, sourceControlID string) error

DeleteSourceControlEntry deletes a source control entry in IQ

func DeleteSourceControlEntryByApp

func DeleteSourceControlEntryByApp(iq IQ, applicationID string) error

DeleteSourceControlEntryByApp deletes a source control entry in IQ for the given application

func DeleteUser added in v0.39.0

func DeleteUser(iq IQ, username string) error

DeleteUser removes the named user

func GetSystemAdminID added in v0.41.0

func GetSystemAdminID(iq IQ) (string, error)

GetSystemAdminID returns the identifier of the System Administrator role

func RevokeApplicationGroup added in v0.39.0

func RevokeApplicationGroup(iq IQ, name, roleName, group string) error

RevokeApplicationGroup removes a group and role from the named application

func RevokeApplicationUser added in v0.39.0

func RevokeApplicationUser(iq IQ, name, roleName, user string) error

RevokeApplicationUser removes a user and role from the named application

func RevokeGlobalGroup added in v0.41.0

func RevokeGlobalGroup(iq IQ, roleName, group string) error

RevokeGlobalGroup revoke the role and group that can have access to the global

func RevokeGlobalUser added in v0.41.0

func RevokeGlobalUser(iq IQ, roleName, user string) error

RevokeGlobalUser revoke the role and user that can have access to the global

func RevokeOrganizationGroup added in v0.39.0

func RevokeOrganizationGroup(iq IQ, name, roleName, group string) error

RevokeOrganizationGroup removes a group and role from the named organization

func RevokeOrganizationUser added in v0.39.0

func RevokeOrganizationUser(iq IQ, name, roleName, user string) error

RevokeOrganizationUser removes a user and role from the named organization

func RevokeRepositoriesGroup added in v0.40.0

func RevokeRepositoriesGroup(iq IQ, roleName, group string) error

RevokeRepositoriesGroup revoke the role and group that can have access to the repositories

func RevokeRepositoriesUser added in v0.40.0

func RevokeRepositoriesUser(iq IQ, roleName, user string) error

RevokeRepositoriesUser revoke the role and user that can have access to the repositories

func SetApplicationGroup added in v0.31.0

func SetApplicationGroup(iq IQ, name, roleName, group string) error

SetApplicationGroup sets the role and group that can have access to an application

func SetApplicationUser added in v0.31.0

func SetApplicationUser(iq IQ, name, roleName, user string) error

SetApplicationUser sets the role and user that can have access to an application

func SetGlobalGroup added in v0.41.0

func SetGlobalGroup(iq IQ, roleName, group string) error

SetGlobalGroup sets the role and group that can have access to the global

func SetGlobalUser added in v0.41.0

func SetGlobalUser(iq IQ, roleName, user string) error

SetGlobalUser sets the role and user that can have access to the repositories

func SetOrganizationGroup added in v0.31.0

func SetOrganizationGroup(iq IQ, name, roleName, group string) error

SetOrganizationGroup sets the role and group that can have access to an organization

func SetOrganizationUser added in v0.31.0

func SetOrganizationUser(iq IQ, name, roleName, user string) error

SetOrganizationUser sets the role and user that can have access to an organization

func SetRepositoriesGroup added in v0.40.0

func SetRepositoriesGroup(iq IQ, roleName, group string) error

SetRepositoriesGroup sets the role and group that can have access to the repositories

func SetRepositoriesUser added in v0.40.0

func SetRepositoriesUser(iq IQ, roleName, user string) error

SetRepositoriesUser sets the role and user that can have access to the repositories

func SetRetentionPolicies added in v0.31.0

func SetRetentionPolicies(iq IQ, orgName string, policies DataRetentionPolicies) error

SetRetentionPolicies updates the retention policies

func SetUser added in v0.39.0

func SetUser(iq IQ, user User) (err error)

SetUser creates a new user

func UpdateSourceControlEntry

func UpdateSourceControlEntry(iq IQ, applicationID, repositoryURL, token string) error

UpdateSourceControlEntry updates a source control entry in IQ

Types

type Application

type Application struct {
	ID              string `json:"id"`
	PublicID        string `json:"publicId,omitempty"`
	Name            string `json:"name"`
	OrganizationID  string `json:"organizationId"`
	ContactUserName string `json:"contactUserName,omitempty"`
	ApplicationTags []struct {
		ID            string `json:"id,omitempty"`
		TagID         string `json:"tagId,omitempty"`
		ApplicationID string `json:"applicationId,omitempty"`
	} `json:"applicationTags,omitempty"`
}

Application captures information of an IQ application

func GetAllApplications

func GetAllApplications(iq IQ) ([]Application, error)

GetAllApplications returns a slice of all of the applications in an IQ instance

Example
iq, err := New("http://localhost:8070", "username", "password")
if err != nil {
	panic(err)
}

applications, err := GetAllApplications(iq)
if err != nil {
	panic(err)
}

fmt.Printf("%v\n", applications)
Output:

func GetApplicationByPublicID

func GetApplicationByPublicID(iq IQ, applicationPublicID string) (*Application, error)

GetApplicationByPublicID returns details on the named IQ application

func GetApplicationsByOrganization added in v0.49.0

func GetApplicationsByOrganization(iq IQ, organizationName string) ([]Application, error)

GetApplicationsByOrganization returns all applications under a given organization

type ApplicationReports added in v0.31.0

type ApplicationReports struct {
	Stages map[Stage]DataRetentionPolicy `json:"stages"`
}

ApplicationReports captures the policies related to application reports

type ApplicationViolation added in v0.27.0

type ApplicationViolation struct {
	Application      Application       `json:"application"`
	PolicyViolations []PolicyViolation `json:"policyViolations"`
}

ApplicationViolation encapsulates the information about which violations an application has

func GetAllPolicyViolations added in v0.27.0

func GetAllPolicyViolations(iq IQ) ([]ApplicationViolation, error)

GetAllPolicyViolations returns all policy violations

func GetPolicyViolationsByName added in v0.27.0

func GetPolicyViolationsByName(iq IQ, policyNames ...string) ([]ApplicationViolation, error)

GetPolicyViolationsByName returns the policy violations by policy name

type Component

type Component struct {
	Hash        string               `json:"hash,omitempty"`
	ComponentID *ComponentIdentifier `json:"componentIdentifier,omitempty"`
	Proprietary bool                 `json:"proprietary,omitempty"`
	PackageURL  string               `json:"packageUrl,omitempty"`
	MatchState  string               `json:"matchState,omitempty"`
	Pathnames   []string             `json:"pathnames,omitempty"`
}

Component encapsulates the details of a component in IQ

func NewComponentFromPURL added in v0.55.0

func NewComponentFromPURL(purl string) (*Component, error)

NewComponentFromPURL creates a new Component object from the given PURL string

func NewComponentFromString added in v0.25.0

func NewComponentFromString(str string) (*Component, error)

NewComponentFromString creates a new Component object by parsing a string in the expected format; format:group:name:version:ext

type ComponentDetail added in v0.28.0

type ComponentDetail struct {
	Component          Component   `json:"component"`
	MatchState         string      `json:"matchState"`
	CatalogDate        string      `json:"catalogDate"`
	RelativePopularity int64       `json:"relativePopularity,omitempty"`
	LicenseData        LicenseData `json:"licenseData"`
	SecurityData       struct {
		SecurityIssues []SecurityIssue `json:"securityIssues"`
	} `json:"securityData"`
}

ComponentDetail lists information about a given component

func GetAllComponents added in v0.52.0

func GetAllComponents(iq IQ) ([]ComponentDetail, error)

GetAllComponents returns an array with all components along with their

func GetComponent added in v0.28.0

func GetComponent(iq IQ, component Component) (ComponentDetail, error)

GetComponent returns information on a named component

func GetComponents added in v0.52.0

func GetComponents(iq IQ, components []Component) ([]ComponentDetail, error)

GetComponents returns information on the named components

func GetComponentsByApplication added in v0.52.0

func GetComponentsByApplication(iq IQ, appPublicID string) ([]ComponentDetail, error)

GetComponentsByApplication returns an array with all components along with their

type ComponentEvaluationResult

type ComponentEvaluationResult struct {
	Component    Component   `json:"component"`
	MatchState   string      `json:"matchState"`
	CatalogDate  string      `json:"catalogDate"`
	LicensesData LicenseData `json:"licenseData"`
	SecurityData struct {
		SecurityIssues []SecurityIssue `json:"securityIssues"`
	} `json:"securityData"`
	PolicyData struct {
		PolicyViolations []PolicyViolation `json:"policyViolations"`
	} `json:"policyData,omitempty"`
}

ComponentEvaluationResult holds the results of a component evaluation

func (*ComponentEvaluationResult) HighestThreatPolicy

func (c *ComponentEvaluationResult) HighestThreatPolicy() *PolicyViolation

HighestThreatPolicy returns the policy with the highest threat value

type ComponentIdentifier

type ComponentIdentifier struct {
	Format      string      `json:"format,omitempty"`
	Coordinates Coordinates `json:"coordinates,omitempty"`
}

ComponentIdentifier identifies the format and coordinates of a component

func (ComponentIdentifier) String added in v0.36.0

func (c ComponentIdentifier) String() string

String returns a string representation of the ComponentIdentifier object

type Coordinates added in v0.28.0

type Coordinates struct {
	ArtifactID string `json:"artifactId,omitempty"`
	GroupID    string `json:"groupId,omitempty"`
	Version    string `json:"version,omitempty"`
	Extension  string `json:"extension,omitempty"`
	Classifier string `json:"classifier,omitempty"`
}

Coordinates lists the unique values identifing a component

func (Coordinates) String added in v0.36.0

func (c Coordinates) String() string

String returns a string representation of the Coordinates object

type DataRetentionPolicies added in v0.31.0

type DataRetentionPolicies struct {
	ApplicationReports ApplicationReports  `json:"applicationReports"`
	SuccessMetrics     DataRetentionPolicy `json:"successMetrics"`
}

DataRetentionPolicies encapsulates an organization's retention policies

func GetRetentionPolicies added in v0.31.0

func GetRetentionPolicies(iq IQ, orgName string) (policies DataRetentionPolicies, err error)

GetRetentionPolicies returns the current retention policies

type DataRetentionPolicy added in v0.31.0

type DataRetentionPolicy struct {
	InheritPolicy bool   `json:"inheritPolicy"`
	EnablePurging bool   `json:"enablePurging"`
	MaxAge        string `json:"maxAge"`
}

DataRetentionPolicy describes the retention policies for a pipeline stage

type Evaluation

type Evaluation struct {
	SubmittedDate  string                      `json:"submittedDate"`
	EvaluationDate string                      `json:"evaluationDate"`
	ApplicationID  string                      `json:"applicationId"`
	Results        []ComponentEvaluationResult `json:"results"`
	IsError        bool                        `json:"isError"`
	ErrorMessage   interface{}                 `json:"errorMessage"`
}

Evaluation response thingy

func EvaluateComponents

func EvaluateComponents(iq IQ, components []Component, applicationID string) (*Evaluation, error)

EvaluateComponents evaluates the list of components

type IQ

type IQ interface {
	nexus.Client
}

IQ is the interface which allows interacting with an IQ server

func New

func New(host, username, password string) (IQ, error)

New creates a new IQ instance

type IQCategory added in v0.20.1

type IQCategory struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

IQCategory encapsulates the category that can be created in IQ

type IqCliResults added in v0.55.0

type IqCliResults struct {
	ApplicationID          string                 `json:"applicationId"`
	ScanID                 string                 `json:"scanId"`
	ReportHTMLURL          string                 `json:"reportHtmlUrl"`
	ReportPDFURL           string                 `json:"reportPdfUrl"`
	ReportDataURL          string                 `json:"reportDataUrl"`
	PolicyAction           string                 `json:"policyAction"`
	PolicyEvaluationResult policyEvaluationResult `json:"policyEvaluationResult"`
}

IqCliResults encapsulates the JSON object generated by an evaluation with the Nexus IQ CLI

func ReadIqCliResultFile added in v0.55.0

func ReadIqCliResultFile(filename string) (IqCliResults, error)

ReadIqCliResultFile marshals into a struct the results file from a Nexus IQ CLI evaluation

type IqComponentLabel added in v0.57.0

type IqComponentLabel struct {
	ID             string `json:"id,omitempty"`
	OwnerID        string `json:"ownerId,omitempty"`
	Label          string `json:"label"`
	LabelLowercase string `json:"labelLowercase,omitempty"`
	Description    string `json:"description,omitempty"`
	Color          string `json:"color"`
}

IqComponentLabel describes a component label

func CreateComponentLabelForApplication added in v0.58.0

func CreateComponentLabelForApplication(iq IQ, appID, label, description, color string) (IqComponentLabel, error)

CreateComponentLabelForApplication creates a label for an application

func CreateComponentLabelForOrganization added in v0.58.0

func CreateComponentLabelForOrganization(iq IQ, organization, label, description, color string) (IqComponentLabel, error)

CreateComponentLabelForOrganization creates a label for an organization

func GetComponentLabelsByAppID added in v0.57.0

func GetComponentLabelsByAppID(iq IQ, appID string) ([]IqComponentLabel, error)

GetComponentLabelsByAppID retrieves an array of an organization's component label

func GetComponentLabelsByOrganization added in v0.57.0

func GetComponentLabelsByOrganization(iq IQ, organization string) ([]IqComponentLabel, error)

GetComponentLabelsByOrganization retrieves an array of an organization's component label

type License added in v0.25.1

type License struct {
	LicenseID   string `json:"licenseId"`
	LicenseName string `json:"licenseName"`
}

License identifier an OSS license recognized by Sonatype

type LicenseData added in v0.25.0

type LicenseData struct {
	Status                  string    `json:"status,omitempty"`
	DeclaredLicenses        []License `json:"declaredLicenses,omitempty"`
	ObservedLicenses        []License `json:"observedLicenses,omitempty"`
	OverriddenLicenses      []License `json:"overriddenLicenses,omitempty"`
	EffectiveLicenseThreats []struct {
		LicenseThreatGroupCategory string `json:"licenseThreatGroupCategory,omitempty"`
		LicenseThreatGroupLevel    int64  `json:"licenseThreatGroupLevel,omitempty"`
		LicenseThreatGroupName     string `json:"licenseThreatGroupName,omitempty"`
	} `json:"effectiveLicenseThreats,omitempty"`
}

LicenseData encapsulates the information on the different licenses of a component

type Member added in v0.31.0

type Member struct {
	OwnerID         string `json:"ownerId,omitempty"`
	OwnerType       string `json:"ownerType,omitempty"`
	Type            string `json:"type"`
	UserOrGroupName string `json:"userOrGroupName"`
}

Member describes a member to map with a role

type MemberMapping added in v0.31.0

type MemberMapping struct {
	RoleID  string   `json:"roleId"`
	Members []Member `json:"members"`
}

MemberMapping describes a list of Members against a Role

func ApplicationAuthorizations added in v0.31.0

func ApplicationAuthorizations(iq IQ, name string) ([]MemberMapping, error)

ApplicationAuthorizations returns the member mappings of an application

func ApplicationAuthorizationsByRole added in v0.41.0

func ApplicationAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)

ApplicationAuthorizationsByRole returns the member mappings of all applications which match the given role

func GlobalAuthorizations added in v0.41.0

func GlobalAuthorizations(iq IQ) ([]MemberMapping, error)

GlobalAuthorizations returns all of the users and roles who have the administrator role across all of IQ

func MembersByRole added in v0.41.0

func MembersByRole(iq IQ, roleName string) ([]MemberMapping, error)

MembersByRole returns all users and groups by role name

func OrganizationAuthorizations added in v0.31.0

func OrganizationAuthorizations(iq IQ, name string) ([]MemberMapping, error)

OrganizationAuthorizations returns the member mappings of an organization

func OrganizationAuthorizationsByRole added in v0.41.0

func OrganizationAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)

OrganizationAuthorizationsByRole returns the member mappings of all organizations which match the given role

func RepositoriesAuthorizations added in v0.40.0

func RepositoriesAuthorizations(iq IQ) ([]MemberMapping, error)

RepositoriesAuthorizations returns the member mappings of all repositories

func RepositoriesAuthorizationsByRole added in v0.41.0

func RepositoriesAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)

RepositoriesAuthorizationsByRole returns the member mappings of all repositories which match the given role

type Metrics added in v0.46.0

type Metrics struct {
	ApplicationID       string        `json:"applicationId,omitempty"`
	ApplicationPublicID string        `json:"applicationPublicId,omitempty"`
	ApplicationName     string        `json:"applicationName,omitempty"`
	OrganizationID      string        `json:"organizationId,omitempty"`
	OrganizationName    string        `json:"organizationName,omitempty"`
	Aggregations        []aggregation `json:"aggregations,omitempty"`
}

Metrics encapsulates the data generate

func GenerateMetrics added in v0.46.0

func GenerateMetrics(iq IQ, builder *MetricsRequestBuilder) ([]Metrics, error)

GenerateMetrics creates metrics from the given qualifiers

Example
iq, err := New("http://localhost:8070", "admin", "admin123")
if err != nil {
	panic(err)
}

reqLastYear := NewMetricsRequestBuilder().Monthly().StartingOn(time.Now().Add(-(24 * time.Hour) * 365)).WithApplication("WebGoat")

metrics, err := GenerateMetrics(iq, reqLastYear)
if err != nil {
	panic(err)
}

buf, err := json.MarshalIndent(metrics, "", "  ")
if err != nil {
	panic(err)
}

fmt.Println(string(buf))
Output:

type MetricsRequestBuilder added in v0.46.0

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

MetricsRequestBuilder builds a request to retrieve metrics data from IQ

func NewMetricsRequestBuilder added in v0.46.0

func NewMetricsRequestBuilder() *MetricsRequestBuilder

NewMetricsRequestBuilder returns a new builder instance

func (*MetricsRequestBuilder) EndingOn added in v0.46.0

EndingOn allows you to set the ending time period for the data gathering. Optional

func (*MetricsRequestBuilder) Monthly added in v0.46.0

Monthly sets the request to use a monthly time period

func (*MetricsRequestBuilder) StartingOn added in v0.46.0

StartingOn allows you to set the starting time period for the data gathering

func (*MetricsRequestBuilder) Weekly added in v0.46.0

Weekly sets the request to use a weekly time period

func (*MetricsRequestBuilder) WithApplication added in v0.46.0

func (b *MetricsRequestBuilder) WithApplication(v string) *MetricsRequestBuilder

WithApplication adds an application (by Public ID) whose data to include

func (*MetricsRequestBuilder) WithOrganization added in v0.46.0

func (b *MetricsRequestBuilder) WithOrganization(v string) *MetricsRequestBuilder

WithOrganization adds an organization whose data to include in†he report

type Organization

type Organization struct {
	ID   string       `json:"id"`
	Name string       `json:"name"`
	Tags []IQCategory `json:"tags,omitempty"`
}

Organization describes the data in IQ about a given organization

func GetAllOrganizations

func GetAllOrganizations(iq IQ) ([]Organization, error)

GetAllOrganizations returns a slice of all of the organizations in an IQ instance

func GetOrganizationByName

func GetOrganizationByName(iq IQ, organizationName string) (*Organization, error)

GetOrganizationByName returns details on the named IQ organization

type PolicyInfo added in v0.27.0

type PolicyInfo struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	OwnerID     string `json:"ownerId"`
	OwnerType   string `json:"ownerType"`
	ThreatLevel int    `json:"threatLevel"`
	PolicyType  string `json:"policyType"`
}

PolicyInfo encapsulates the identifying information of an individual IQ policy

func GetPolicies added in v0.27.0

func GetPolicies(iq IQ) ([]PolicyInfo, error)

GetPolicies returns a list of all of the policies in IQ

func GetPolicyInfoByName added in v0.27.0

func GetPolicyInfoByName(iq IQ, policyName string) (PolicyInfo, error)

GetPolicyInfoByName returns an information object for the named policy

type PolicyReportComponent added in v0.48.0

type PolicyReportComponent struct {
	Component
	Violations []policyReportViolation `json:"violations"`
}

PolicyReportComponent encapsulates a component which violates a policy

type PolicyViolation

type PolicyViolation struct {
	PolicyID             string `json:"policyId"`
	PolicyName           string `json:"policyName"`
	StageID              string `json:"stageId,omitempty"`
	ReportURL            string `json:"reportUrl,omitempty"`
	ThreatLevel          int    `json:"threatLevel"`
	ConstraintViolations []struct {
		ConstraintID   string `json:"constraintId"`
		ConstraintName string `json:"constraintName"`
		Reasons        []struct {
			Reason string `json:"reason"`
		} `json:"reasons"`
		Component Component `json:"component,omitempty"`
	} `json:"constraintViolations"`
}

PolicyViolation is the policies violated by a component

type Remediation added in v0.26.0

type Remediation struct {
	Component      Component                  `json:"component,omitempty"`
	VersionChanges []remediationVersionChange `json:"versionChanges"`
}

Remediation encapsulates the remediation information for a component

func GetRemediationByApp added in v0.26.0

func GetRemediationByApp(iq IQ, component Component, stage, applicationID string) (Remediation, error)

GetRemediationByApp retrieves the remediation information on a component based on an application's policies

func GetRemediationByOrg added in v0.26.0

func GetRemediationByOrg(iq IQ, component Component, stage, organizationName string) (Remediation, error)

GetRemediationByOrg retrieves the remediation information on a component based on an organization's policies

func GetRemediationsByAppReport added in v0.33.0

func GetRemediationsByAppReport(iq IQ, applicationID, reportID string) (remediations []Remediation, err error)

GetRemediationsByAppReport retrieves the remediation information on each component of a report

func (Remediation) ComponentForRemediationType added in v0.53.0

func (r Remediation) ComponentForRemediationType(remType string) (Component, error)

ComponentForRemediationType returns the component which satisfies the given remediation strategy

type Report added in v0.25.0

type Report struct {
	Policy ReportPolicy `json:"policyReport"`
	Raw    ReportRaw    `json:"rawReport"`
}

Report encapsulates the policy and raw report of an application

func GetAllReports added in v0.53.1

func GetAllReports(iq IQ) ([]Report, error)

GetAllReports returns all policy and raw reports

func GetReportByAppID added in v0.25.0

func GetReportByAppID(iq IQ, appID, stage string) (report Report, err error)

GetReportByAppID returns report information by application public ID

func GetReportByAppReportID added in v0.56.0

func GetReportByAppReportID(iq IQ, appID, reportID string) (report Report, err error)

GetReportByAppReportID returns raw and policy report information for a given report ID

func GetReportsByOrganization added in v0.51.0

func GetReportsByOrganization(iq IQ, organizationName string) (reports []Report, err error)

GetReportsByOrganization returns all reports for an given organization

type ReportDiff added in v0.48.0

type ReportDiff struct {
	Reports []Report                `json:"reports"`
	Waived  []PolicyReportComponent `json:"waived,omitempty"`
	Fixed   []PolicyReportComponent `json:"fixed,omitempty"`
}

ReportDiff encapsulates the differences between reports

func ReportsDiff added in v0.48.0

func ReportsDiff(iq IQ, appID, report1ID, report2ID string) (ReportDiff, error)

ReportsDiff returns a structure describing various differences between two reports

type ReportInfo added in v0.25.0

type ReportInfo struct {
	ApplicationID           string `json:"applicationId"`
	EmbeddableReportHTMLURL string `json:"embeddableReportHtmlUrl"`
	EvaluationDateStr       string `json:"evaluationDate"`
	ReportDataURL           string `json:"reportDataUrl"`
	ReportHTMLURL           string `json:"reportHtmlUrl"`
	ReportPdfURL            string `json:"reportPdfUrl"`
	Stage                   string `json:"stage"`
	// contains filtered or unexported fields
}

ReportInfo encapsulates the summary information on a given report

func GetAllReportInfos added in v0.25.0

func GetAllReportInfos(iq IQ) ([]ReportInfo, error)

GetAllReportInfos returns all report infos

func GetReportInfoByAppIDStage added in v0.31.0

func GetReportInfoByAppIDStage(iq IQ, appID, stage string) (ReportInfo, error)

GetReportInfoByAppIDStage returns report information by application public ID and stage

func GetReportInfosByAppID added in v0.25.0

func GetReportInfosByAppID(iq IQ, appID string) (infos []ReportInfo, err error)

GetReportInfosByAppID returns report information by application public ID

func GetReportInfosByOrganization added in v0.49.0

func GetReportInfosByOrganization(iq IQ, organizationName string) (infos []ReportInfo, err error)

GetReportInfosByOrganization returns report information by organization name

func (*ReportInfo) EvaluationDate added in v0.25.0

func (r *ReportInfo) EvaluationDate() time.Time

EvaluationDate returns a time object of the report's EvaluationDate

func (*ReportInfo) ReportID added in v0.31.0

func (r *ReportInfo) ReportID() string

ReportID compares two ReportInfo objects

type ReportPolicy added in v0.25.0

type ReportPolicy struct {
	Application Application             `json:"application"`
	Components  []PolicyReportComponent `json:"components"`
	Counts      policyReportCounts      `json:"counts"`
	ReportTime  int64                   `json:"reportTime"`
	ReportTitle string                  `json:"reportTitle"`
	ReportInfo  ReportInfo              `json:"reportInfo,omitempty"`
}

ReportPolicy descrpibes the policies violated by the components in an application report

func GetPolicyReportByAppID added in v0.25.0

func GetPolicyReportByAppID(iq IQ, appID, stage string) (ReportPolicy, error)

GetPolicyReportByAppID returns report information by application public ID

type ReportRaw added in v0.25.0

type ReportRaw struct {
	Components   []rawReportComponent  `json:"components"`
	MatchSummary rawReportMatchSummary `json:"matchSummary"`
	ReportInfo   ReportInfo            `json:"reportInfo,omitempty"`
}

ReportRaw describes the raw data of an application report

func GetRawReportByAppID added in v0.25.0

func GetRawReportByAppID(iq IQ, appID, stage string) (ReportRaw, error)

GetRawReportByAppID returns report information by application public ID

type Role added in v0.31.0

type Role struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Role describes an IQ role

func RoleByName added in v0.31.0

func RoleByName(iq IQ, name string) (Role, error)

RoleByName returns the named role

func Roles added in v0.31.0

func Roles(iq IQ) ([]Role, error)

Roles returns a slice of all the roles in the IQ instance

type SearchQueryBuilder added in v0.28.0

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

SearchQueryBuilder allows you to build a search query

func NewSearchQueryBuilder added in v0.28.0

func NewSearchQueryBuilder() *SearchQueryBuilder

NewSearchQueryBuilder creates a new instance of SearchQueryBuilder

func (*SearchQueryBuilder) Build added in v0.28.0

func (b *SearchQueryBuilder) Build() string

Build will build the assembled search query

func (*SearchQueryBuilder) ComponentIdentifier added in v0.28.0

func (b *SearchQueryBuilder) ComponentIdentifier(c ComponentIdentifier) *SearchQueryBuilder

ComponentIdentifier allows specifiying a component identifier to filter by

func (*SearchQueryBuilder) Coordinates added in v0.28.0

Coordinates allows specifiying component coordinates to filter by

func (*SearchQueryBuilder) Format added in v0.28.0

Format allows specifiying a format to filter by

func (*SearchQueryBuilder) Hash added in v0.28.0

Hash allows specifiying a sha1 hash to filter by

func (*SearchQueryBuilder) PackageURL added in v0.28.0

func (b *SearchQueryBuilder) PackageURL(v string) *SearchQueryBuilder

PackageURL allows specifiying a purl to filter by

func (*SearchQueryBuilder) Stage added in v0.28.0

Stage allows specifiying a stage to filter by

type SearchResult added in v0.28.0

type SearchResult struct {
	ApplicationID       string              `json:"applicationId"`
	ApplicationName     string              `json:"applicationName"`
	ReportURL           string              `json:"reportUrl"`
	Hash                string              `json:"hash"`
	PackageURL          string              `json:"packageUrl"`
	ComponentIdentifier ComponentIdentifier `json:"componentIdentifier"`
}

SearchResult describes a component found based on search criteria

func SearchComponents added in v0.28.0

func SearchComponents(iq IQ, query nexus.SearchQueryBuilder) ([]SearchResult, error)

SearchComponents allows searching the indicated IQ instance for specific components

Example
iq, err := New("http://localhost:8070", "admin", "admin123")
if err != nil {
	panic(err)
}

query := NewSearchQueryBuilder()
query = query.Stage(StageBuild)
query = query.PackageURL("pkg:maven/commons-collections/commons-collections@3.2")

components, err := SearchComponents(iq, query)
if err != nil {
	panic(fmt.Sprintf("Did not complete search: %v", err))
}

fmt.Printf("%q\n", components)
Output:

type SecurityIssue added in v0.25.0

type SecurityIssue struct {
	Source         string  `json:"source"`
	Reference      string  `json:"reference"`
	Severity       float64 `json:"severity"`
	Status         string  `json:"status,omitempty"`
	URL            string  `json:"url"`
	ThreatCategory string  `json:"threatCategory"`
}

SecurityIssue encapsulates a security issue in the Sonatype database

type SourceControlEntry

type SourceControlEntry struct {
	ID            string `json:"id,omitempty"`
	ApplicationID string `json:"applicationId"`
	RepositoryURL string `json:"repositoryUrl"`
	Token         string `json:"token"`
}

SourceControlEntry describes a Source Control entry in IQ

func GetAllSourceControlEntries

func GetAllSourceControlEntries(iq IQ) ([]SourceControlEntry, error)

GetAllSourceControlEntries lists of all of the Source Control entries in the IQ instance

func GetSourceControlEntry

func GetSourceControlEntry(iq IQ, applicationID string) (SourceControlEntry, error)

GetSourceControlEntry lists of all of the Source Control entries for the given application

type Stage added in v0.31.0

type Stage string

Stage type describes a pipeline stage

type User added in v0.39.0

type User struct {
	Username  string `json:"username,omitempty"`
	FirstName string `json:"firstName,omitempty"`
	LastName  string `json:"lastName,omitempty"`
	Email     string `json:"email,omitempty"`
	Password  string `json:"password,omitempty"`
}

User encapsulates the information of a user in IQ

func GetUser added in v0.39.0

func GetUser(iq IQ, username string) (user User, err error)

GetUser returns user details for the given name

Directories

Path Synopsis
Package iqwebhooks provides structs for all of the Nexus IQ webhook events as well as an http.HandlerFunc which will take the http.Request and put any IQ webhook it finds on a channel.
Package iqwebhooks provides structs for all of the Nexus IQ webhook events as well as an http.HandlerFunc which will take the http.Request and put any IQ webhook it finds on a channel.

Jump to

Keyboard shortcuts

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