jobs

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDurations

func ValidateDurations(intervalDuration, timeoutDuration string) error

ValidateDurations validates the scraping interval and timeout interval

func ValidateJobName

func ValidateJobName(name string) error

ValidateJobName validates the job name

func ValidateMetricsPath

func ValidateMetricsPath(mp string) error

ValidateMetricsPath validates the metrics path

func ValidateScheme

func ValidateScheme(protocol string) error

ValidateScheme validates the protocol

func ValidateStaticConfigs

func ValidateStaticConfigs(sc []StaticConfig) error

ValidateStaticConfigs validates provided static configs

Types

type BasicAuth

type BasicAuth struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth holds basic auth data

type GetJobResponse

type GetJobResponse struct {
	Message string `json:"message,omitempty"`
	Data    Job    `json:"data,omitempty"`
}

GetJobResponse is a struct representing the api response for a single job

type Job

type Job struct {
	StaticConfigs         []StaticConfig         `json:"staticConfigs"`
	JobName               string                 `json:"jobName,omitempty"`
	Scheme                string                 `json:"scheme,omitempty"`
	ScrapeInterval        string                 `json:"scrapeInterval,omitempty"`
	ScrapeTimeout         string                 `json:"scrapeTimeout,omitempty"`
	MetricsPath           string                 `json:"metricsPath,omitempty"`
	SampleLimit           int                    `json:"sampleLimit,omitempty"`
	BasicAuth             *BasicAuth             `json:"basicAuth,omitempty"`
	OAuth2                *OAuth2                `json:"oauth2,omitempty"`
	TLSConfig             *TLSConfig             `json:"tlsConfig,omitempty"`
	BearerToken           string                 `json:"bearerToken,omitempty"`
	MetricsRelabelConfigs []MetricsRelabelConfig `json:"metricsRelabelConfigs,omitempty"`
	Params                map[string]interface{} `json:"params,omitempty"`
	ServiceDiscoryConfigs []ServiceDiscoryConfig `json:"httpSdConfigs,omitempty"`
	HonorLabels           bool                   `json:"honorLabels,omitempty"`
	HonorTimeStamps       bool                   `json:"honorTimeStamps,omitempty"`
}

Job is a struct representing a job

func (Job) Validate

func (job Job) Validate() error

Validate validates a job

type JobsService

type JobsService common.Service

JobsService is the service that handles CRUD functionality for Argus metric collection jobs

func New

func New(c common.Client) *JobsService

New returns a new handler for the service

func (*JobsService) Create

func (svc *JobsService) Create(ctx context.Context, projectID, instanceID string, job Job) (res ListJobsResponse, w *wait.Handler, err error)

Create creates an argus scrape job and return a list of jobs it also returns a wait service to verify the creation the wait service can be triggered using `Wait()` and it returns the job (GetJobResponse) and an error if occurred See also https://api.stackit.schwarz/argus-monitoring-service/openapi.v1.html#operation/v1_projects_instances_scrapeconfigs_create

func (*JobsService) Delete

func (svc *JobsService) Delete(ctx context.Context, projectID, instanceID, jobName string) (res ListJobsResponse, w *wait.Handler, err error)

Delete deletes an argus scrape job and returns the list of jobs, a wait handler and error the wait service is triggered with `.Wait()` and returns nil and error if occurred See also https://api.stackit.schwarz/argus-monitoring-service/openapi.v1.html#operation/v1_projects_instances_scrapeconfigs_delete_configs

func (*JobsService) Get

func (svc *JobsService) Get(ctx context.Context, projectID, instanceID, jobName string) (res GetJobResponse, err error)

Get returns an argus job by job name See also https://api.stackit.schwarz/argus-monitoring-service/openapi.v1.html#operation/v1_projects_instances_scrapeconfigs_read

func (*JobsService) List

func (svc *JobsService) List(ctx context.Context, projectID, instanceID string) (res ListJobsResponse, err error)

List returns a list of argus jobs See also https://api.stackit.schwarz/argus-monitoring-service/openapi.v1.html#operation/v1_projects_instances_scrapeconfigs_list

func (*JobsService) Update

func (svc *JobsService) Update(ctx context.Context, projectID, instanceID string, job Job) (res ListJobsResponse, err error)

Update updates an argus scrape job See also https://api.stackit.schwarz/argus-monitoring-service/openapi.v1.html#operation/v1_projects_instances_scrapeconfigs_create

type ListJobsResponse

type ListJobsResponse struct {
	Message string `json:"message,omitempty"`
	Data    []Job  `json:"data,omitempty"`
}

ListJobsResponse is a struct representing the api response for listing jobs

type MetricsRelabelConfig

type MetricsRelabelConfig struct {
	SourceLabels []string `json:"sourceLabels,omitempty"`
	Separator    string   `json:"separator,omitempty"`
	TargetLabel  string   `json:"targetLabel,omitempty"`
	Regex        string   `json:"regex,omitempty"`
	Modulus      int      `json:"modulus,omitempty"`
	Replacement  string   `json:"replacement,omitempty"`
	Action       string   `json:"action,omitempty"`
}

MetricsRelabelConfig configuration for metric relabeling

type OAuth2

type OAuth2 struct {
	ClientID     string    `json:"clientId,omitempty"`
	ClientSecret string    `json:"clientSecret,omitempty"`
	TokenURL     string    `json:"tokenUrl,omitempty"`
	Scopes       []string  `json:"scopes,omitempty"`
	TLSConfig    TLSConfig `json:"tlsConfig,omitempty"`
}

OAuth2 holds OAuth2 data

type ServiceDiscoryConfig

type ServiceDiscoryConfig struct {
	URL             string    `json:"url,omitempty"`
	RefreshInterval string    `json:"refreshInterval,omitempty"`
	BasicAuth       BasicAuth `json:"basicAuth,omitempty"`
	TLSConfig       TLSConfig `json:"tlsConfig,omitempty"`
	OAuth2          OAuth2    `json:"oauth2,omitempty"`
}

ServiceDiscoryConfig is the configuration for service discovery

type StaticConfig

type StaticConfig struct {
	Targets []string          `json:"targets,omitempty"`
	Labels  map[string]string `json:"labels,omitempty"`
}

StaticConfig holds targets for scraping

type TLSConfig

type TLSConfig struct {
	InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
}

TLSConfig determines if the insecureSkipVerify is enabled/disabled

Jump to

Keyboard shortcuts

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