Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- func FromId(id bson.ObjectId) string
- func IsConflicted(err error) bool
- func IsNotFound(err error) bool
- func Stringify(message interface{}) string
- func ToId(id string) bson.ObjectId
- type AgentsListOpts
- type AgentsService
- func (s *AgentsService) Create(ctx context.Context, src *agent.Agent) (*agent.Agent, error)
- func (s *AgentsService) Get(ctx context.Context, id string) (*agent.Agent, error)
- func (s *AgentsService) GetJobs(ctx context.Context, src *agent.Agent) ([]*agent.Job, error)
- func (s *AgentsService) List(ctx context.Context, opt *AgentsListOpts) (*agent.AgentList, error)
- func (s *AgentsService) String() string
- func (s *AgentsService) Update(ctx context.Context, src *agent.Agent) (*agent.Agent, error)
- type Client
- func (c *Client) Create(ctx context.Context, url string, send interface{}, payload interface{}) error
- func (c *Client) Delete(ctx context.Context, url string, id string) error
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, url string, id string, payload interface{}) error
- func (c *Client) List(ctx context.Context, url string, opts interface{}, payload interface{}) error
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) SetBaseUrl(u string) error
- func (c *Client) Update(ctx context.Context, url string, id string, send interface{}, ...) error
- func (c *Client) Upload(ctx context.Context, urlStr string, files []*UploadedFile, payload interface{}) error
- type ErrorResponse
- type FilesListOpts
- type FilesService
- type PlansListOpts
- type PlansService
- func (s *PlansService) Create(ctx context.Context, src *plan.Plan) (*plan.Plan, error)
- func (s *PlansService) Get(ctx context.Context, id string) (*plan.Plan, error)
- func (s *PlansService) List(ctx context.Context, opt *PlansListOpts) (*plan.PlanList, error)
- func (s *PlansService) String() string
- func (s *PlansService) Update(ctx context.Context, src *plan.Plan) (*plan.Plan, error)
- type PluginsListOpts
- type PluginsService
- func (s *PluginsService) Create(ctx context.Context, src *plugin.Plugin) (*plugin.Plugin, error)
- func (s *PluginsService) Get(ctx context.Context, id string) (*plugin.Plugin, error)
- func (s *PluginsService) List(ctx context.Context, opt *PluginsListOpts) (*plugin.PluginList, error)
- func (s *PluginsService) String() string
- func (s *PluginsService) Update(ctx context.Context, src *plugin.Plugin) (*plugin.Plugin, error)
- type ScansListOpts
- type ScansService
- func (s *ScansService) Get(ctx context.Context, id string) (*scan.Scan, error)
- func (s *ScansService) List(ctx context.Context, opt *ScansListOpts) (*scan.ScanList, error)
- func (s *ScansService) SessionAddChild(ctx context.Context, child *scan.Session) (*scan.Session, error)
- func (s *ScansService) SessionGet(ctx context.Context, scanId, sessionId string) (*scan.Session, error)
- func (s *ScansService) SessionReportCreate(ctx context.Context, src *scan.Session, rep *report.Report) (*report.Report, error)
- func (s *ScansService) SessionReportGet(ctx context.Context, sc *scan.Session) (*report.Report, error)
- func (s *ScansService) SessionUpdate(ctx context.Context, src *scan.Session) (*scan.Session, error)
- func (s *ScansService) String() string
- func (s *ScansService) Update(ctx context.Context, src *scan.Scan) (*scan.Scan, error)
- type ServiceError
- type Timestamp
- type TokensListOpts
- type TokensService
- func (s *TokensService) Create(ctx context.Context, src *token.Token) (*token.Token, error)
- func (s *TokensService) Delete(ctx context.Context, id string) error
- func (s *TokensService) Get(ctx context.Context, id string) (*token.Token, error)
- func (s *TokensService) List(ctx context.Context, opt *TokensListOpts) (*token.TokenList, error)
- func (s *TokensService) String() string
- func (s *TokensService) Update(ctx context.Context, src *token.Token) (*token.Token, error)
- type UploadedFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func IsConflicted ¶
return true if http status code is 409 (Status conflict)
func IsNotFound ¶
return true if http status code is 404 (Status not found)
Types ¶
type AgentsListOpts ¶
type AgentsService ¶
type AgentsService struct {
// contains filtered or unexported fields
}
func (*AgentsService) List ¶
func (s *AgentsService) List(ctx context.Context, opt *AgentsListOpts) (*agent.AgentList, error)
List agents.
func (*AgentsService) String ¶
func (s *AgentsService) String() string
type Client ¶
type Client struct { // Base URL for API requests. BaseURL should // always be specified with a trailing slash. BaseURL *url.URL // User agent used when communicating with the Bearded API. UserAgent string // Token sent in header to authenticate Token string // Show different debug information Debug bool // Services used for talking to different parts of the Bearded API. Plugins *PluginsService Plans *PlansService Agents *AgentsService Scans *ScansService Files *FilesService Tokens *TokensService // contains filtered or unexported fields }
A Client manages communication with the Bearded API.
func NewClient ¶
NewClient returns a new Bearded API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the goauth2 library).
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
func (*Client) SetBaseUrl ¶
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response ServiceError *ServiceError }
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type FilesListOpts ¶
type FilesListOpts struct {
Name string `url:"name"`
}
type FilesService ¶
type FilesService struct {
// contains filtered or unexported fields
}
func (*FilesService) String ¶
func (s *FilesService) String() string
type PlansListOpts ¶
type PlansListOpts struct {
Name string `url:"name"`
}
type PlansService ¶
type PlansService struct {
// contains filtered or unexported fields
}
func (*PlansService) List ¶
func (s *PlansService) List(ctx context.Context, opt *PlansListOpts) (*plan.PlanList, error)
List plans.
func (*PlansService) String ¶
func (s *PlansService) String() string
type PluginsListOpts ¶
type PluginsService ¶
type PluginsService struct {
// contains filtered or unexported fields
}
func (*PluginsService) List ¶
func (s *PluginsService) List(ctx context.Context, opt *PluginsListOpts) (*plugin.PluginList, error)
List plugins.
func (*PluginsService) String ¶
func (s *PluginsService) String() string
type ScansListOpts ¶
type ScansListOpts struct {
Name string `url:"name"`
}
type ScansService ¶
type ScansService struct {
// contains filtered or unexported fields
}
func (*ScansService) List ¶
func (s *ScansService) List(ctx context.Context, opt *ScansListOpts) (*scan.ScanList, error)
List scans.
func (*ScansService) SessionAddChild ¶
func (*ScansService) SessionGet ¶
func (*ScansService) SessionReportCreate ¶
func (*ScansService) SessionReportGet ¶
func (*ScansService) SessionUpdate ¶
func (*ScansService) String ¶
func (s *ScansService) String() string
type ServiceError ¶
ServiceError is a transport object to pass information about a non-Http error occurred in a WebService while processing a request.
func NewError ¶
func NewError(code int, message string) ServiceError
NewError returns a ServiceError using the code and reason
func (ServiceError) Error ¶
func (s ServiceError) Error() string
Error returns a text representation of the service error
type Timestamp ¶
Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. This is necessary for some fields since the GitHub API is inconsistent in how it represents times. All exported methods of time.Time can be called on Timestamp.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.
type TokensListOpts ¶
type TokensService ¶
type TokensService struct {
// contains filtered or unexported fields
}
func (*TokensService) List ¶
func (s *TokensService) List(ctx context.Context, opt *TokensListOpts) (*token.TokenList, error)
List tokens.
func (*TokensService) String ¶
func (s *TokensService) String() string