tfschema

package
v0.0.0-...-5cfaba6 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const IndependentNotificationPolicyData = "__independent"

When a notification policy is independent, we always set the notification_policy_data to this static sentinel value such that the bucket resource can detect when it's referencing an independent policy.

Variables

View Source
var BlackholeAlertNotifier = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
}
View Source
var Bucket = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"description": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"labels": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},

	"notification_policy_slug": {
		Type:     schema.TypeString,
		Computed: true,
	},
	"notification_policy_id": {
		Type:          schema.TypeString,
		ConflictsWith: []string{"notification_policy_data"},
		Optional:      true,
	},
	"team_id": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"notification_policy_data": {
		Type:             schema.TypeString,
		Optional:         true,
		DiffSuppressFunc: JSONNotificationPolicyDiffSuppress,
		ValidateFunc:     ValidateNotificationPolicyData,
	},
}
View Source
var ClassicDashboard = map[string]*schema.Schema{
	"bucket_id": {
		Type:         schema.TypeString,
		Optional:     true,
		AtLeastOneOf: []string{"bucket_id", "collection_id"},
	},
	"collection_id": {
		Type:         schema.TypeString,
		Optional:     true,
		AtLeastOneOf: []string{"bucket_id", "collection_id"},
	},
	"dashboard_json": {
		Type:             schema.TypeString,
		Required:         true,
		DiffSuppressFunc: classicDashboardJSONDiffSuppress,
	},
}
View Source
var Collection = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"team_id": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"description": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"notification_policy_id": {
		Type:     schema.TypeString,
		Optional: true,
	},
}
View Source
var Dashboard = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"collection_id": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"dashboard_json": {
		Type:                  schema.TypeString,
		Required:              true,
		DiffSuppressFunc:      dashboardJSONDiffSuppress,
		DiffSuppressOnRefresh: true,
	},
}
View Source
var DataBucket = map[string]*schema.Schema{
	"slug": {
		Type:         schema.TypeString,
		Optional:     true,
		ExactlyOneOf: dataBucketOneOfAddressFields,
	},
	"name": {
		Type:         schema.TypeString,
		Optional:     true,
		ExactlyOneOf: dataBucketOneOfAddressFields,
	},
	"description": {
		Type:     schema.TypeString,
		Computed: true,
	},
	"labels": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},
}
View Source
var DataCollection = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"name": {
		Type:     schema.TypeString,
		Computed: true,
	},
	"description": {
		Type:     schema.TypeString,
		Computed: true,
	},
}
View Source
var DataService = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Required: true,
	},
	"name": {
		Type:     schema.TypeString,
		Computed: true,
	},
	"description": {
		Type:     schema.TypeString,
		Computed: true,
	},
}
View Source
var Dataset = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"description": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"configuration": {
		Type:     schema.TypeList,
		Required: true,
		MinItems: 1,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: datasetConfigurationSchema,
		},
	},
}
View Source
var DerivedLabel = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"label_name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"description": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"existing_label_policy": Enum{
		Value:    enum.LabelPolicy.ToStrings(),
		Optional: true,
	}.Schema(),
	"metric_label": {
		Type:     schema.TypeList,
		MaxItems: 1,
		Required: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"constructed_label": {
					Type:     schema.TypeList,
					Optional: true,
					MaxItems: 1,
					Elem: &schema.Resource{
						Schema: map[string]*schema.Schema{
							"value_definitions": {
								Type:     schema.TypeList,
								Required: true,
								Elem: &schema.Resource{
									Schema: map[string]*schema.Schema{
										"value": {
											Type:     schema.TypeString,
											Required: true,
										},
										"filters": {
											Type:     schema.TypeList,
											Required: true,
											Elem: &schema.Resource{
												Schema: map[string]*schema.Schema{
													"name": {
														Type:     schema.TypeString,
														Required: true,
													},
													"value_glob": {
														Type:     schema.TypeString,
														Required: true,
													},
												},
											},
										},
									},
								},
							},
						},
					},
				},
				"mapping_label": {
					Type:     schema.TypeList,
					Optional: true,
					MaxItems: 1,
					Elem: &schema.Resource{
						Schema: map[string]*schema.Schema{
							"name_mappings": {
								Type:     schema.TypeList,
								Optional: true,
								Elem: &schema.Resource{
									Schema: map[string]*schema.Schema{
										"source_label": {
											Type:     schema.TypeString,
											Required: true,
										},
										"filters": {
											Type:     schema.TypeList,
											Required: true,
											Elem: &schema.Resource{
												Schema: map[string]*schema.Schema{
													"name": {
														Type:     schema.TypeString,
														Required: true,
													},
													"value_glob": {
														Type:     schema.TypeString,
														Required: true,
													},
												},
											},
										},
										"value_mappings": ValueMappingsSchema,
									},
								},
							},
							"value_mappings": ValueMappingsSchema,
						},
					},
				},
			},
		},
	},
}
View Source
var DerivedMetric = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"metric_name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"description": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"queries": {
		Type:     schema.TypeList,
		Required: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"selector": {
					Type:     schema.TypeList,
					Optional: true,
					MaxItems: 1,
					Elem: &schema.Resource{
						Schema: map[string]*schema.Schema{
							"labels": {
								Type:     schema.TypeMap,
								Optional: true,
								Elem:     &schema.Schema{Type: schema.TypeString},
							},
						},
					},
				},
				"query": {
					Type:     schema.TypeList,
					Required: true,
					MinItems: 1,
					MaxItems: 1,
					Elem: &schema.Resource{
						Schema: map[string]*schema.Schema{
							"expr": {
								Type:     schema.TypeString,
								Required: true,
							},
							"variables": {
								Type:     schema.TypeList,
								Optional: true,
								Elem: &schema.Resource{
									Schema: map[string]*schema.Schema{
										"name": {
											Type:     schema.TypeString,
											Required: true,
										},
										"default_selector": {
											Type:     schema.TypeString,
											Required: true,
										},
									},
								},
							},
						},
					},
				},
			},
		},
	},
}
View Source
var DropRule = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"active": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  false,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"query": {
		Type: schema.TypeList,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
		MinItems: 1,
		Required: true,
	},
	"conditional_drop": {
		Type:     schema.TypeBool,
		Optional: true,
	},
	"drop_nan_value": {
		Type:     schema.TypeBool,
		Optional: true,
	},
	"activated_drop_duration": Duration{
		Optional: true,
	}.Schema(),
	"rate_limit_threshold": {
		Type:             schema.TypeFloat,
		Optional:         true,
		ValidateDiagFunc: float64RangeValidator(0, 100.0),
	},
	"value_based_drop": {
		Type:     schema.TypeList,
		MaxItems: 1,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"target_drop_value": {
					Type:     schema.TypeFloat,
					Required: true,
				},
			},
		},
	},
}
View Source
var EmailAlertNotifier = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"send_resolved": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  true,
	},
	"to": {
		Type:     schema.TypeString,
		Required: true,
	},
	"html": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"text": {
		Type:     schema.TypeString,
		Optional: true,
	},
}
View Source
var GcpMetricsIntegration = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"service_account": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"client_email": {
					Type:     schema.TypeString,
					Required: true,
				},
			},
		},
		MinItems: 1,
		MaxItems: 1,
	},
	"metric_groups": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"project_id": {
					Type:     schema.TypeString,
					Required: true,
				},
				"prefixes": {
					Type:     schema.TypeList,
					Optional: true,
					Elem:     &schema.Schema{Type: schema.TypeString},
				},
			},
		},
	},
}
View Source
var MappingRule = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"bucket_id": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"filter": Filter{
		KVDelimiter: aggregationfilter.MappingRuleDelimiter,
	}.Schema(),
	"aggregations": {
		Type:     schema.TypeList,
		Optional: true,
		MaxItems: 1,
		Elem: Enum{
			Value: enum.AggregationType.ToStrings(),
		}.Schema(),
	},

	"storage_policy": {
		Type:     schema.TypeList,
		Optional: true,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"resolution": Duration{
					Required: true,
				}.Schema(),
				"retention": Duration{
					Required: true,
				}.Schema(),
			},
		},
	},
	"drop": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  false,
	},

	"drop_timestamp": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  false,
	},
	"interval": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"mode": Enum{
		Value:    enum.MappingModeType.ToStrings(),
		Optional: true,
	}.Schema(),
}
View Source
var MatcherListSchema = &schema.Schema{
	Type:     schema.TypeList,
	Required: true,
	MinItems: 1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"name": {
				Type:     schema.TypeString,
				Required: true,
			},
			"type": Enum{
				Value:    enum.MatcherType.ToStrings(),
				Required: true,
			}.Schema(),
			"value": {
				Type:     schema.TypeString,
				Required: true,
			},
		},
	},
}
View Source
var Monitor = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"bucket_id": {
		Type:         schema.TypeString,
		Optional:     true,
		AtLeastOneOf: []string{"bucket_id", "collection_id"},
	},
	"collection_id": {
		Type:         schema.TypeString,
		Optional:     true,
		AtLeastOneOf: []string{"bucket_id", "collection_id"},
	},
	"notification_policy_id": {
		Type:     schema.TypeString,
		Optional: true,
		ValidateDiagFunc: func(policyID any, _ cty.Path) diag.Diagnostics {
			if localid.IsLocalID(policyID.(string)) {
				return diag.Errorf("cannot directly reference unowned notification policy, use a notifcation policy with team_id set")
			}
			return nil
		},
	},
	"labels": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},
	"annotations": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},
	"query": {
		Type:     schema.TypeList,
		Required: true,
		MinItems: 1,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"prometheus_expr": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"graphite_expr": {
					Type:     schema.TypeString,
					Optional: true,
				},
			},
		},
	},
	"signal_grouping": {
		Type:     schema.TypeList,
		Optional: true,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"label_names": {
					Type: schema.TypeList,
					Elem: &schema.Schema{
						Type: schema.TypeString,
					},
					Optional: true,
				},
				"signal_per_series": {
					Type:     schema.TypeBool,
					Optional: true,
				},
			},
		},
	},
	"series_conditions": {
		Type:     schema.TypeList,
		Required: true,
		MinItems: 1,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"condition": MonitorSeriesConditionSchema,
				"override": {
					Type:     schema.TypeList,
					Optional: true,
					Elem: &schema.Resource{
						Schema: map[string]*schema.Schema{
							"label_matcher": MatcherListSchema,
							"condition":     MonitorSeriesConditionSchema,
						},
					},
				},
			},
		},
	},
	"interval": Duration{
		Optional: true,
	}.Schema(),
	"schedule": {
		Type:     schema.TypeList,
		MaxItems: 1,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"timezone": {
					Type:     schema.TypeString,
					Required: true,
				},
				"range": typeset.Set{
					ElemFields: map[string]typeset.ElemField{
						"day": CaseInsensitiveString{
							Required: true,
						},
						"start": typeset.NotNormalized(&schema.Schema{
							Type:     schema.TypeString,
							Required: true,
						}),
						"end": typeset.NotNormalized(&schema.Schema{
							Type:     schema.TypeString,
							Required: true,
						}),
					},
				}.Schema(),
			},
		},
	},
}
View Source
var MonitorSeriesConditionSchema = typeset.Set{
	Required: true,
	MinItems: 1,
	ElemFields: map[string]typeset.ElemField{

		"severity": typeset.NotNormalized(&schema.Schema{
			Type:     schema.TypeString,
			Required: true,
		}),
		"op": Enum{
			Value:    enum.ConditionOp.ToStrings(),
			Required: true,
		},
		"value": typeset.NotNormalized(&schema.Schema{
			Type:     schema.TypeFloat,
			Optional: true,
			Default:  0,
		}),
		"sustain": Duration{
			Optional: true,
		},
		"resolve_sustain": Duration{
			Optional: true,
		},
	},
}.Schema()
View Source
var NotificationPolicy = map[string]*schema.Schema{

	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"name": {
		Type:     schema.TypeString,
		Optional: true,
	},

	"team_id": {
		Type:         schema.TypeString,
		Optional:     true,
		RequiredWith: []string{"name"},
	},
	"route": NotificationRouteSchema,
	"override": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"alert_label_matcher": MatcherListSchema,
				"route":               NotificationRouteSchema,
			},
		},
	},
	"notification_policy_data": {
		Type:             schema.TypeString,
		Optional:         true,
		Computed:         true,
		DiffSuppressFunc: JSONNotificationPolicyDiffSuppress,
		ValidateFunc:     ValidateNotificationPolicyData,
	},

	"is_independent": {
		Type:     schema.TypeBool,
		Computed: true,
		ForceNew: true,
	},
}
View Source
var NotificationRouteSchema = typeset.Set{
	ElemFields: map[string]typeset.ElemField{

		"severity": typeset.NotNormalized(&schema.Schema{
			Type:     schema.TypeString,
			Required: true,
		}),
		"notifiers": typeset.NotNormalized(&schema.Schema{
			Type:     schema.TypeSet,
			Optional: true,
			Elem:     &schema.Schema{Type: schema.TypeString},
		}),
		"repeat_interval": Duration{
			Optional: true,
		},
	},
}.Schema()
View Source
var OpsgenieAlertNotifier = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"send_resolved": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  true,
	},
	"api_key": {
		Type:      schema.TypeString,
		Required:  true,
		Sensitive: true,
	},
	"api_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"message": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"description": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"source": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"details": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},
	"responder": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"id": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"name": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"username": {
					Type:     schema.TypeString,
					Optional: true,
				},

				"type": {
					Type:     schema.TypeString,
					Required: true,
				},
			},
		},
	},
	"tags": {
		Type: schema.TypeSet,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
		Optional: true,
	},
	"note": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"priority": {
		Type:     schema.TypeString,
		Optional: true,
	},

	"basic_auth_username": {
		Type:          schema.TypeString,
		Optional:      true,
		RequiredWith:  []string{"basic_auth_password"},
		ConflictsWith: []string{"bearer_token"},
	},
	"basic_auth_password": {
		Type:         schema.TypeString,
		Optional:     true,
		RequiredWith: []string{"basic_auth_password"},
		Sensitive:    true,
	},
	"bearer_token": {
		Type:          schema.TypeString,
		Optional:      true,
		ConflictsWith: []string{"basic_auth_username"},
	},
	"proxy_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"tls_insecure_skip_verify": {
		Type:     schema.TypeBool,
		Optional: true,
	},
}
View Source
var PagerdutyAlertNotifier = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"send_resolved": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  true,
	},
	"class": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"client": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"client_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"component": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"description": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"details": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},
	"group": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"basic_auth_username": {
		Type:          schema.TypeString,
		Optional:      true,
		RequiredWith:  []string{"basic_auth_password"},
		ConflictsWith: []string{"bearer_token"},
	},
	"basic_auth_password": {
		Type:         schema.TypeString,
		Optional:     true,
		RequiredWith: []string{"basic_auth_password"},
		Sensitive:    true,
	},
	"bearer_token": {
		Type:          schema.TypeString,
		Optional:      true,
		ConflictsWith: []string{"basic_auth_username"},
	},
	"proxy_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"tls_insecure_skip_verify": {
		Type:     schema.TypeBool,
		Optional: true,
	},
	"image": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"alt": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"href": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"src": {
					Type:     schema.TypeString,
					Required: true,
				},
			},
		},
	},
	"link": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"href": {
					Type:     schema.TypeString,
					Required: true,
				},
				"text": {
					Type:     schema.TypeString,
					Optional: true,
				},
			},
		},
	},
	"routing_key": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"service_key": {
		Type:      schema.TypeString,
		Optional:  true,
		Sensitive: true,
	},
	"severity": {
		Type:     schema.TypeString,
		Required: true,
	},
	"url": {
		Type:     schema.TypeString,
		Required: true,
	},
}
View Source
var RecordingRule = map[string]*schema.Schema{
	"bucket_id": {
		Type:         schema.TypeString,
		Optional:     true,
		AtLeastOneOf: executionGroupFields,
	},
	"execution_group": {
		Type:         schema.TypeString,
		Optional:     true,
		AtLeastOneOf: executionGroupFields,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"labels": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},
	"interval": Duration{
		Optional: true,
	}.Schema(),
	"expr": {
		Type:     schema.TypeString,
		Required: true,
	},
	"metric_name": {
		Type:     schema.TypeString,
		Optional: true,
	},
}
View Source
var ResourcePoolAllocationSchema = &schema.Schema{
	Type: schema.TypeList,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"percent_of_license": {
				Type:     schema.TypeFloat,
				Required: true,
			},
		},
	},
	MaxItems: 1,
	Required: true,
}
View Source
var ResourcePoolElemSchema = &schema.Resource{
	Schema: map[string]*schema.Schema{
		"name": {
			Type:     schema.TypeString,
			Required: true,
		},
		"allocation": ResourcePoolAllocationSchema,
		"match_rule": {
			Type:       schema.TypeString,
			Optional:   true,
			Deprecated: "use match_rules",
		},
		"match_rules": {
			Type:     schema.TypeList,
			Elem:     &schema.Schema{Type: schema.TypeString},
			MinItems: 1,
			Optional: true,
		},
		"priorities": ResourcePoolPrioritiesSchema,
	},
}
View Source
var ResourcePoolPrioritiesSchema = &schema.Schema{
	Type: schema.TypeList,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"high_priority_match_rules": {
				Type:     schema.TypeList,
				Elem:     &schema.Schema{Type: schema.TypeString},
				MinItems: 1,
				Optional: true,
			},
			"low_priority_match_rules": {
				Type:     schema.TypeList,
				Elem:     &schema.Schema{Type: schema.TypeString},
				MinItems: 1,
				Optional: true,
			},
		},
	},
	MaxItems: 1,
	Optional: true,
}
View Source
var ResourcePoolsConfig = map[string]*schema.Schema{
	"default_pool": {
		Type: schema.TypeList,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"allocation": ResourcePoolAllocationSchema,
				"priorities": ResourcePoolPrioritiesSchema,
			},
			SchemaVersion: 1,
		},
		Required: true,
		MaxItems: 1,
	},
	"pools": {
		Type:          schema.TypeList,
		Elem:          ResourcePoolElemSchema,
		Optional:      true,
		ConflictsWith: []string{"pool"},
		Deprecated:    "Use pool instead of pools",
		MaxItems:      maxResourcePools,
	},
	"pool": {
		Type:          schema.TypeList,
		Elem:          ResourcePoolElemSchema,
		ConflictsWith: []string{"pools"},
		Optional:      true,
		MaxItems:      maxResourcePools,
	},
}
View Source
var RollupRule = map[string]*schema.Schema{
	"bucket_id": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type: schema.TypeString,

		Required: true,
		ForceNew: true,
	},
	"filter": Filter{
		KVDelimiter: aggregationfilter.RollupRuleDelimiter,
	}.Schema(),
	"new_metric": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"metric_type": Enum{
		Value:    enum.MetricType.ToStrings(),
		Required: true,
	}.Schema(),
	"aggregation": Enum{
		Value:    enum.AggregationType.ToStrings(),
		Optional: true,
	}.Schema(),
	"storage_policies": {
		Type:     schema.TypeList,
		Optional: true,
		MinItems: 1,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"resolution": Duration{
					Required: true,
				}.Schema(),
				"retention": Duration{
					Required: true,
				}.Schema(),
			},
		},

		Computed: true,
	},
	"interval": {
		Type:          schema.TypeString,
		Optional:      true,
		ConflictsWith: []string{"storage_policies"},
	},
	"group_by": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
	},
	"exclude_by": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
	},
	"metric_type_tag": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  false,
	},
	"drop_raw": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  false,
	},
	"permissive": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  false,
	},
	"mode": Enum{
		Value:    enum.RollupModeType.ToStrings(),
		Optional: true,
	}.Schema(),
}
View Source
var SampleRateSchema = &schema.Schema{
	Type:             schema.TypeFloat,
	Required:         true,
	ValidateDiagFunc: float64RangeValidator(0, 1.0),
}
View Source
var ServiceAccount = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
		ForceNew: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"email": {
		Type:     schema.TypeString,
		Computed: true,
	},
	"token": {
		Type:      schema.TypeString,
		Computed:  true,
		Sensitive: true,
	},
	"unrestricted": {
		Type:         schema.TypeBool,
		Optional:     true,
		ForceNew:     true,
		ExactlyOneOf: serviceAccountPermOneOfFields,
	},
	"restriction": {
		Type:     schema.TypeList,
		Optional: true,
		ForceNew: true,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"permission": Enum{
					Value:    enum.Permission.ToStrings(),
					Required: true,
				}.Schema(),
				"labels": {
					Type:     schema.TypeMap,
					Elem:     &schema.Schema{Type: schema.TypeString},
					Optional: true,
				},
			},
		},
		ExactlyOneOf: serviceAccountPermOneOfFields,
	},
}
View Source
var SlackAlertNotifier = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"action": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"name": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"style": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"text": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"type": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"url": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"value": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"action_confirm_text": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"action_confirm_tile": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"action_confirm_ok_text": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"action_confirm_dismiss_text": {
					Type:     schema.TypeString,
					Optional: true,
				},
			},
		},
	},
	"api_url": {
		Type:      schema.TypeString,
		Required:  true,
		Sensitive: true,
	},
	"send_resolved": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  true,
	},
	"callback_id": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"channel": {
		Type:     schema.TypeString,
		Required: true,
	},
	"color": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"fallback": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"fields": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"title": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"value": {
					Type:     schema.TypeString,
					Optional: true,
				},
				"short": {
					Type:     schema.TypeBool,
					Optional: true,
				},
			},
		},
	},
	"footer": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"basic_auth_username": {
		Type:          schema.TypeString,
		Optional:      true,
		RequiredWith:  []string{"basic_auth_password"},
		ConflictsWith: []string{"bearer_token"},
	},
	"basic_auth_password": {
		Type:         schema.TypeString,
		Optional:     true,
		RequiredWith: []string{"basic_auth_password"},
		Sensitive:    true,
	},
	"bearer_token": {
		Type:          schema.TypeString,
		Optional:      true,
		ConflictsWith: []string{"basic_auth_username"},
	},
	"proxy_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"tls_insecure_skip_verify": {
		Type:     schema.TypeBool,
		Optional: true,
	},
	"icon_emoji": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"icon_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"image_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"link_names": {
		Type:     schema.TypeBool,
		Optional: true,
	},
	"mrkdwn_in": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
	},
	"pretext": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"short_fields": {
		Type:     schema.TypeBool,
		Optional: true,
	},
	"text": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"thumb_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"title": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"title_link": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"username": {
		Type:     schema.TypeString,
		Optional: true,
	},
}
View Source
var Team = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"description": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"user_emails": {
		Type: schema.TypeSet,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
		Optional: true,
	},
}
View Source
var TestResource = map[string]*schema.Schema{
	"some_string": {
		Type: schema.TypeString,
	},
	"some_bool": {
		Type: schema.TypeBool,
	},
	"some_float": {
		Type: schema.TypeFloat,
	},
	"some_int": {
		Type: schema.TypeInt,
	},
	"some_string_list": {
		Type: schema.TypeList,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
	},
	"some_object_set": {
		Type: schema.TypeSet,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"inner_string": {
					Type: schema.TypeString,
				},
				"inner_bool": {
					Type: schema.TypeBool,
				},
			},
		},
	},
	"some_string_map": {
		Type: schema.TypeMap,
		Elem: &schema.Schema{Type: schema.TypeString},
	},
	"some_object": {
		Type:     schema.TypeList,
		MinItems: 1,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"inner_string": {
					Type: schema.TypeString,
				},
				"inner_bool": {
					Type: schema.TypeBool,
				},
			},
		},
	},
	"optional_object": {
		Type:     schema.TypeList,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"inner_string_list": {
					Type: schema.TypeList,
					Elem: &schema.Schema{
						Type: schema.TypeString,
					},
				},
			},
		},
	},
	"optional_string_list": {
		Type: schema.TypeList,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
		Optional: true,
	},
	"collection_id": {
		Type: schema.TypeString,
	},

	"notifiers": NotificationRouteSchema.Elem.(*schema.Resource).Schema["notifiers"],

	"optional_bool_with_default": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  true,
	},
	"computed_and_not_optional": {
		Type:     schema.TypeString,
		Computed: true,
	},
	"computed_and_optional": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
	},
	"dashboard_json": {
		Type: schema.TypeString,
	},
}

