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 ¶
- Constants
- func ComponentLabelApply(iq IQ, comp Component, appID, label string) error
- func ComponentLabelUnapply(iq IQ, comp Component, appID, label string) error
- func ComponentVersions(iq IQ, comp Component) (versions []string, err error)
- func CreateApplication(iq IQ, name, id, organizationID string) (string, error)
- func CreateOrganization(iq IQ, name string) (string, error)
- func CreateSourceControlEntry(iq IQ, applicationID, repositoryURL, token string) error
- func CreateWaiverByViolationId(iq IQ, properties PolicyWaiverProperties, ownerType, ownerId string) (err error)
- func DeleteApplication(iq IQ, applicationID string) error
- func DeleteComponentLabelForApplication(iq IQ, appID, label string) error
- func DeleteComponentLabelForOrganization(iq IQ, organization, label string) error
- func DeleteSourceControlEntry(iq IQ, applicationID, sourceControlID string) error
- func DeleteSourceControlEntryByApp(iq IQ, applicationID string) error
- func DeleteUser(iq IQ, username string) error
- func GetSystemAdminID(iq IQ) (string, error)
- func RevokeApplicationGroup(iq IQ, name, roleName, group string) error
- func RevokeApplicationUser(iq IQ, name, roleName, user string) error
- func RevokeGlobalGroup(iq IQ, roleName, group string) error
- func RevokeGlobalUser(iq IQ, roleName, user string) error
- func RevokeOrganizationGroup(iq IQ, name, roleName, group string) error
- func RevokeOrganizationUser(iq IQ, name, roleName, user string) error
- func RevokeRepositoriesGroup(iq IQ, roleName, group string) error
- func RevokeRepositoriesUser(iq IQ, roleName, user string) error
- func SetApplicationGroup(iq IQ, name, roleName, group string) error
- func SetApplicationUser(iq IQ, name, roleName, user string) error
- func SetGlobalGroup(iq IQ, roleName, group string) error
- func SetGlobalUser(iq IQ, roleName, user string) error
- func SetOrganizationGroup(iq IQ, name, roleName, group string) error
- func SetOrganizationUser(iq IQ, name, roleName, user string) error
- func SetRepositoriesGroup(iq IQ, roleName, group string) error
- func SetRepositoriesUser(iq IQ, roleName, user string) error
- func SetRetentionPolicies(iq IQ, orgName string, policies DataRetentionPolicies) error
- func SetUser(iq IQ, user User) (err error)
- func UpdateSourceControlEntry(iq IQ, applicationID, repositoryURL, token string) error
- type Application
- type ApplicationReports
- type ApplicationViolation
- type Component
- type ComponentDetail
- type ComponentEvaluationResult
- type ComponentIdentifier
- type ComponentMatcher
- type Coordinates
- type DataRetentionPolicies
- type DataRetentionPolicy
- type Evaluation
- type IQ
- type IQCategory
- type IqCliResults
- type IqComponentLabel
- func CreateComponentLabelForApplication(iq IQ, appID, label, description, color string) (IqComponentLabel, error)
- func CreateComponentLabelForOrganization(iq IQ, organization, label, description, color string) (IqComponentLabel, error)
- func GetComponentLabelsByAppID(iq IQ, appID string) ([]IqComponentLabel, error)
- func GetComponentLabelsByOrganization(iq IQ, organization string) ([]IqComponentLabel, error)
- type License
- type LicenseData
- type Member
- type MemberMapping
- func ApplicationAuthorizations(iq IQ, name string) ([]MemberMapping, error)
- func ApplicationAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)
- func GlobalAuthorizations(iq IQ) ([]MemberMapping, error)
- func MembersByRole(iq IQ, roleName string) ([]MemberMapping, error)
- func OrganizationAuthorizations(iq IQ, name string) ([]MemberMapping, error)
- func OrganizationAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)
- func RepositoriesAuthorizations(iq IQ) ([]MemberMapping, error)
- func RepositoriesAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)
- type Metrics
- type MetricsRequestBuilder
- func (b *MetricsRequestBuilder) EndingOn(v time.Time) *MetricsRequestBuilder
- func (b *MetricsRequestBuilder) Monthly() *MetricsRequestBuilder
- func (b *MetricsRequestBuilder) StartingOn(v time.Time) *MetricsRequestBuilder
- func (b *MetricsRequestBuilder) Weekly() *MetricsRequestBuilder
- func (b *MetricsRequestBuilder) WithApplication(v string) *MetricsRequestBuilder
- func (b *MetricsRequestBuilder) WithOrganization(v string) *MetricsRequestBuilder
- type Organization
- type OwnerType
- type PolicyInfo
- type PolicyReportComponent
- type PolicyReportViolation
- type PolicyViolation
- type PolicyWaiverProperties
- type Remediation
- func GetRemediationByApp(iq IQ, component Component, stage, applicationID string) (Remediation, error)
- func GetRemediationByOrg(iq IQ, component Component, stage, organizationName string) (Remediation, error)
- func GetRemediationsByAppReport(iq IQ, applicationID, reportID string) (remediations []Remediation, err error)
- type Report
- type ReportDiff
- type ReportInfo
- func GetAllReportInfos(iq IQ) ([]ReportInfo, error)
- func GetReportInfoByAppIDStage(iq IQ, appID, stage string) (ReportInfo, error)
- func GetReportInfosByAppID(iq IQ, appID string) (infos []ReportInfo, err error)
- func GetReportInfosByOrganization(iq IQ, organizationName string) (infos []ReportInfo, err error)
- type ReportPolicy
- type ReportRaw
- type Role
- type SearchQueryBuilder
- func (b *SearchQueryBuilder) Build() string
- func (b *SearchQueryBuilder) ComponentIdentifier(c ComponentIdentifier) *SearchQueryBuilder
- func (b *SearchQueryBuilder) Coordinates(c Coordinates) *SearchQueryBuilder
- func (b *SearchQueryBuilder) Format(v string) *SearchQueryBuilder
- func (b *SearchQueryBuilder) Hash(v string) *SearchQueryBuilder
- func (b *SearchQueryBuilder) PackageURL(v string) *SearchQueryBuilder
- func (b *SearchQueryBuilder) Stage(v string) *SearchQueryBuilder
- type SearchResult
- type SecurityIssue
- type SourceControlEntry
- type Stage
- type User
Examples ¶
Constants ¶
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" )
const ( StageProxy = "proxy" StageDevelop = "develop" StageBuild = "build" StageStageRelease = "stage-release" StageRelease = "release" StageOperate = "operate" StageContinuousMonitoring = "continuous-monitoring" )
Provides a constants for the IQ stages
const ( MemberTypeUser = "USER" MemberTypeGroup = "GROUP" )
Constants to describe a Member Type
const (
// RootOrganization is the ID of the ... Root ... Organization
RootOrganization = "ROOT_ORGANIZATION_ID"
)
Variables ¶
This section is empty.
Functions ¶
func ComponentLabelApply ¶
ComponentLabelApply adds an existing label to a component for a given application
func ComponentLabelUnapply ¶
ComponentLabelUnapply removes an existing association between a label and a component
func ComponentVersions ¶
ComponentVersions returns all known versions of a given component
func CreateApplication ¶
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 ¶
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 ¶
CreateSourceControlEntry creates a source control entry in IQ
func CreateWaiverByViolationId ¶
func CreateWaiverByViolationId(iq IQ, properties PolicyWaiverProperties, ownerType, ownerId string) (err error)
func DeleteApplication ¶
DeleteApplication deletes an application in IQ with the given id
func DeleteComponentLabelForApplication ¶
DeleteComponentLabelForApplication deletes a label from an application
func DeleteComponentLabelForOrganization ¶
DeleteComponentLabelForOrganization deletes a label from an organization
func DeleteSourceControlEntry ¶
DeleteSourceControlEntry deletes a source control entry in IQ
func DeleteSourceControlEntryByApp ¶
DeleteSourceControlEntryByApp deletes a source control entry in IQ for the given application
func GetSystemAdminID ¶
GetSystemAdminID returns the identifier of the System Administrator role
func RevokeApplicationGroup ¶
RevokeApplicationGroup removes a group and role from the named application
func RevokeApplicationUser ¶
RevokeApplicationUser removes a user and role from the named application
func RevokeGlobalGroup ¶
RevokeGlobalGroup revoke the role and group that can have access to the global
func RevokeGlobalUser ¶
RevokeGlobalUser revoke the role and user that can have access to the global
func RevokeOrganizationGroup ¶
RevokeOrganizationGroup removes a group and role from the named organization
func RevokeOrganizationUser ¶
RevokeOrganizationUser removes a user and role from the named organization
func RevokeRepositoriesGroup ¶
RevokeRepositoriesGroup revoke the role and group that can have access to the repositories
func RevokeRepositoriesUser ¶
RevokeRepositoriesUser revoke the role and user that can have access to the repositories
func SetApplicationGroup ¶
SetApplicationGroup sets the role and group that can have access to an application
func SetApplicationUser ¶
SetApplicationUser sets the role and user that can have access to an application
func SetGlobalGroup ¶
SetGlobalGroup sets the role and group that can have access to the global
func SetGlobalUser ¶
SetGlobalUser sets the role and user that can have access to the repositories
func SetOrganizationGroup ¶
SetOrganizationGroup sets the role and group that can have access to an organization
func SetOrganizationUser ¶
SetOrganizationUser sets the role and user that can have access to an organization
func SetRepositoriesGroup ¶
SetRepositoriesGroup sets the role and group that can have access to the repositories
func SetRepositoriesUser ¶
SetRepositoriesUser sets the role and user that can have access to the repositories
func SetRetentionPolicies ¶
func SetRetentionPolicies(iq IQ, orgName string, policies DataRetentionPolicies) error
SetRetentionPolicies updates the retention policies
func UpdateSourceControlEntry ¶
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 ¶
func GetApplicationsByOrganization(iq IQ, organizationName string) ([]Application, error)
GetApplicationsByOrganization returns all applications under a given organization
type ApplicationReports ¶
type ApplicationReports struct {
Stages map[Stage]DataRetentionPolicy `json:"stages"`
}
ApplicationReports captures the policies related to application reports
type ApplicationViolation ¶
type ApplicationViolation struct { Application Application `json:"application"` PolicyViolations []PolicyViolation `json:"policyViolations"` }
ApplicationViolation encapsulates the information about which violations an application has
func GetAllPolicyViolations ¶
func GetAllPolicyViolations(iq IQ) ([]ApplicationViolation, error)
GetAllPolicyViolations returns all policy violations
func GetPolicyViolationsByName ¶
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 ¶
NewComponentFromPURL creates a new Component object from the given PURL string
func NewComponentFromString ¶
NewComponentFromString creates a new Component object by parsing a string in the expected format; format:group:name:version:ext
type ComponentDetail ¶
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 ¶
func GetAllComponents(iq IQ) ([]ComponentDetail, error)
GetAllComponents returns an array with all components along with their
func GetComponent ¶
func GetComponent(iq IQ, component Component) (ComponentDetail, error)
GetComponent returns information on a named component
func GetComponents ¶
func GetComponents(iq IQ, components []Component) ([]ComponentDetail, error)
GetComponents returns information on the named components
func GetComponentsByApplication ¶
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 ¶
func (c ComponentIdentifier) String() string
String returns a string representation of the ComponentIdentifier object
type ComponentMatcher ¶
type ComponentMatcher string
ComponentMatcher type defines the component scope of the waiver
const ( MatchExactComponent ComponentMatcher = "EXACT_COMPONENT" MatchAllComponents ComponentMatcher = "ALL_COMPONENTS" MatchAllVersions ComponentMatcher = "ALL_VERSIONS" )
Provides guide rails for the matcher strategies
type Coordinates ¶
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 ¶
func (c Coordinates) String() string
String returns a string representation of the Coordinates object
type DataRetentionPolicies ¶
type DataRetentionPolicies struct { ApplicationReports ApplicationReports `json:"applicationReports"` SuccessMetrics DataRetentionPolicy `json:"successMetrics"` }
DataRetentionPolicies encapsulates an organization's retention policies
func GetRetentionPolicies ¶
func GetRetentionPolicies(iq IQ, orgName string) (policies DataRetentionPolicies, err error)
GetRetentionPolicies returns the current retention policies
type DataRetentionPolicy ¶
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 IQCategory ¶
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 ¶
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 ¶
func ReadIqCliResultFile(filename string) (IqCliResults, error)
ReadIqCliResultFile marshals into a struct the results file from a Nexus IQ CLI evaluation
type IqComponentLabel ¶
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 ¶
func CreateComponentLabelForApplication(iq IQ, appID, label, description, color string) (IqComponentLabel, error)
CreateComponentLabelForApplication creates a label for an application
func CreateComponentLabelForOrganization ¶
func CreateComponentLabelForOrganization(iq IQ, organization, label, description, color string) (IqComponentLabel, error)
CreateComponentLabelForOrganization creates a label for an organization
func GetComponentLabelsByAppID ¶
func GetComponentLabelsByAppID(iq IQ, appID string) ([]IqComponentLabel, error)
GetComponentLabelsByAppID retrieves an array of an organization's component label
func GetComponentLabelsByOrganization ¶
func GetComponentLabelsByOrganization(iq IQ, organization string) ([]IqComponentLabel, error)
GetComponentLabelsByOrganization retrieves an array of an organization's component label
type LicenseData ¶
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 ¶
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 ¶
MemberMapping describes a list of Members against a Role
func ApplicationAuthorizations ¶
func ApplicationAuthorizations(iq IQ, name string) ([]MemberMapping, error)
ApplicationAuthorizations returns the member mappings of an application
func ApplicationAuthorizationsByRole ¶
func ApplicationAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)
ApplicationAuthorizationsByRole returns the member mappings of all applications which match the given role
func GlobalAuthorizations ¶
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 ¶
func MembersByRole(iq IQ, roleName string) ([]MemberMapping, error)
MembersByRole returns all users and groups by role name
func OrganizationAuthorizations ¶
func OrganizationAuthorizations(iq IQ, name string) ([]MemberMapping, error)
OrganizationAuthorizations returns the member mappings of an organization
func OrganizationAuthorizationsByRole ¶
func OrganizationAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)
OrganizationAuthorizationsByRole returns the member mappings of all organizations which match the given role
func RepositoriesAuthorizations ¶
func RepositoriesAuthorizations(iq IQ) ([]MemberMapping, error)
RepositoriesAuthorizations returns the member mappings of all repositories
func RepositoriesAuthorizationsByRole ¶
func RepositoriesAuthorizationsByRole(iq IQ, roleName string) ([]MemberMapping, error)
RepositoriesAuthorizationsByRole returns the member mappings of all repositories which match the given role
type Metrics ¶
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 ¶
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 ¶
type MetricsRequestBuilder struct {
// contains filtered or unexported fields
}
MetricsRequestBuilder builds a request to retrieve metrics data from IQ
func NewMetricsRequestBuilder ¶
func NewMetricsRequestBuilder() *MetricsRequestBuilder
NewMetricsRequestBuilder returns a new builder instance
func (*MetricsRequestBuilder) EndingOn ¶
func (b *MetricsRequestBuilder) EndingOn(v time.Time) *MetricsRequestBuilder
EndingOn allows you to set the ending time period for the data gathering. Optional
func (*MetricsRequestBuilder) Monthly ¶
func (b *MetricsRequestBuilder) Monthly() *MetricsRequestBuilder
Monthly sets the request to use a monthly time period
func (*MetricsRequestBuilder) StartingOn ¶
func (b *MetricsRequestBuilder) StartingOn(v time.Time) *MetricsRequestBuilder
StartingOn allows you to set the starting time period for the data gathering
func (*MetricsRequestBuilder) Weekly ¶
func (b *MetricsRequestBuilder) Weekly() *MetricsRequestBuilder
Weekly sets the request to use a weekly time period
func (*MetricsRequestBuilder) WithApplication ¶
func (b *MetricsRequestBuilder) WithApplication(v string) *MetricsRequestBuilder
WithApplication adds an application (by Public ID) whose data to include
func (*MetricsRequestBuilder) WithOrganization ¶
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 OwnerType ¶
type OwnerType string
OwnerType type defines the organizational scope of the waiver
type PolicyInfo ¶
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 ¶
func GetPolicies(iq IQ) ([]PolicyInfo, error)
GetPolicies returns a list of all of the policies in IQ
func GetPolicyInfoByName ¶
func GetPolicyInfoByName(iq IQ, policyName string) (PolicyInfo, error)
GetPolicyInfoByName returns an information object for the named policy
type PolicyReportComponent ¶
type PolicyReportComponent struct { Component Violations []PolicyReportViolation `json:"violations"` }
PolicyReportComponent encapsulates a component which violates a policy
type PolicyReportViolation ¶
type PolicyReportViolation struct { Constraints []struct { Conditions []struct { ConditionReason string `json:"conditionReason"` ConditionSummary string `json:"conditionSummary"` } `json:"conditions"` ConstraintID string `json:"constraintId"` ConstraintName string `json:"constraintName"` } `json:"constraints"` Grandfathered bool `json:"grandfathered"` PolicyID string `json:"policyId"` PolicyViolationId string `json:"policyViolationId"` PolicyName string `json:"policyName"` PolicyThreatCategory string `json:"policyThreatCategory"` PolicyThreatLevel int64 `json:"policyThreatLevel"` Waived bool `json:"waived"` }
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 PolicyWaiverProperties ¶
type Remediation ¶
type Remediation struct { Component Component `json:"component,omitempty"` VersionChanges []remediationVersionChange `json:"versionChanges"` }
Remediation encapsulates the remediation information for a component
func GetRemediationByApp ¶
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 ¶
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 ¶
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 ¶
func (r Remediation) ComponentForRemediationType(remType string) (Component, error)
ComponentForRemediationType returns the component which satisfies the given remediation strategy
type Report ¶
type Report struct { Policy ReportPolicy `json:"policyReport"` Raw ReportRaw `json:"rawReport"` }
Report encapsulates the policy and raw report of an application
func GetAllReports ¶
GetAllReports returns all policy and raw reports
func GetReportByAppID ¶
GetReportByAppID returns report information by application public ID
func GetReportByAppReportID ¶
GetReportByAppReportID returns raw and policy report information for a given report ID
type ReportDiff ¶
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 ¶
func ReportsDiff(iq IQ, appID, report1ID, report2ID string) (ReportDiff, error)
ReportsDiff returns a structure describing various differences between two reports
type ReportInfo ¶
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 ¶
func GetAllReportInfos(iq IQ) ([]ReportInfo, error)
GetAllReportInfos returns all report infos
func GetReportInfoByAppIDStage ¶
func GetReportInfoByAppIDStage(iq IQ, appID, stage string) (ReportInfo, error)
GetReportInfoByAppIDStage returns report information by application public ID and stage
func GetReportInfosByAppID ¶
func GetReportInfosByAppID(iq IQ, appID string) (infos []ReportInfo, err error)
GetReportInfosByAppID returns report information by application public ID
func GetReportInfosByOrganization ¶
func GetReportInfosByOrganization(iq IQ, organizationName string) (infos []ReportInfo, err error)
GetReportInfosByOrganization returns report information by organization name
func (*ReportInfo) EvaluationDate ¶
func (r *ReportInfo) EvaluationDate() time.Time
EvaluationDate returns a time object of the report's EvaluationDate
func (*ReportInfo) ReportID ¶
func (r *ReportInfo) ReportID() string
ReportID compares two ReportInfo objects
type ReportPolicy ¶
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 ¶
func GetPolicyReportByAppID(iq IQ, appID, stage string) (ReportPolicy, error)
GetPolicyReportByAppID returns report information by application public ID
type ReportRaw ¶
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
type Role ¶
type Role struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` }
Role describes an IQ role
func RoleByName ¶
RoleByName returns the named role
type SearchQueryBuilder ¶
type SearchQueryBuilder struct {
// contains filtered or unexported fields
}
SearchQueryBuilder allows you to build a search query
func NewSearchQueryBuilder ¶
func NewSearchQueryBuilder() *SearchQueryBuilder
NewSearchQueryBuilder creates a new instance of SearchQueryBuilder
func (*SearchQueryBuilder) Build ¶
func (b *SearchQueryBuilder) Build() string
Build will build the assembled search query
func (*SearchQueryBuilder) ComponentIdentifier ¶
func (b *SearchQueryBuilder) ComponentIdentifier(c ComponentIdentifier) *SearchQueryBuilder
ComponentIdentifier allows specifiying a component identifier to filter by
func (*SearchQueryBuilder) Coordinates ¶
func (b *SearchQueryBuilder) Coordinates(c Coordinates) *SearchQueryBuilder
Coordinates allows specifiying component coordinates to filter by
func (*SearchQueryBuilder) Format ¶
func (b *SearchQueryBuilder) Format(v string) *SearchQueryBuilder
Format allows specifiying a format to filter by
func (*SearchQueryBuilder) Hash ¶
func (b *SearchQueryBuilder) Hash(v string) *SearchQueryBuilder
Hash allows specifiying a sha1 hash to filter by
func (*SearchQueryBuilder) PackageURL ¶
func (b *SearchQueryBuilder) PackageURL(v string) *SearchQueryBuilder
PackageURL allows specifiying a purl to filter by
func (*SearchQueryBuilder) Stage ¶
func (b *SearchQueryBuilder) Stage(v string) *SearchQueryBuilder
Stage allows specifiying a stage to filter by
type SearchResult ¶
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 ¶
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 ¶
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
Source Files ¶
- application.go
- cli.go
- componentDetails.go
- componentLabels.go
- componentVersions.go
- componentsRemediation.go
- dataRetentionPolicies.go
- doc.go
- evaluation.go
- iq.go
- organization.go
- policies.go
- policyViolations.go
- policyWaivers.go
- reportMetrics.go
- reports.go
- roleMemberships.go
- roles.go
- search.go
- sourceControl.go
- users.go
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. |