Documentation ¶
Index ¶
- Variables
- type ErrorResult
- type HTTPClient
- func (c *HTTPClient) DoWithContext(ctx context.Context, r *http.Request, data interface{}) error
- func (c *HTTPClient) GetHostFacts(ctx context.Context, hostID, page, perPage int64) (HostFactsResponse, error)
- func (c *HTTPClient) GetHostFactsWithConcurrency(hosts []Host) []HostFactsWithConcurrencyResult
- func (c *HTTPClient) GetHostWithConcurrency(pages []int64, perPage int64) []HostWithConcurrencyResult
- func (c *HTTPClient) GetHosts(ctx context.Context, thin string, page, perPage int64) (HostResponse, error)
- func (c *HTTPClient) GetHostsFactsFiltered(perPage int64) (map[string]map[string]string, error)
- func (c *HTTPClient) GetHostsFiltered(perPage int64) ([]Host, error)
- func (c *HTTPClient) OnRequestCompleted(rc RequestCompletionCallback)
- func (c *HTTPClient) SetHostsFactsRegistry(reg prometheus.Registerer)
- func (c *HTTPClient) SetHostsRegistry(reg prometheus.Registerer)
- type Host
- type HostFactsResponse
- type HostFactsWithConcurrencyResult
- type HostResponse
- type HostWithConcurrencyResult
- type LeveledLogrus
- type RequestCompletionCallback
Constants ¶
This section is empty.
Variables ¶
var (
UserAgent = fmt.Sprintf("foreman_exporter/%s", version.Version)
)
Functions ¶
This section is empty.
Types ¶
type ErrorResult ¶ added in v0.0.6
type HTTPClient ¶
type HTTPClient struct { BaseURL *url.URL Username string Password string Concurrency int64 Limit int64 Search string SearchHostFact string IncludeHostFactRegex *regexp.Regexp ExcludeHostFactRegex *regexp.Regexp Log *logrus.Logger // contains filtered or unexported fields }
func NewHTTPClient ¶
func (*HTTPClient) DoWithContext ¶
DoWithContext sends an API Request and returns back the response. The API response is checked to see if it was a successful call. A successful call is then checked to see if we need to unmarshal since some resources have their own implements of unmarshal.
func (*HTTPClient) GetHostFacts ¶
func (c *HTTPClient) GetHostFacts(ctx context.Context, hostID, page, perPage int64) (HostFactsResponse, error)
func (*HTTPClient) GetHostFactsWithConcurrency ¶
func (c *HTTPClient) GetHostFactsWithConcurrency(hosts []Host) []HostFactsWithConcurrencyResult
GetHostFactsWithConcurrency sends requests in parallel but only up to a certain limit, and furthermore it's only parallel up to the amount of CPUs but is always concurrent up to the concurrency limit
func (*HTTPClient) GetHostWithConcurrency ¶
func (c *HTTPClient) GetHostWithConcurrency(pages []int64, perPage int64) []HostWithConcurrencyResult
GetHostWithConcurrency sends requests in parallel but only up to a certain limit, and furthermore it's only parallel up to the amount of CPUs but is always concurrent up to the concurrency limit
func (*HTTPClient) GetHosts ¶
func (c *HTTPClient) GetHosts(ctx context.Context, thin string, page, perPage int64) (HostResponse, error)
func (*HTTPClient) GetHostsFactsFiltered ¶
func (*HTTPClient) GetHostsFiltered ¶
func (c *HTTPClient) GetHostsFiltered(perPage int64) ([]Host, error)
func (*HTTPClient) OnRequestCompleted ¶
func (c *HTTPClient) OnRequestCompleted(rc RequestCompletionCallback)
OnRequestCompleted sets the API request completion callback
func (*HTTPClient) SetHostsFactsRegistry ¶ added in v0.0.6
func (c *HTTPClient) SetHostsFactsRegistry(reg prometheus.Registerer)
Set hosts facts prometheus registry
func (*HTTPClient) SetHostsRegistry ¶ added in v0.0.6
func (c *HTTPClient) SetHostsRegistry(reg prometheus.Registerer)
Set hosts prometheus registry
type Host ¶
type Host struct { ID int64 `json:"id"` Name string `json:"name"` GlobalStatusLabel string `json:"global_status_label,omitempty"` ConfigurationStatusLabel string `json:"configuration_status_label,omitempty"` BuildStatusLabel string `json:"build_status_label,omitempty"` OrganizationName string `json:"organization_name,omitempty"` EnvironmentName string `json:"environment_name,omitempty"` OperatingSystemName string `json:"operatingsystem_name,omitempty"` OwnerName string `json:"owner_name,omitempty"` LocationName string `json:"location_name,omitempty"` ModelName string `json:"model_name,omitempty"` HostgroupName string `json:"hostgroup_name,omitempty"` }
type HostFactsResponse ¶
type HostFactsWithConcurrencyResult ¶
type HostFactsWithConcurrencyResult struct { Index int Result HostFactsResponse Error error }
a struct to hold the result from each request including an index which will be used for sorting the results after they come in
type HostResponse ¶
type HostWithConcurrencyResult ¶
type HostWithConcurrencyResult struct { Index int Result HostResponse Error error }
a struct to hold the result from each request including an index which will be used for sorting the results after they come in
type LeveledLogrus ¶
func (*LeveledLogrus) Debug ¶
func (l *LeveledLogrus) Debug(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Error ¶
func (l *LeveledLogrus) Error(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Info ¶
func (l *LeveledLogrus) Info(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Warn ¶
func (l *LeveledLogrus) Warn(msg string, keysAndValues ...interface{})