Help us shape the future of Go! Take the 2026 Go Developer Survey

argus

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultScheme                   = "https" // API default is "http"
	DefaultScrapeInterval           = "5m"
	DefaultScrapeTimeout            = "2m"
	DefaultSampleLimit              = int64(5000)
	DefaultSAML2EnableURLParameters = true
)

Variables

View Source
var (
	Schema = schema.Schema{
		Description:         fmt.Sprintf("%s\n%s", descriptions["main"], descriptions["deprecation_message"]),
		MarkdownDescription: fmt.Sprintf("%s\n\n!> %s\n\n%s", descriptions["main"], descriptions["deprecation_message"], exampleMoveToObservability),
		DeprecationMessage:  descriptions["deprecation_message"],
		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`instance_id`,`name`\".",
				Computed:    true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
				},
			},
			"project_id": schema.StringAttribute{
				Description: "STACKIT project ID to which the scraping job is associated.",
				Required:    true,
				Validators: []validator.String{
					validate.UUID(),
					validate.NoSeparator(),
				},
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.RequiresReplace(),
				},
			},
			"instance_id": schema.StringAttribute{
				Description: "Argus instance ID to which the scraping job is associated.",
				Required:    true,
				Validators: []validator.String{
					validate.UUID(),
					validate.NoSeparator(),
				},
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.RequiresReplace(),
				},
			},
			"name": schema.StringAttribute{
				Description: "Specifies the name of the scraping job.",
				Required:    true,
				Validators: []validator.String{
					validate.NoSeparator(),
					stringvalidator.LengthBetween(1, 200),
				},
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.RequiresReplace(),
				},
			},
			"metrics_path": schema.StringAttribute{
				Description: "Specifies the job scraping url path. E.g. `/metrics`.",
				Required:    true,
				Validators: []validator.String{
					stringvalidator.LengthBetween(1, 200),
				},
			},

			"scheme": schema.StringAttribute{
				Description: "Specifies the http scheme. Defaults to `https`.",
				Optional:    true,
				Computed:    true,
				Default:     stringdefault.StaticString(DefaultScheme),
			},
			"scrape_interval": schema.StringAttribute{
				Description: "Specifies the scrape interval as duration string. Defaults to `5m`.",
				Optional:    true,
				Computed:    true,
				Validators: []validator.String{
					stringvalidator.LengthBetween(2, 8),
				},
				Default: stringdefault.StaticString(DefaultScrapeInterval),
			},
			"scrape_timeout": schema.StringAttribute{
				Description: "Specifies the scrape timeout as duration string. Defaults to `2m`.",
				Optional:    true,
				Computed:    true,
				Validators: []validator.String{
					stringvalidator.LengthBetween(2, 8),
				},
				Default: stringdefault.StaticString(DefaultScrapeTimeout),
			},
			"sample_limit": schema.Int64Attribute{
				Description: "Specifies the scrape sample limit. Upper limit depends on the service plan. Defaults to `5000`.",
				Optional:    true,
				Computed:    true,
				Validators: []validator.Int64{
					int64validator.Between(1, 3000000),
				},
				Default: int64default.StaticInt64(DefaultSampleLimit),
			},
			"saml2": schema.SingleNestedAttribute{
				Description: "A SAML2 configuration block.",
				Optional:    true,
				Computed:    true,
				Default: objectdefault.StaticValue(
					types.ObjectValueMust(
						map[string]attr.Type{
							"enable_url_parameters": types.BoolType,
						},
						map[string]attr.Value{
							"enable_url_parameters": types.BoolValue(DefaultSAML2EnableURLParameters),
						},
					),
				),
				Attributes: map[string]schema.Attribute{
					"enable_url_parameters": schema.BoolAttribute{
						Description: "Specifies if URL parameters are enabled. Defaults to `true`",
						Optional:    true,
						Computed:    true,
						Default:     booldefault.StaticBool(DefaultSAML2EnableURLParameters),
					},
				},
			},
			"basic_auth": schema.SingleNestedAttribute{
				Description: "A basic authentication block.",
				Optional:    true,
				Computed:    true,
				Attributes: map[string]schema.Attribute{
					"username": schema.StringAttribute{
						Description: "Specifies basic auth username.",
						Required:    true,
						Validators: []validator.String{
							stringvalidator.LengthBetween(1, 200),
						},
					},
					"password": schema.StringAttribute{
						Description: "Specifies basic auth password.",
						Required:    true,
						Sensitive:   true,
						Validators: []validator.String{
							stringvalidator.LengthBetween(1, 200),
						},
					},
				},
			},
			"targets": schema.ListNestedAttribute{
				Description: "The targets list (specified by the static config).",
				Required:    true,
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"urls": schema.ListAttribute{
							Description: "Specifies target URLs.",
							Required:    true,
							ElementType: types.StringType,
							Validators: []validator.List{
								listvalidator.ValueStringsAre(
									stringvalidator.LengthBetween(1, 500),
								),
							},
						},
						"labels": schema.MapAttribute{
							Description: "Specifies labels.",
							Optional:    true,
							ElementType: types.StringType,
							Validators: []validator.Map{
								mapvalidator.SizeAtMost(10),
								mapvalidator.ValueStringsAre(stringvalidator.LengthBetween(0, 200)),
								mapvalidator.KeysAre(stringvalidator.LengthBetween(0, 200)),
							},
						},
					},
				},
			},
		},
	}
)

Functions

func NewScrapeConfigDataSource

func NewScrapeConfigDataSource() datasource.DataSource

NewScrapeConfigDataSource is a helper function to simplify the provider implementation.

func NewScrapeConfigResource

func NewScrapeConfigResource() resource.Resource

NewScrapeConfigResource is a helper function to simplify the provider implementation.

Types

type Model

type Model struct {
	Id             types.String `tfsdk:"id"` // needed by TF
	ProjectId      types.String `tfsdk:"project_id"`
	InstanceId     types.String `tfsdk:"instance_id"`
	Name           types.String `tfsdk:"name"`
	MetricsPath    types.String `tfsdk:"metrics_path"`
	Scheme         types.String `tfsdk:"scheme"`
	ScrapeInterval types.String `tfsdk:"scrape_interval"`
	ScrapeTimeout  types.String `tfsdk:"scrape_timeout"`
	SampleLimit    types.Int64  `tfsdk:"sample_limit"`
	SAML2          types.Object `tfsdk:"saml2"`
	BasicAuth      types.Object `tfsdk:"basic_auth"`
	Targets        types.List   `tfsdk:"targets"`
}

Jump to

Keyboard shortcuts

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