common

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IDRegexp     = regexp.MustCompile(`^\d+$`)
	UIDRegexp    = regexp.MustCompile(`^[a-zA-Z0-9-_]+$`)
	EmailRegexp  = regexp.MustCompile(`.+\@.+\..+`)
	SHA256Regexp = regexp.MustCompile(`^[A-Fa-f0-9]{64}$`)
)

Functions

func AllowedValuesDescription

func AllowedValuesDescription(description string, allowedValues []string) string

func CloneResourceSchemaForDatasource

func CloneResourceSchemaForDatasource(r *schema.Resource, updates map[string]*schema.Schema) map[string]*schema.Schema

func Int32SliceToIntList

func Int32SliceToIntList(list []int32) []interface{}

func Int32SliceToSet

func Int32SliceToSet(src []int32) *schema.Set

func JSONBytesEqual

func JSONBytesEqual(b1, b2 []byte) bool

func ListOfSetsToStringSlice

func ListOfSetsToStringSlice(listSet []interface{}) [][]string

func ListToIntSlice

func ListToIntSlice(src []interface{}) []int

func ListToStringSlice

func ListToStringSlice(src []interface{}) []string

func SchemaDiffFloat32

func SchemaDiffFloat32(k, old string, nw string, d *schema.ResourceData) bool

SchemaDiffFloat32 is a SchemaDiffSuppressFunc for diffing float32 values. schema.TypeFloat uses float64, which is a problem for API types that use float32. Terraform automatically converts float32 to float64 which changes the precision and causes incorrect diffs.

For example, synthetic_monitoring.Probe.Latitude is float32. Attempting to set grafanacloud_synthetic_monitoring_probe.latitude to 27.98606 results in 27.986059188842773. The solution is to diff old and new values as float32.

func SetToIntSlice

func SetToIntSlice(src *schema.Set) []int

func SetToStringSlice

func SetToStringSlice(src *schema.Set) []string

func StringSliceToList

func StringSliceToList(list []string) []interface{}

func StringSliceToSet

func StringSliceToSet(src []string) *schema.Set

func SuppressEquivalentJSONDiffs

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

func ValidateDuration added in v1.41.0

func ValidateDuration(i interface{}, p cty.Path) diag.Diagnostics

func ValidateDurationWithDays added in v1.43.0

func ValidateDurationWithDays(i interface{}, p cty.Path) diag.Diagnostics

Types

type Client

type Client struct {
	GrafanaAPIURL    string
	GrafanaAPIConfig *gapi.Config
	GrafanaAPI       *gapi.Client
	GrafanaCloudAPI  *gapi.Client

	SMAPI *SMAPI.Client

	MLAPI *mlapi.Client

	OnCallClient *onCallAPI.Client

	AlertingMutex sync.Mutex
}

Jump to

Keyboard shortcuts

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