TestResource is used exclusively for unit testing.

View Source
var TraceBoolFilterSchema = &schema.Schema{
	Type:     schema.TypeList,
	Optional: true,
	MinItems: 0,
	MaxItems: 1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"value": {
				Type:     schema.TypeBool,
				Required: true,
			},
		},
	},
}
View Source
var TraceDurationFilterSchema = &schema.Schema{
	Type:     schema.TypeList,
	MaxItems: 1,
	Optional: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"min_secs": {
				Type:     schema.TypeFloat,
				Optional: true,
				Default:  0.0,
			},
			"min_seconds": {
				Type:       schema.TypeFloat,
				Optional:   true,
				Default:    0.0,
				Deprecated: "use min_secs instead",
			},
			"max_secs": {
				Type:     schema.TypeFloat,
				Optional: true,
			},
			"max_seconds": {
				Type:       schema.TypeFloat,
				Optional:   true,
				Default:    0.0,
				Deprecated: "use max_secs instead",
			},
		},
	},
}
View Source
var TraceFilterSchema = &schema.Schema{
	Type:     schema.TypeList,
	MinItems: 0,
	MaxItems: 1,
	Optional: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"duration": TraceDurationFilterSchema,
			"error":    TraceBoolFilterSchema,
		},
	},
}
View Source
var TraceJaegerRemoteSamplingStrategy = map[string]*schema.Schema{
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"service_name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"applied_strategy": {
		Type:     schema.TypeList,
		Required: true,
		MinItems: 1,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: appliedStrategySchema,
		},
	},
}
View Source
var TraceMetricsRule = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"metric_name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"metric_labels": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},
	"histogram_buckets_seconds": {
		Type: schema.TypeList,
		Elem: &schema.Schema{
			Type: schema.TypeFloat,
		},
		Optional: true,
	},
	"trace_filter": TraceSearchFilterSchema,
	"group_by": {
		Type:     schema.TypeList,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"key": {
					Type:     schema.TypeList,
					MinItems: 1,
					MaxItems: 1,
					Required: true,
					Elem:     traceMetricsRuleGroupByKeySchema,
				},
				"label": {
					Type:     schema.TypeString,
					Required: true,
				},
			},
		},
	},
}
View Source
var TraceNumericFilterSchema = &schema.Schema{
	Type:     schema.TypeList,
	Optional: true,
	MinItems: 0,
	MaxItems: 1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"comparison": Enum{
				Value:    enum.NumericFilterComparisonType.ToStrings(),
				Required: true,
			}.Schema(),
			"value": {
				Type:     schema.TypeFloat,
				Required: true,
			},
		},
	},
}
View Source
var TraceSearchFilterSchema = &schema.Schema{
	Type:     schema.TypeList,
	MinItems: 1,
	MaxItems: 1,
	Required: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"trace": TraceFilterSchema,
			"span":  TraceSpanFilterListSchema,
		},
	},
}
View Source
var TraceSpanCountFilterSchema = &schema.Schema{
	Type:     schema.TypeList,
	Optional: true,
	MinItems: 0,
	MaxItems: 1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"min": {
				Type:     schema.TypeInt,
				Optional: true,
				Default:  0,
			},
			"max": {
				Type:     schema.TypeInt,
				Optional: true,
				Default:  0,
			},
		},
	},
}
View Source
var TraceSpanFilterListSchema = &schema.Schema{
	Type:     schema.TypeList,
	Optional: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"match_type": {
				Type:             schema.TypeString,
				Optional:         true,
				Default:          prettyenum.SpanFilterMatchTypeInclude,
				ValidateDiagFunc: validateSpanFilterMatchType,
				DiffSuppressFunc: diffSuppressSpanFilterMatchType,
			},
			"service":          TraceStringFilterSchema,
			"operation":        TraceStringFilterSchema,
			"parent_service":   TraceStringFilterSchema,
			"parent_operation": TraceStringFilterSchema,
			"duration":         TraceDurationFilterSchema,
			"error":            TraceBoolFilterSchema,

			"tag":        TraceTagFilterSchema,
			"tags":       deprecated(TraceTagFilterSchema, "`tags` is deprecated, use `tag` instead."),
			"span_count": TraceSpanCountFilterSchema,
		},
	},
}
View Source
var TraceStringFilterSchema = &schema.Schema{
	Type:     schema.TypeList,
	Optional: true,
	MinItems: 0,
	MaxItems: 1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"match": {
				Type:             schema.TypeString,
				Optional:         true,
				Default:          prettyenum.StringFilterMatchTypeExact,
				ValidateDiagFunc: validateStringFilterMatchType,
				DiffSuppressFunc: diffSuppressStringFilterMatchType,
			},
			"value": {
				Type:     schema.TypeString,
				Optional: true,
			},
			"in_values": {
				Type:     schema.TypeList,
				Optional: true,
				MinItems: 0,
				Elem:     &schema.Schema{Type: schema.TypeString},
			},
		},
	},
}
View Source
var TraceTagFilterSchema = &schema.Schema{
	Type:     schema.TypeList,
	Optional: true,
	Elem:     traceTagFilterItemSchema,
}
View Source
var TraceTailSamplingRules = map[string]*schema.Schema{
	"default_sample_rate": {
		Type:     schema.TypeList,
		MaxItems: 1,
		Optional: true,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"enabled": {
					Type:     schema.TypeBool,
					Optional: true,
				},
				"sample_rate": SampleRateSchema,
			},
		},
	},
	"rules": rulesSchema,
}
View Source
var ValueMappingsSchema = &schema.Schema{
	Type:     schema.TypeList,
	Optional: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"target_value": {
				Type:     schema.TypeString,
				Required: true,
			},
			"source_value_globs": {
				Type:     schema.TypeList,
				Required: true,
				Elem:     &schema.Schema{Type: schema.TypeString},
			},
		},
	},
}
View Source
var VictoropsAlertNotifier = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"send_resolved": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  true,
	},
	"api_key": {
		Type:      schema.TypeString,
		Required:  true,
		Sensitive: true,
	},
	"api_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"routing_key": {
		Type:     schema.TypeString,
		Required: true,
	},
	"state_message": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"message_type": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"custom_fields": {
		Type:     schema.TypeMap,
		Elem:     &schema.Schema{Type: schema.TypeString},
		Optional: true,
	},
	"monitoring_tool": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"entity_display_name": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"basic_auth_username": {
		Type:          schema.TypeString,
		Optional:      true,
		RequiredWith:  []string{"basic_auth_password"},
		ConflictsWith: []string{"bearer_token"},
	},
	"basic_auth_password": {
		Type:         schema.TypeString,
		Optional:     true,
		RequiredWith: []string{"basic_auth_password"},
		Sensitive:    true,
	},
	"bearer_token": {
		Type:          schema.TypeString,
		Optional:      true,
		ConflictsWith: []string{"basic_auth_username"},
	},
	"proxy_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"tls_insecure_skip_verify": {
		Type:     schema.TypeBool,
		Optional: true,
	},
}
View Source
var WebhookAlertNotifier = map[string]*schema.Schema{
	"name": {
		Type:     schema.TypeString,
		Required: true,
	},
	"slug": {
		Type:     schema.TypeString,
		Optional: true,
		Computed: true,
		ForceNew: true,
	},
	"send_resolved": {
		Type:     schema.TypeBool,
		Optional: true,
		Default:  true,
	},
	"url": {
		Type:     schema.TypeString,
		Required: true,
	},
	"basic_auth_username": {
		Type:          schema.TypeString,
		Optional:      true,
		RequiredWith:  []string{"basic_auth_password"},
		ConflictsWith: []string{"bearer_token"},
	},
	"basic_auth_password": {
		Type:         schema.TypeString,
		Optional:     true,
		RequiredWith: []string{"basic_auth_password"},
		Sensitive:    true,
	},
	"bearer_token": {
		Type:          schema.TypeString,
		Optional:      true,
		ConflictsWith: []string{"basic_auth_username"},
	},
	"proxy_url": {
		Type:     schema.TypeString,
		Optional: true,
	},
	"tls_insecure_skip_verify": {
		Type:     schema.TypeBool,
		Optional: true,
	},
}

