Documentation ¶
Index ¶
- Constants
- func AnnotateHubClientError(old error, format string) error
- func AnnotateHubClientErrorf(old error, format string, args ...interface{}) error
- func HubClientErrorf(format string, args ...interface{}) error
- func HubClientStatusCodeErrorf(statusCode int, format string, args ...interface{}) error
- func TraceHubClientError(old error) error
- type ArrayChunkIterator
- type BearerTokenResponse
- type ChunkIterator
- type Client
- func NewWithApiToken(baseURL string, apiToken string, debugFlags HubClientDebug, ...) (*Client, error)
- func NewWithApiTokenAndClient(baseURL string, apiToken string, debugFlags HubClientDebug, ...) (*Client, error)
- func NewWithClient(baseURL string, debugFlags HubClientDebug, httpClient *http.Client) (*Client, error)
- func NewWithSession(baseURL string, debugFlags HubClientDebug, timeout time.Duration) (*Client, error)
- func NewWithToken(baseURL string, authToken string, debugFlags HubClientDebug, ...) (*Client, error)
- func NewWithTokenAndClient(baseURL string, authToken string, debugFlags HubClientDebug, ...) (*Client, error)
- func (c *Client) AssignUserToProject(link hubapi.ResourceLink, userAssignmentRequest *hubapi.UserAssignmentRequest) (string, error)
- func (c *Client) BaseURL() string
- func (c *Client) CheckHubLiveness() (error, *hubapi.HealthCheckStatus)
- func (c *Client) CheckHubReadiness() (error, *hubapi.HealthCheckStatus)
- func (c *Client) Count(link string) (int, error)
- func (c *Client) CountProjectVersionVulnerableComponents(link hubapi.ResourceLink) (int, error)
- func (c *Client) CreateApiToken(name, description string, readOnly bool) (location string, token string, err error)
- func (c *Client) CreateComponent(componentRequest *hubapi.ComponentRequest) (string, error)
- func (c *Client) CreatePolicyRule(policyRuleRequest *hubapi.PolicyRuleRequest) (string, error)
- func (c *Client) CreateProject(projectRequest *hubapi.ProjectRequest) (string, error)
- func (c *Client) CreateProjectVersion(link hubapi.ResourceLink, projectVersionRequest *hubapi.ProjectVersionRequest) (string, error)
- func (c *Client) CreateUser(userRequest *hubapi.UserRequest) (*hubapi.User, error)
- func (c *Client) CurrentVersion() (*hubapi.CurrentVersion, error)
- func (c *Client) DeleteApiToken(tokenUrl string) error
- func (c *Client) DeleteCodeLocation(codeLocationURL string) error
- func (c *Client) DeleteComponent(componentURL string) error
- func (c *Client) DeletePolicyRule(policyRuleURL string) error
- func (c *Client) DeleteProject(projectURL string) error
- func (c *Client) DeleteProjectVersion(projectVersionURL string) error
- func (c *Client) DetectURI() (*hubapi.DetectURI, error)
- func (c *Client) DownloadScanClientLinux(path string) error
- func (c *Client) DownloadScanClientMac(path string) error
- func (c *Client) DownloadScanClientWindows(path string) error
- func (c *Client) FetchResults(rapidScanEndpoint string, offset int, pageLimit int) (err error, httpStatus int, result *hubapi.RapidScanResult)
- func (c *Client) ForEachPage(link string, listOptions *hubapi.GetListOptions, list interface{}, ...) (err error)
- func (c *Client) GetAuthTokenExpiryTime() int64
- func (c *Client) GetCodeLocation(link hubapi.ResourceLink) (*hubapi.CodeLocation, error)
- func (c *Client) GetComponent(link hubapi.ResourceLink) (*hubapi.Component, error)
- func (c *Client) GetComponentVersion(link hubapi.ResourceLink) (*hubapi.ComponentVersion, error)
- func (c *Client) GetComponentVersionRemediation(componentVersionHref string) (*hubapi.ComponentRemediation, error)
- func (c *Client) GetCurrentUser() (response *hubapi.CurrentUserResponse, err error)
- func (c *Client) GetExternalExtension(link hubapi.ResourceLink) (*hubapi.ExternalExtension, error)
- func (c *Client) GetPage(link string, options *hubapi.GetListOptions, list interface{}) error
- func (c *Client) GetPolicyRule(link hubapi.ResourceLink) (*hubapi.PolicyRule, error)
- func (c *Client) GetProject(link hubapi.ResourceLink) (*hubapi.Project, error)
- func (c *Client) GetProjectVersion(link hubapi.ResourceLink) (*hubapi.ProjectVersion, error)
- func (c *Client) GetProjectVersionPolicyStatus(link hubapi.ResourceLink) (*hubapi.ProjectVersionPolicyStatus, error)
- func (c *Client) GetProjectVersionRiskProfile(link hubapi.ResourceLink) (*hubapi.ProjectVersionRiskProfile, error)
- func (c *Client) GetScanSummary(link hubapi.ResourceLink) (*hubapi.ScanSummary, error)
- func (c *Client) GetUpgradeGuidanceForComponent(componentVariant hubapi.ComponentVariant) (*hubapi.ComponentUpgradeGuidance, error)
- func (c *Client) GetUpgradeGuidanceForComponentVersion(componentVersion *hubapi.ComponentVersion) (*hubapi.ComponentUpgradeGuidance, error)
- func (c *Client) GetUser(link hubapi.ResourceLink) (*hubapi.User, error)
- func (c *Client) GetVulnerability(link hubapi.ResourceLink) (*hubapi.Vulnerability, error)
- func (c *Client) HttpDelete(url string, contentType string, expectedStatusCode int) error
- func (c *Client) HttpGetJSON(url string, result interface{}, expectedStatusCode int, mimetypes ...string) error
- func (c *Client) HttpGetString(url string, result *string, expectedStatusCode []int, mimetypes ...string) (error, int)
- func (c *Client) HttpPostFile(url string, filePath string, contentType string) (string, int, error)
- func (c *Client) HttpPostJSON(url string, data interface{}, contentType string, expectedStatusCode int) (string, error)
- func (c *Client) HttpPostJSONExpectResult(url string, data interface{}, result interface{}, contentType string, ...) (string, error)
- func (c *Client) HttpPostString(url string, data string, contentType string, expectedStatusCode int) (string, error)
- func (c *Client) HttpPutJSON(url string, data interface{}, contentType string, expectedStatusCode int) error
- func (c *Client) HttpPutString(url string, data string, contentType string, expectedStatusCode int) error
- func (c *Client) HttpPutStringWithHeader(url string, data string, contentType string, expectedStatusCode int, ...) error
- func (c *Client) ListAllCodeLocations(options *hubapi.GetListOptions) (*hubapi.CodeLocationList, error)
- func (c *Client) ListAllComponents(options *hubapi.GetListOptions) (*hubapi.ComponentList, error)
- func (c *Client) ListAllProjectVersionVulnerableComponents(link hubapi.ResourceLink) ([]hubapi.BomVulnerableComponent, error)
- func (c *Client) ListApiTokens(options *hubapi.GetListOptions) (*hubapi.ApiTokenList, error)
- func (c *Client) ListCodeLocations(link hubapi.ResourceLink, options *hubapi.GetListOptions) (*hubapi.CodeLocationList, error)
- func (c *Client) ListComponents(options *hubapi.GetListOptions) (*hubapi.ComponentList, error)
- func (c *Client) ListPolicyRules(options *hubapi.GetListOptions) (*hubapi.PolicyRuleList, error)
- func (c *Client) ListProjectVersionComponents(link hubapi.ResourceLink) (*hubapi.BomComponentList, error)
- func (c *Client) ListProjectVersionVulnerableComponents(link hubapi.ResourceLink) (*hubapi.BomVulnerableComponentList, error)
- func (c *Client) ListProjectVersions(link hubapi.ResourceLink, options *hubapi.GetListOptions) (*hubapi.ProjectVersionList, error)
- func (c *Client) ListProjects(options *hubapi.GetListOptions) (*hubapi.ProjectList, error)
- func (c *Client) ListScanSummaries(link hubapi.ResourceLink) (*hubapi.ScanSummaryList, error)
- func (c *Client) ListUsers(options *hubapi.GetListOptions) (*hubapi.UserList, error)
- func (c *Client) Login(username string, password string) error
- func (c *Client) PollRapidScanResults(rapidScanEndpoint string, interval, timeout time.Duration, pageLimit int) (error, *hubapi.RapidScanResult)
- func (c *Client) SetBearerToken(token string)
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) SetUserAgent(agent string)
- func (c *Client) SsoStatus() (*hubapi.SsoStatus, error)
- func (c *Client) StartRapidScan(bdioHeaderContent string) (error, string)
- func (c *Client) UpdateExternalExtension(extension *hubapi.ExternalExtension) error
- func (c *Client) UploadBdioFiles(bdioUploadEndpoint string, bdioContents []string) error
- func (c *Client) UploadBdioFilesByChunk(bdioUploadEndpoint string, chunkCount int, iterator ChunkIterator) error
- type HubClientDebug
- type HubClientError
- type HubResponseError
- type HubResponseErrorArgument
Constants ¶
const ( HeaderNameContentType = "Content-Type" HeaderNameAccept = "Accept" HeaderNameAuthorization = "Authorization" HeaderNameCsrfToken = "X-Csrf-Token" HeaderNameUserAgent = "User-Agent" )
Variables ¶
This section is empty.
Functions ¶
func AnnotateHubClientError ¶ added in v0.9.5
func AnnotateHubClientErrorf ¶ added in v0.9.5
func HubClientErrorf ¶ added in v0.9.5
func HubClientStatusCodeErrorf ¶ added in v0.9.7
func TraceHubClientError ¶ added in v0.9.5
Types ¶
type ArrayChunkIterator ¶ added in v0.9.11
type ArrayChunkIterator struct {
// contains filtered or unexported fields
}
func NewArrayChunkIterator ¶ added in v0.9.11
func NewArrayChunkIterator(chunks []string) ArrayChunkIterator
func (*ArrayChunkIterator) HasNext ¶ added in v0.9.11
func (i *ArrayChunkIterator) HasNext() bool
func (*ArrayChunkIterator) Next ¶ added in v0.9.11
func (i *ArrayChunkIterator) Next() (string, error)
Next returns true and the next chunk if there is a next chunk. Returns false otherwise.
type BearerTokenResponse ¶ added in v0.9.5
type ChunkIterator ¶ added in v0.9.11
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client will need to support CSRF tokens for session-based auth for Hub 4.1.x (or was it 4.0?)
func NewWithApiToken ¶ added in v0.9.5
func NewWithApiTokenAndClient ¶ added in v0.9.5
func NewWithClient ¶ added in v0.9.5
func NewWithSession ¶
func NewWithToken ¶
func NewWithTokenAndClient ¶ added in v0.9.5
func (*Client) AssignUserToProject ¶ added in v0.9.3
func (c *Client) AssignUserToProject(link hubapi.ResourceLink, userAssignmentRequest *hubapi.UserAssignmentRequest) (string, error)
func (*Client) CheckHubLiveness ¶ added in v0.9.8
func (c *Client) CheckHubLiveness() (error, *hubapi.HealthCheckStatus)
func (*Client) CheckHubReadiness ¶ added in v0.9.8
func (c *Client) CheckHubReadiness() (error, *hubapi.HealthCheckStatus)
func (*Client) CountProjectVersionVulnerableComponents ¶
func (c *Client) CountProjectVersionVulnerableComponents(link hubapi.ResourceLink) (int, error)
func (*Client) CreateApiToken ¶ added in v0.9.5
func (*Client) CreateComponent ¶ added in v0.9.5
func (c *Client) CreateComponent(componentRequest *hubapi.ComponentRequest) (string, error)
func (*Client) CreatePolicyRule ¶ added in v0.9.5
func (c *Client) CreatePolicyRule(policyRuleRequest *hubapi.PolicyRuleRequest) (string, error)
func (*Client) CreateProject ¶
func (c *Client) CreateProject(projectRequest *hubapi.ProjectRequest) (string, error)
func (*Client) CreateProjectVersion ¶
func (c *Client) CreateProjectVersion(link hubapi.ResourceLink, projectVersionRequest *hubapi.ProjectVersionRequest) (string, error)
func (*Client) CreateUser ¶ added in v0.9.3
TODO: This API should also be returning a location
func (*Client) CurrentVersion ¶ added in v0.9.1
func (c *Client) CurrentVersion() (*hubapi.CurrentVersion, error)
func (*Client) DeleteApiToken ¶ added in v0.9.5
func (*Client) DeleteCodeLocation ¶ added in v0.9.2
DeleteCodeLocation deletes a code location using https://<base_hub_URL>/api.html#!/composite45code45location45rest45server/deleteCodeLocationUsingDELETE
func (*Client) DeleteComponent ¶ added in v0.9.5
func (*Client) DeletePolicyRule ¶ added in v0.9.5
func (*Client) DeleteProject ¶
func (*Client) DeleteProjectVersion ¶ added in v0.9.2
DeleteProjectVersion deletes a project version using https://<base_hub_URL>/api.html#!/project45version45rest45server/deleteVersionUsingDELETE
func (*Client) DownloadScanClientLinux ¶ added in v0.9.1
func (*Client) DownloadScanClientMac ¶ added in v0.9.1
func (*Client) DownloadScanClientWindows ¶ added in v0.9.1
func (*Client) FetchResults ¶ added in v0.9.8
func (*Client) ForEachPage ¶ added in v0.9.5
func (*Client) GetAuthTokenExpiryTime ¶ added in v0.9.8
GetAuthTokenExpiryTime returns the unix time in seconds at which the cached auth token is set to expire This func returns -1 if the Client is not configured to use auth token
func (*Client) GetCodeLocation ¶
func (c *Client) GetCodeLocation(link hubapi.ResourceLink) (*hubapi.CodeLocation, error)
func (*Client) GetComponent ¶ added in v0.9.5
func (*Client) GetComponentVersion ¶ added in v0.9.5
func (c *Client) GetComponentVersion(link hubapi.ResourceLink) (*hubapi.ComponentVersion, error)
func (*Client) GetComponentVersionRemediation ¶ added in v0.9.5
func (c *Client) GetComponentVersionRemediation(componentVersionHref string) (*hubapi.ComponentRemediation, error)
func (*Client) GetCurrentUser ¶ added in v0.9.5
func (c *Client) GetCurrentUser() (response *hubapi.CurrentUserResponse, err error)
func (*Client) GetExternalExtension ¶
func (c *Client) GetExternalExtension(link hubapi.ResourceLink) (*hubapi.ExternalExtension, error)
func (*Client) GetPage ¶ added in v0.9.5
func (c *Client) GetPage(link string, options *hubapi.GetListOptions, list interface{}) error
func (*Client) GetPolicyRule ¶ added in v0.9.5
func (c *Client) GetPolicyRule(link hubapi.ResourceLink) (*hubapi.PolicyRule, error)
func (*Client) GetProject ¶
func (*Client) GetProjectVersion ¶
func (c *Client) GetProjectVersion(link hubapi.ResourceLink) (*hubapi.ProjectVersion, error)
func (*Client) GetProjectVersionPolicyStatus ¶
func (c *Client) GetProjectVersionPolicyStatus(link hubapi.ResourceLink) (*hubapi.ProjectVersionPolicyStatus, error)
func (*Client) GetProjectVersionRiskProfile ¶
func (c *Client) GetProjectVersionRiskProfile(link hubapi.ResourceLink) (*hubapi.ProjectVersionRiskProfile, error)
func (*Client) GetScanSummary ¶
func (c *Client) GetScanSummary(link hubapi.ResourceLink) (*hubapi.ScanSummary, error)
func (*Client) GetUpgradeGuidanceForComponent ¶ added in v0.9.8
func (c *Client) GetUpgradeGuidanceForComponent(componentVariant hubapi.ComponentVariant) (*hubapi.ComponentUpgradeGuidance, error)
func (*Client) GetUpgradeGuidanceForComponentVersion ¶ added in v0.9.8
func (c *Client) GetUpgradeGuidanceForComponentVersion(componentVersion *hubapi.ComponentVersion) (*hubapi.ComponentUpgradeGuidance, error)
func (*Client) GetVulnerability ¶ added in v0.9.5
func (c *Client) GetVulnerability(link hubapi.ResourceLink) (*hubapi.Vulnerability, error)
func (*Client) HttpDelete ¶ added in v0.9.3
func (*Client) HttpGetJSON ¶ added in v0.9.3
func (*Client) HttpGetString ¶ added in v0.9.7
func (*Client) HttpPostFile ¶ added in v0.9.8
func (*Client) HttpPostJSON ¶ added in v0.9.3
func (*Client) HttpPostJSONExpectResult ¶ added in v0.9.3
func (*Client) HttpPostString ¶ added in v0.9.7
func (*Client) HttpPutJSON ¶ added in v0.9.3
func (*Client) HttpPutString ¶ added in v0.9.7
func (*Client) HttpPutStringWithHeader ¶ added in v0.9.8
func (*Client) ListAllCodeLocations ¶ added in v0.9.5
func (c *Client) ListAllCodeLocations(options *hubapi.GetListOptions) (*hubapi.CodeLocationList, error)
func (*Client) ListAllComponents ¶ added in v0.9.5
func (c *Client) ListAllComponents(options *hubapi.GetListOptions) (*hubapi.ComponentList, error)
func (*Client) ListAllProjectVersionVulnerableComponents ¶
func (c *Client) ListAllProjectVersionVulnerableComponents(link hubapi.ResourceLink) ([]hubapi.BomVulnerableComponent, error)
func (*Client) ListApiTokens ¶ added in v0.9.5
func (c *Client) ListApiTokens(options *hubapi.GetListOptions) (*hubapi.ApiTokenList, error)
func (*Client) ListCodeLocations ¶
func (c *Client) ListCodeLocations(link hubapi.ResourceLink, options *hubapi.GetListOptions) (*hubapi.CodeLocationList, error)
func (*Client) ListComponents ¶ added in v0.9.5
func (c *Client) ListComponents(options *hubapi.GetListOptions) (*hubapi.ComponentList, error)
func (*Client) ListPolicyRules ¶ added in v0.9.5
func (c *Client) ListPolicyRules(options *hubapi.GetListOptions) (*hubapi.PolicyRuleList, error)
func (*Client) ListProjectVersionComponents ¶
func (c *Client) ListProjectVersionComponents(link hubapi.ResourceLink) (*hubapi.BomComponentList, error)
func (*Client) ListProjectVersionVulnerableComponents ¶
func (c *Client) ListProjectVersionVulnerableComponents(link hubapi.ResourceLink) (*hubapi.BomVulnerableComponentList, error)
TODO: Should this be used?
func (*Client) ListProjectVersions ¶
func (c *Client) ListProjectVersions(link hubapi.ResourceLink, options *hubapi.GetListOptions) (*hubapi.ProjectVersionList, error)
func (*Client) ListProjects ¶
func (c *Client) ListProjects(options *hubapi.GetListOptions) (*hubapi.ProjectList, error)
What about continuation for these? Should we have something where user can pass in an optional continuation/next placeholder? Or maybe that is something more for RX? Or maybe a special return type that can keep querying for all of them when it runs out? Is there any iterator type in GoLang?
func (*Client) ListScanSummaries ¶
func (c *Client) ListScanSummaries(link hubapi.ResourceLink) (*hubapi.ScanSummaryList, error)
func (*Client) PollRapidScanResults ¶ added in v0.9.7
func (*Client) SetBearerToken ¶ added in v0.9.9
func (*Client) SetTimeout ¶ added in v0.9.5
func (*Client) SetUserAgent ¶ added in v0.9.8
Sets the User-Agent header value to be used in all http/https requests made by the client
func (*Client) StartRapidScan ¶ added in v0.9.7
func (*Client) UpdateExternalExtension ¶
func (c *Client) UpdateExternalExtension(extension *hubapi.ExternalExtension) error
func (*Client) UploadBdioFiles ¶ added in v0.9.7
func (*Client) UploadBdioFilesByChunk ¶ added in v0.9.11
func (c *Client) UploadBdioFilesByChunk(bdioUploadEndpoint string, chunkCount int, iterator ChunkIterator) error
type HubClientDebug ¶
type HubClientDebug uint16
const ( HubClientDebugTimings HubClientDebug = 1 << iota HubClientDebugContent )
type HubClientError ¶ added in v0.9.5
type HubClientError struct { Err error StatusCode int HubError HubResponseError }
func (HubClientError) Cause ¶ added in v0.9.7
func (e HubClientError) Cause() error
func (HubClientError) Error ¶ added in v0.9.5
func (e HubClientError) Error() string
type HubResponseError ¶ added in v0.9.5
type HubResponseError struct { ErrorMessage string `json:"errorMessage"` Arguments HubResponseErrorArgument `json:"arguments"` Errors []HubResponseError `json:"errors"` ErrorCode string `json:"errorCode"` }
Source Files ¶
- apitoken-client.go
- array-chunk-iterator.go
- bom-client.go
- client.go
- codelocations-client.go
- component-client.go
- constants.go
- currentuser-client.go
- currentversion-client.go
- debug.go
- errors.go
- extconfig-detecturi-client.go
- extensions-client.go
- health-check-client.go
- login-client.go
- policyrules-client.go
- projects-client.go
- rapid-scans-client.go
- scanclient-client.go
- ssostatus-client.go
- users-client.go
- vulnerability-client.go