Documentation ¶
Index ¶
- type Client
- func (client *Client) Download(url string, fileName string, options *RequestOptions) error
- func (client *Client) DownloadDiags(clusterID string, fileName string) error
- func (client *Client) DownloadMany(urlTemplate string, fileNames []string, options *RequestOptions) error
- func (client *Client) DownloadManyDiags(clusterID string, fileNames []string) error
- func (client *Client) Get(url string, result interface{}, options *RequestOptions) error
- func (client *Client) GetAPIEntity(resource string, id interface{}, result interface{}) error
- func (client *Client) GetAnalytics(clusterID string) ([]byte, 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 string, 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 interface{}, 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) SendRequest(method string, url string, result interface{}, 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 interface{}) (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 { BaseURL string DefaultPrefix string HTTPClient *http.Client // 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) Download ¶
func (client *Client) Download(url string, fileName string, options *RequestOptions) error
TODO check if mage sense to use SendRequest
func (*Client) DownloadDiags ¶
func (*Client) DownloadMany ¶
func (client *Client) DownloadMany(urlTemplate string, fileNames []string, options *RequestOptions) error
func (*Client) DownloadManyDiags ¶
func (*Client) Get ¶
func (client *Client) Get(url string, result interface{}, 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) GetCluster ¶
GetCluster returns a single cluster
func (*Client) GetClusterCustomer ¶
func (*Client) GetCustomer ¶
GetCustomer returns a single customer
func (*Client) GetDBStatus ¶
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)
GetCluster returns a single cluster
func (*Client) GetUsageReport ¶
func (*Client) Post ¶
func (client *Client) Post(url string, result interface{}, 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) SendRequest ¶
func (client *Client) SendRequest(method string, url string, result interface{}, options *RequestOptions) error
type Cluster ¶
type Cluster struct { ID string `json:"id"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` CustomerID string `json:"customer_id"` EventStore int `json:"event_store"` LastEvent time.Time `json:"last_event"` LastSeen time.Time `json:"last_seen"` LicenseDeletedAt time.Time `json:"license_deleted_at"` LicenseSyncTime time.Time `json:"license_sync_time"` Muted bool `json:"muted"` MuteTime time.Time `json:"mute_time"` PublicKey string `json:"public_key"` SkipLicenseCheck bool `json:"skip_license_check"` SoftwareRelease string `json:"software_release"` UpdatedAt time.Time `json:"updated_at"` Version string `json:"version"` }
Cluster API structure
type Customer ¶
type Customer struct { ID string `json:"id"` Name string `json:"name"` ImageURL string `json:"image_url"` Monitored bool `json:"monitored"` GetWekaIoLastScrub time.Time `json:"get_weka_io_last_scrub"` UpdatedAt time.Time `json:"updated_at"` }
Customer API structure
type Diag ¶
type Diag struct { ID int `json:"id"` FileName string `json:"filename"` ClusterID string `json:"cluster_id"` HostName string `json:"hostname"` S3Key string `json:"s3_key"` Completed bool `json:"completed"` Topic string `json:"topic"` TopicId string `json:"topic_id"` UploadTime time.Time `json:"upload_time"` }
Cluster API structure
type Event ¶
type Event struct { ID string `json:"id"` CloudID string `json:"cloud_id"` ClusterID string `json:"cluster_id"` EventType string `json:"type"` Category string `json:"category"` IsBackend bool `json:"is_backend"` Entity string `json:"entity"` Params json.RawMessage `json:"params"` // map[string]interface{} NodeID string `json:"nid"` Permission string `json:"permission"` Severity string `json:"severity"` Time time.Time `json:"timestamp"` IngestTime time.Time `json:"cloud_digested_ts"` OrganizationID int64 `json:"org_id"` Processed bool `json:"processed"` }
Cluster API structure
func (*Event) ComputeProcessingTime ¶
type EventQueryOptions ¶
type EventQueryOptions struct { WithInternalEvents bool SortByIngestTime bool IncludeTypes []string ExcludeTypes []string NodeIDs []int MinSeverity string StartTime time.Time EndTime time.Time Limit int Wide bool }
func (*EventQueryOptions) ToQueryParams ¶
func (options *EventQueryOptions) ToQueryParams() (*QueryParams, error)
type Integration ¶
type Integration struct { ID int `json:"id"` Name string `json:"name"` Configuration struct { Type string `json:"type"` Rule IntegrationRule `json:"rule"` Destinations []string `json:"destinations"` } `json:"configuration"` }
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 URL string Options *RequestOptions Page int PageResults queryResultsEnvelope 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 interface{}) (ok bool, err error)
func (*PagedQuery) NextEvent ¶
func (query *PagedQuery) NextEvent() (*Event, error)
func (*PagedQuery) NextIntegration ¶
func (query *PagedQuery) NextIntegration() (*Integration, error)
type QueryParams ¶
type QueryParams struct { Names []string Values []interface{} }
func GetActiveClustersParams ¶
func GetActiveClustersParams() *QueryParams
func GetDiagsParams ¶
func GetDiagsParams(topic string, topicId string) *QueryParams
func (*QueryParams) Append ¶
func (params *QueryParams) Append(name string, value interface{}) *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 interface{}) *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 RequestOptions struct { Prefix string Params *QueryParams Body interface{} NoMetadata bool NoAutoFetchNextPage bool PageSize int }