Functions

func DiagError

func DiagError(diags diag.Diagnostics) error

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a time.Duration based on the prom model.Duration type. This matches the backend parsing logic.

func IsListEncodedObject

func IsListEncodedObject(s *schema.Schema) bool

IsListEncodedObject returns whether s defines a list encoded object.

func JSONNotificationPolicyDiffSuppress

func JSONNotificationPolicyDiffSuppress(k, old, new string, d *schema.ResourceData) bool

JSONNotificationPolicyDiffSuppress returns true if the diff between old and new notification policy JSON values should be suppressed, i.e. the resources are not considered different.

func ParseDuration

func ParseDuration(v string) (time.Duration, error)

ParseDuration parses a time.Duration string based on the prom model.Duration type. This matches the backend parsing logic.

func SanitizedDashboardJSON

func SanitizedDashboardJSON(data string, opts ...SanitizeOpt) (string, error)

SanitizedDashboardJSON sanitizes a dashboard JSON payload, clearing fields irrelevant to reading or upserting dashboards.

func ValidateNotificationPolicyData

func ValidateNotificationPolicyData(i any, k string) (warnings []string, errors []error)

ValidateNotificationPolicyData is a SchemaValidateFunc which tests if the provided value is of type string and is valid JSON. It does not validate that it is a serialization of a notification policy but we control that in the provider so we know what we're passing in is safe. If for some reason some valid but incorrect JSON does get set then this will fail on apply

