Documentation
¶
Index ¶
- type Client
- func (client *Client) Download(url, fileName string) error
- func (client *Client) DownloadDiags(clusterID, fileName string) error
- func (client *Client) DownloadMany(urlTemplate string, fileNames []string) error
- func (client *Client) DownloadManyDiags(clusterID string, fileNames []string) error
- func (client *Client) Get(url string, result any, options *RequestOptions) error
- func (client *Client) GetAPIEntity(resource string, id, result any) error
- func (client *Client) GetAnalytics(clusterID string) (json.RawMessage, error)
- func (client *Client) GetCluster(id string) (*Cluster, error)
- func (client *Client) GetClusterCustomer(cluster *Cluster) (*Customer, error)
- func (client *Client) GetCustomer(id string) (*Customer, error)
- func (client *Client) GetDBStatus() ([]byte, error)
- func (client *Client) GetEvent(clusterID, eventID string) (*Event, error)
- func (client *Client) GetIntegration(id int) (*Integration, error)
- func (client *Client) GetServerStatus() (*ServerStatus, error)
- func (client *Client) GetUsageReport(clusterID string) ([]byte, error)
- func (client *Client) Post(url string, result any, options *RequestOptions) error
- func (client *Client) QueryClusters(options *RequestOptions) (*PagedQuery, error)
- func (client *Client) QueryCustomers() (*PagedQuery, error)
- func (client *Client) QueryDiags(clusterID string, options *RequestOptions) (*PagedQuery, error)
- func (client *Client) QueryEntities(url string, options *RequestOptions) (*PagedQuery, error)
- func (client *Client) QueryEvents(clusterID string, options *EventQueryOptions) (*PagedQuery, error)
- func (client *Client) QueryIntegrations(options *RequestOptions) (*PagedQuery, error)
- func (client *Client) Read(url string) (io.ReadCloser, error)
- func (client *Client) ReadDiags(clusterID, file string) (io.ReadCloser, error)
- func (client *Client) SendRequest(method, url string, result any, options *RequestOptions) error
- func (client *Client) TestIntegration(id int, eventCode string) error
- type Cluster
- type Customer
- type Diag
- type Event
- type EventQueryOptions
- type Integration
- type IntegrationRule
- type IntegrationTestRequest
- type PagedQuery
- func (query *PagedQuery) FetchNextPage() error
- func (query *PagedQuery) NextCluster() (*Cluster, error)
- func (query *PagedQuery) NextCustomer() (*Customer, error)
- func (query *PagedQuery) NextDiag() (*Diag, error)
- func (query *PagedQuery) NextEntity(result any) (ok bool, err error)
- func (query *PagedQuery) NextEvent() (*Event, error)
- func (query *PagedQuery) NextIntegration() (*Integration, error)
- type QueryParams
- type RequestOptions
- type ServerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
HTTPClient *http.Client
BaseURL string
DefaultPrefix string
// contains filtered or unexported fields
}
Client is an API client for a given service URL
func GetClient ¶
func GetClient() *Client
GetClient returns a new Client instance, instantiated with values from the CLI configuration file
func (*Client) DownloadDiags ¶
func (*Client) DownloadMany ¶
func (*Client) DownloadManyDiags ¶
func (*Client) Get ¶
func (client *Client) Get(url string, result any, options *RequestOptions) error
Get sends a GET request, and does not expect the response to be enveloped
func (*Client) GetAPIEntity ¶
GetAPIEntity is a general implementation for getting a single object from an API resource
func (*Client) GetAnalytics ¶
func (client *Client) GetAnalytics(clusterID string) (json.RawMessage, error)
func (*Client) GetCluster ¶
GetCluster returns a single cluster
func (*Client) GetClusterCustomer ¶
func (*Client) GetCustomer ¶
GetCustomer returns a single customer
func (*Client) GetDBStatus ¶
GetDBStatus returns the status of the database
func (*Client) GetIntegration ¶
func (client *Client) GetIntegration(id int) (*Integration, error)
GetIntegration returns a single integration
func (*Client) GetServerStatus ¶
func (client *Client) GetServerStatus() (*ServerStatus, error)
GetServerStatus returns the status of the server
func (*Client) GetUsageReport ¶
func (*Client) Post ¶
func (client *Client) Post(url string, result any, options *RequestOptions) error
Post sends a POST request, and does not expect the response to be enveloped
func (*Client) QueryClusters ¶
func (client *Client) QueryClusters(options *RequestOptions) (*PagedQuery, error)
func (*Client) QueryCustomers ¶
func (client *Client) QueryCustomers() (*PagedQuery, error)
func (*Client) QueryDiags ¶
func (client *Client) QueryDiags(clusterID string, options *RequestOptions) (*PagedQuery, error)
func (*Client) QueryEntities ¶
func (client *Client) QueryEntities(url string, options *RequestOptions) (*PagedQuery, error)
func (*Client) QueryEvents ¶
func (client *Client) QueryEvents(clusterID string, options *EventQueryOptions) (*PagedQuery, error)
func (*Client) QueryIntegrations ¶
func (client *Client) QueryIntegrations(options *RequestOptions) (*PagedQuery, error)
func (*Client) Read ¶ added in v0.4.17
func (client *Client) Read(url string) (io.ReadCloser, error)
func (*Client) ReadDiags ¶ added in v0.4.17
func (client *Client) ReadDiags(clusterID, file string) (io.ReadCloser, error)
ReadDiags reads the content of a diagnostics file and returns a ReadCloser
func (*Client) SendRequest ¶
func (client *Client) SendRequest(method, url string, result any, options *RequestOptions) error
type Cluster ¶
type Cluster struct {
LicenseDeletedAt time.Time `json:"license_deleted_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
MuteTime time.Time `json:"mute_time"`
LicenseSyncTime time.Time `json:"license_sync_time"`
LastEvent time.Time `json:"last_event"`
LastSeen time.Time `json:"last_seen"`
CustomerID string `json:"customer_id"`
ID string `json:"id"`
Version string `json:"version"`
SoftwareRelease string `json:"software_release"`
PublicKey string `json:"public_key"`
Name string `json:"name"`
EventStore int `json:"event_store"`
SkipLicenseCheck bool `json:"skip_license_check"`
Muted bool `json:"muted"`
}
Cluster API structure
type Customer ¶
type Customer struct {
GetWekaIoLastScrub time.Time `json:"get_weka_io_last_scrub"`
UpdatedAt time.Time `json:"updated_at"`
ID string `json:"id"`
Name string `json:"name"`
ImageURL string `json:"image_url"`
Monitored bool `json:"monitored"`
}
Customer API structure
type Diag ¶
type Diag struct {
UploadTime time.Time `json:"upload_time"`
FileName string `json:"filename"`
ClusterID string `json:"cluster_id"`
HostName string `json:"hostname"`
S3Key string `json:"s3_key"`
Topic string `json:"topic"`
TopicID string `json:"topic_id"`
ID int `json:"id"`
Completed bool `json:"completed"`
}
Cluster API structure
type Event ¶
type Event struct {
Time time.Time `json:"timestamp"`
IngestTime time.Time `json:"cloud_digested_ts"`
Entity string `json:"entity"`
EventType string `json:"type"`
Category string `json:"category"`
ID string `json:"id"`
NodeID string `json:"nid"`
Permission string `json:"permission"`
Severity string `json:"severity"`
ClusterID string `json:"guid"`
CloudID string `json:"cloud_id"`
Params json.RawMessage `json:"params"`
OrganizationID int64 `json:"org_id"`
IsBackend bool `json:"is_backend"`
Processed bool `json:"processed"`
}
Cluster API structure
func (*Event) ComputeProcessingTime ¶
func (Event) MarshalJSON ¶ added in v0.4.24
type EventQueryOptions ¶
type EventQueryOptions struct {
StartTime time.Time
EndTime time.Time
MinSeverity string
IncludeTypes []string
ExcludeTypes []string
NodeIDs []int
Limit int
WithInternalEvents bool
SortByIngestTime bool
Wide bool
}
func (*EventQueryOptions) ToQueryParams ¶
func (options *EventQueryOptions) ToQueryParams() (*QueryParams, error)
type Integration ¶
type Integration struct {
Name string `json:"name"`
Configuration struct {
Type string `json:"type"`
Rule IntegrationRule `json:"rule"`
Destinations []string `json:"destinations"`
} `json:"configuration"`
ID int `json:"id"`
}
type IntegrationRule ¶
type IntegrationRule struct {
RuleType string `json:"rule_type"`
Param json.RawMessage `json:"param"`
}
type IntegrationTestRequest ¶
type IntegrationTestRequest struct {
EventID string `json:"event_id"`
}
type PagedQuery ¶
type PagedQuery struct {
Client *Client
Options *RequestOptions
URL string
PageResults queryResultsEnvelope
Page int
HasMorePages bool
// contains filtered or unexported fields
}
func (*PagedQuery) FetchNextPage ¶
func (query *PagedQuery) FetchNextPage() error
func (*PagedQuery) NextCluster ¶
func (query *PagedQuery) NextCluster() (*Cluster, error)
func (*PagedQuery) NextCustomer ¶
func (query *PagedQuery) NextCustomer() (*Customer, error)
func (*PagedQuery) NextDiag ¶
func (query *PagedQuery) NextDiag() (*Diag, error)
func (*PagedQuery) NextEntity ¶
func (query *PagedQuery) NextEntity(result any) (ok bool, err error)
func (*PagedQuery) NextEvent ¶
func (query *PagedQuery) NextEvent() (*Event, error)
func (*PagedQuery) NextIntegration ¶
func (query *PagedQuery) NextIntegration() (*Integration, error)
type QueryParams ¶
func GetActiveClustersParams ¶
func GetActiveClustersParams() *QueryParams
func GetDiagsParams ¶
func GetDiagsParams(topic, topicID string) *QueryParams
func (*QueryParams) Append ¶
func (params *QueryParams) Append(name string, value any) *QueryParams
Append adds a new parameter, even if one already exists with the same name
func (*QueryParams) Set ¶
func (params *QueryParams) Set(name string, value any) *QueryParams
Set sets a parameter, and overrides its value if it was already set
func (*QueryParams) String ¶
func (params *QueryParams) String() string
String returns all parameters as one string, ready to be appended to the URL
type RequestOptions ¶
type ServerStatus ¶
ServerStatus is the status of the server