apiclient

package
v0.0.0-...-236fc01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InsecureSkipVerify = false
)

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

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

func (*APIKeyTransport) RoundTrip

func (t *APIKeyTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type AddOpts

type AddOpts struct {
}

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"`
	ActiveDecisionEquals *bool   `url:"has_active_decision,omitempty"`
	SourceEquals         *string `url:"alert_source,omitempty"`
	Contains             *bool   `url:"contains,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"`
	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"`
	Limit                *int    `url:"limit,omitempty"`
	Contains             *bool   `url:"contains,omitempty"`
	ListOpts
}

type AlertsService

type AlertsService service

func (*AlertsService) Add

func (*AlertsService) Delete

to demo query arguments

func (*AlertsService) GetByID

func (s *AlertsService) GetByID(ctx context.Context, alertID int) (*models.Alert, *Response, error)

func (*AlertsService) List

to demo query arguments

type ApiClient

type ApiClient struct {

	/*config stuff*/
	BaseURL   *url.URL
	URLPrefix string
	UserAgent string
	/*exposed Services*/
	Decisions *DecisionsService
	Alerts    *AlertsService
	Auth      *AuthService
	Metrics   *MetricsService
	Signal    *SignalService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config) (*ApiClient, error)

func NewDefaultClient

func NewDefaultClient(URL *url.URL, prefix string, userAgent string, client *http.Client) (*ApiClient, error)

func RegisterClient

func RegisterClient(config *Config, client *http.Client) (*ApiClient, error)

func (*ApiClient) Do

func (c *ApiClient) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

func (*ApiClient) NewRequest

func (c *ApiClient) NewRequest(method, url string, body interface{}) (*http.Request, error)

type AuthService

type AuthService service

func (*AuthService) AuthenticateWatcher

func (s *AuthService) AuthenticateWatcher(ctx context.Context, auth models.WatcherAuthRequest) (*Response, error)

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 Config

type Config struct {
	MachineID      string
	Password       strfmt.Password
	Scenarios      []string
	URL            *url.URL
	VersionPrefix  string
	UserAgent      string
	UpdateScenario func() ([]string, error)
}

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"`
	ListOpts
}

type DecisionsListOpts

type DecisionsListOpts 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"`

	ListOpts
}

type DecisionsService

type DecisionsService service

func (*DecisionsService) Delete

func (*DecisionsService) DeleteOne

func (s *DecisionsService) DeleteOne(ctx context.Context, decision_id string) (*models.DeleteDecisionResponse, *Response, error)

func (*DecisionsService) GetStream

func (*DecisionsService) List

to demo query arguments

func (*DecisionsService) StopStream

func (s *DecisionsService) StopStream(ctx context.Context) (*Response, error)

type DeleteOpts

type DeleteOpts struct {
}

type ErrorResponse

type ErrorResponse struct {
	models.ErrorResponse
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type JWTTransport

type JWTTransport struct {
	MachineID *string
	Password  *strfmt.Password

	Expiration    time.Time
	Scenarios     []string
	URL           *url.URL
	VersionPrefix string
	UserAgent     string
	// 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) RoundTrip

func (t *JWTTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type ListOpts

type ListOpts struct {
}

type MetricsService

type MetricsService service

func (*MetricsService) Add

func (s *MetricsService) Add(ctx context.Context, metrics *models.Metrics) (interface{}, *Response, error)

type Response

type Response struct {
	Response *http.Response
}

type SignalService

type SignalService service

func (*SignalService) Add

func (s *SignalService) Add(ctx context.Context, signals *models.AddSignalsRequest) (interface{}, *Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL