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 TraceHubClientError(old error) error
- type BearerTokenResponse
- 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) 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) DownloadScanClientLinux(path string) error
- func (c *Client) DownloadScanClientMac(path string) error
- func (c *Client) DownloadScanClientWindows(path string) error
- func (c *Client) ForEachPage(link string, listOptions *hubapi.GetListOptions, list interface{}, ...) (err error)
- 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) 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) 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) HttpPutJSON(url string, data interface{}, 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) SetTimeout(timeout time.Duration)
- func (c *Client) UpdateExternalExtension(extension *hubapi.ExternalExtension) error
- type HubClientDebug
- type HubClientError
- type HubResponseError
- type HubResponseErrorArgument
Constants ¶
const ( HeaderNameContentType = "Content-Type" HeaderNameAccept = "Accept" HeaderNameAuthorization = "Authorization" HeaderNameCsrfToken = "X-Csrf-Token" )
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 TraceHubClientError ¶ added in v0.9.5
Types ¶
type BearerTokenResponse ¶ added in v0.9.5
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) 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) ForEachPage ¶ added in v0.9.5
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) 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) HttpPostJSON ¶ added in v0.9.3
func (*Client) HttpPostJSONExpectResult ¶ added in v0.9.3
func (*Client) HttpPutJSON ¶ added in v0.9.3
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) SetTimeout ¶ added in v0.9.5
func (*Client) UpdateExternalExtension ¶
func (c *Client) UpdateExternalExtension(extension *hubapi.ExternalExtension) 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) 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
- bom-client.go
- client.go
- codelocations-client.go
- component-client.go
- constants.go
- currentuser-client.go
- currentversion-client.go
- debug.go
- errors.go
- extensions-client.go
- login-client.go
- policyrules-client.go
- projects-client.go
- scanclient-client.go
- users-client.go
- vulnerability-client.go