Documentation
¶
Index ¶
- Variables
- func CheckResponse(r *http.Response) error
- type APIKeyTransport
- type AddOpts
- type AlertsDeleteOpts
- type AlertsListOpts
- type AlertsService
- func (s *AlertsService) Add(ctx context.Context, alerts models.AddAlertsRequest) (*models.AddAlertsResponse, *Response, error)
- func (s *AlertsService) Delete(ctx context.Context, opts AlertsDeleteOpts) (*models.DeleteAlertsResponse, *Response, error)
- func (s *AlertsService) DeleteOne(ctx context.Context, alertID string) (*models.DeleteAlertsResponse, *Response, error)
- func (s *AlertsService) GetByID(ctx context.Context, alertID int) (*models.Alert, *Response, error)
- func (s *AlertsService) List(ctx context.Context, opts AlertsListOpts) (*models.GetAlertsResponse, *Response, error)
- type ApiClient
- type AuthService
- func (s *AuthService) AuthenticateWatcher(ctx context.Context, auth models.WatcherAuthRequest) (models.WatcherAuthResponse, *Response, error)
- func (s *AuthService) EnrollWatcher(ctx context.Context, enrollKey string, name string, tags []string, ...) (*Response, error)
- func (s *AuthService) RegisterWatcher(ctx context.Context, registration models.WatcherRegistrationRequest) (*Response, error)
- func (s *AuthService) UnregisterWatcher(ctx context.Context) (*Response, error)
- type Config
- type DecisionDeleteService
- type DecisionsDeleteOpts
- type DecisionsListOpts
- type DecisionsService
- func (s *DecisionsService) Delete(ctx context.Context, opts DecisionsDeleteOpts) (*models.DeleteDecisionResponse, *Response, error)
- func (s *DecisionsService) DeleteOne(ctx context.Context, decisionID string) (*models.DeleteDecisionResponse, *Response, error)
- func (s *DecisionsService) FetchV2Decisions(ctx context.Context, url string) (*models.DecisionsStreamResponse, *Response, error)
- func (s *DecisionsService) FetchV3Decisions(ctx context.Context, url string) (*models.DecisionsStreamResponse, *Response, error)
- func (s *DecisionsService) GetDecisionsFromBlocklist(ctx context.Context, blocklist *modelscapi.BlocklistLink, ...) ([]*models.Decision, bool, error)
- func (s *DecisionsService) GetDecisionsFromGroups(decisionsGroups []*modelscapi.GetDecisionsStreamResponseNewItem) []*models.Decision
- func (s *DecisionsService) GetStream(ctx context.Context, opts DecisionsStreamOpts) (*models.DecisionsStreamResponse, *Response, error)
- func (s *DecisionsService) GetStreamV3(ctx context.Context, opts DecisionsStreamOpts) (*modelscapi.GetDecisionsStreamResponse, *Response, error)
- func (s *DecisionsService) List(ctx context.Context, opts DecisionsListOpts) (*models.GetDecisionsResponse, *Response, error)
- func (s *DecisionsService) StopStream(ctx context.Context) (*Response, error)
- type DecisionsStreamOpts
- type DeleteOpts
- type ErrorResponse
- type HeartBeatService
- type JWTTransport
- type ListOpts
- type MetricsService
- type Response
- type RetryConfig
- type RetryConfigOption
- type SignalService
- type StatusCodeConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( InsecureSkipVerify = false Cert *tls.Certificate CaCertPool *x509.CertPool )
Functions ¶
func CheckResponse ¶
CheckResponse verifies the API response and builds an appropriate Go error if necessary.
Types ¶
type APIKeyTransport ¶
type APIKeyTransport struct {
APIKey string
// Transport is the underlying HTTP transport to use when making requests.
// It will default to http.DefaultTransport if nil.
Transport http.RoundTripper
URL *url.URL
VersionPrefix string
UserAgent string
}
func (*APIKeyTransport) Client ¶
func (t *APIKeyTransport) Client() *http.Client
type AlertsDeleteOpts ¶
type AlertsDeleteOpts struct {
ScopeEquals *string `url:"scope,omitempty"`
ValueEquals *string `url:"value,omitempty"`
ScenarioEquals *string `url:"scenario,omitempty"`
IPEquals *string `url:"ip,omitempty"`
RangeEquals *string `url:"range,omitempty"`
Since *string `url:"since,omitempty"`
Until *string `url:"until,omitempty"`
OriginEquals *string `url:"origin,omitempty"`
ActiveDecisionEquals *bool `url:"has_active_decision,omitempty"`
SourceEquals *string `url:"alert_source,omitempty"`
Contains *bool `url:"contains,omitempty"`
Limit *int `url:"limit,omitempty"`
ListOpts
}
type AlertsListOpts ¶
type AlertsListOpts struct {
ScopeEquals *string `url:"scope,omitempty"`
ValueEquals *string `url:"value,omitempty"`
ScenarioEquals *string `url:"scenario,omitempty"`
IPEquals *string `url:"ip,omitempty"`
RangeEquals *string `url:"range,omitempty"`
OriginEquals *string `url:"origin,omitempty"`
Since *string `url:"since,omitempty"`
TypeEquals *string `url:"decision_type,omitempty"`
Until *string `url:"until,omitempty"`
IncludeSimulated *bool `url:"simulated,omitempty"`
ActiveDecisionEquals *bool `url:"has_active_decision,omitempty"`
IncludeCAPI *bool `url:"include_capi,omitempty"`
Limit *int `url:"limit,omitempty"`
Contains *bool `url:"contains,omitempty"`
ListOpts
}
type AlertsService ¶
type AlertsService service
func (*AlertsService) Add ¶
func (s *AlertsService) Add(ctx context.Context, alerts models.AddAlertsRequest) (*models.AddAlertsResponse, *Response, error)
func (*AlertsService) Delete ¶
func (s *AlertsService) Delete(ctx context.Context, opts AlertsDeleteOpts) (*models.DeleteAlertsResponse, *Response, error)
to demo query arguments
func (*AlertsService) DeleteOne ¶ added in v1.4.2
func (s *AlertsService) DeleteOne(ctx context.Context, alertID string) (*models.DeleteAlertsResponse, *Response, error)
func (*AlertsService) List ¶
func (s *AlertsService) List(ctx context.Context, opts AlertsListOpts) (*models.GetAlertsResponse, *Response, error)
to demo query arguments
type ApiClient ¶
type ApiClient struct {
/*config stuff*/
BaseURL *url.URL
PapiURL *url.URL
URLPrefix string
UserAgent string
/*exposed Services*/
Decisions *DecisionsService
DecisionDelete *DecisionDeleteService
Alerts *AlertsService
Auth *AuthService
Metrics *MetricsService
Signal *SignalService
HeartBeat *HeartBeatService
// contains filtered or unexported fields
}
func NewDefaultClient ¶
func (*ApiClient) IsEnrolled ¶ added in v1.6.0
type AuthService ¶
type AuthService service
func (*AuthService) AuthenticateWatcher ¶
func (s *AuthService) AuthenticateWatcher(ctx context.Context, auth models.WatcherAuthRequest) (models.WatcherAuthResponse, *Response, error)
func (*AuthService) EnrollWatcher ¶ added in v1.1.0
func (*AuthService) RegisterWatcher ¶
func (s *AuthService) RegisterWatcher(ctx context.Context, registration models.WatcherRegistrationRequest) (*Response, error)
func (*AuthService) UnregisterWatcher ¶
func (s *AuthService) UnregisterWatcher(ctx context.Context) (*Response, error)
type DecisionDeleteService ¶ added in v1.5.0
type DecisionDeleteService service
func (*DecisionDeleteService) Add ¶ added in v1.5.0
func (d *DecisionDeleteService) Add(ctx context.Context, deletedDecisions *models.DecisionsDeleteRequest) (interface{}, *Response, error)
DecisionDeleteService purposely reuses AddSignalsRequestItemDecisions model
type DecisionsDeleteOpts ¶
type DecisionsDeleteOpts struct {
ScopeEquals *string `url:"scope,omitempty"`
ValueEquals *string `url:"value,omitempty"`
TypeEquals *string `url:"type,omitempty"`
IPEquals *string `url:"ip,omitempty"`
RangeEquals *string `url:"range,omitempty"`
Contains *bool `url:"contains,omitempty"`
OriginEquals *string `url:"origin,omitempty"`
//
ScenarioEquals *string `url:"scenario,omitempty"`
ListOpts
}
type DecisionsListOpts ¶
type DecisionsService ¶
type DecisionsService service
func (*DecisionsService) Delete ¶
func (s *DecisionsService) Delete(ctx context.Context, opts DecisionsDeleteOpts) (*models.DeleteDecisionResponse, *Response, error)
func (*DecisionsService) DeleteOne ¶
func (s *DecisionsService) DeleteOne(ctx context.Context, decisionID string) (*models.DeleteDecisionResponse, *Response, error)
func (*DecisionsService) FetchV2Decisions ¶ added in v1.5.0
func (s *DecisionsService) FetchV2Decisions(ctx context.Context, url string) (*models.DecisionsStreamResponse, *Response, error)
func (*DecisionsService) FetchV3Decisions ¶ added in v1.5.0
func (s *DecisionsService) FetchV3Decisions(ctx context.Context, url string) (*models.DecisionsStreamResponse, *Response, error)
func (*DecisionsService) GetDecisionsFromBlocklist ¶ added in v1.5.0
func (s *DecisionsService) GetDecisionsFromBlocklist(ctx context.Context, blocklist *modelscapi.BlocklistLink, lastPullTimestamp *string) ([]*models.Decision, bool, error)
func (*DecisionsService) GetDecisionsFromGroups ¶ added in v1.5.0
func (s *DecisionsService) GetDecisionsFromGroups(decisionsGroups []*modelscapi.GetDecisionsStreamResponseNewItem) []*models.Decision
func (*DecisionsService) GetStream ¶
func (s *DecisionsService) GetStream(ctx context.Context, opts DecisionsStreamOpts) (*models.DecisionsStreamResponse, *Response, error)
func (*DecisionsService) GetStreamV3 ¶ added in v1.5.0
func (s *DecisionsService) GetStreamV3(ctx context.Context, opts DecisionsStreamOpts) (*modelscapi.GetDecisionsStreamResponse, *Response, error)
func (*DecisionsService) List ¶
func (s *DecisionsService) List(ctx context.Context, opts DecisionsListOpts) (*models.GetDecisionsResponse, *Response, error)
to demo query arguments
func (*DecisionsService) StopStream ¶
func (s *DecisionsService) StopStream(ctx context.Context) (*Response, error)
type DecisionsStreamOpts ¶ added in v1.3.3
type DeleteOpts ¶
type DeleteOpts struct {
}
type ErrorResponse ¶
type ErrorResponse struct {
models.ErrorResponse
}
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type HeartBeatService ¶ added in v1.4.0
type HeartBeatService service
func (*HeartBeatService) StartHeartBeat ¶ added in v1.4.0
func (h *HeartBeatService) StartHeartBeat(ctx context.Context, t *tomb.Tomb)
type JWTTransport ¶
type JWTTransport struct {
MachineID *string
Password *strfmt.Password
Token string
Expiration time.Time
Scenarios []string
URL *url.URL
VersionPrefix string
UserAgent string
RetryConfig *RetryConfig
// Transport is the underlying HTTP transport to use when making requests.
// It will default to http.DefaultTransport if nil.
Transport http.RoundTripper
UpdateScenario func() ([]string, error)
// contains filtered or unexported fields
}
func (*JWTTransport) Client ¶
func (t *JWTTransport) Client() *http.Client
func (*JWTTransport) ResetToken ¶ added in v1.5.0
func (t *JWTTransport) ResetToken()
type MetricsService ¶
type MetricsService service
type RetryConfig ¶ added in v1.6.2
type RetryConfig struct {
StatusCodeConfig map[int]StatusCodeConfig
}
func NewRetryConfig ¶ added in v1.6.2
func NewRetryConfig(options ...RetryConfigOption) *RetryConfig
type RetryConfigOption ¶ added in v1.6.2
type RetryConfigOption func(*RetryConfig)
func WithStatusCodeConfig ¶ added in v1.6.2
func WithStatusCodeConfig(statusCode int, maxAttempts int, backOff bool, invalidateToken bool) RetryConfigOption
type SignalService ¶
type SignalService service
func (*SignalService) Add ¶
func (s *SignalService) Add(ctx context.Context, signals *models.AddSignalsRequest) (interface{}, *Response, error)
type StatusCodeConfig ¶ added in v1.6.2
Click to show internal directories.
Click to hide internal directories.