TODO: fix the code so that valid, but incorrect JSON for a notification policy fails on plan

Types

type CaseInsensitiveString

type CaseInsensitiveString struct {
	Required bool
}

CaseInsensitiveString defines the parameters of a case-insensitive string field in a Terraform schema.

func (CaseInsensitiveString) Normalize

func (s CaseInsensitiveString) Normalize(v any) any

Normalize implements typeset.Normalizer.

func (CaseInsensitiveString) Schema

func (s CaseInsensitiveString) Schema() *schema.Schema

Schema returns the Terraform schema of the string.

type Duration

type Duration struct {
	Required bool
	Optional bool
}

Duration defines the parameters of a duration field in a Terraform schema.

func (Duration) Normalize

func (d Duration) Normalize(v any) any

Normalize implements typeset.Normalizer.

func (Duration) Schema

func (d Duration) Schema() *schema.Schema

Schema returns the Terraform schema of the duration.

type Enum

type Enum struct {
	Value    enum.Enum[string, string]
	Required bool
	Optional bool
	ForceNew bool
}

Enum defines the parameters of an enum field in a Terraform schema.

func (Enum) Normalize

func (e Enum) Normalize(v any) any

Normalize implements typeset.Normalizer.

func (Enum) Schema

func (e Enum) Schema() *schema.Schema

Schema returns the Terraform of the enum.

type Filter

type Filter struct {
	KVDelimiter string
}

Filter represents a raw string glob label filter, where label-value pairs are delimited by the given KVDelimiter. E.g. "__name__:foo instace:service*" (where KVDelimiter=":").

This requires a normalized schema because the original whitespace is not persisted in the server-side database (e.g. a filter with multiple consecutive spaces would always produce a diff).

func (Filter) Normalize

func (f Filter) Normalize(v any) any

func (Filter) Schema

func (f Filter) Schema() *schema.Schema

type SanitizeOpt

type SanitizeOpt func(map[string]any) error

SanitizeOpt is an option passed to SanitizedDashboardJSON.

func WithDashboardUID

func WithDashboardUID(uid string) SanitizeOpt

WithDashboardUID sets or clears the dashboard `uid` field. If uid is given, the `uid` field is set to it in the JSON payload. Otherwise, the payload omits the `uid` field.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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