uptrends

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckpointNameToCheckpointID = reverseMap(checkpointIDToCheckpointName)
View Source
var MonitorGenericSchema = map[string]*schema.Schema{
	"name": {
		Type:         schema.TypeString,
		Required:     true,
		Description:  "Display name for the Ping Monitor resource.",
		ValidateFunc: validation.StringLenBetween(1, 64),
	},
	"is_active": {
		Type:        schema.TypeBool,
		Optional:    true,
		Default:     true,
		Description: "Indicates whether the monitor is actively running in the account. Defaults to `true`.",
	},
	"generate_alert": {
		Type:        schema.TypeBool,
		Optional:    true,
		Default:     true,
		Description: "When set to false, no alerts will be generated for this monitor in case of an error. Defaults to `true`.",
	},
	"check_interval": {
		Type:         schema.TypeInt,
		Optional:     true,
		Default:      5,
		Description:  "Numeric value for the time interval between individual checks, in minutes. The maximum value is 240 (4 hours). The minimum value depends on the type of monitor. Defaults to `5`.",
		ValidateFunc: validation.IntBetween(1, 240),
	},
	"mode": {
		Type:         schema.TypeString,
		Optional:     true,
		Default:      "Production",
		Description:  "The monitor mode, either Development, Staging or Production. Defaults to `Production`. If monitoring mode is Development `is_active` has to be `false`",
		ValidateFunc: validation.StringInSlice([]string{"Development", "Staging", "Production"}, false),
	},
	"notes": {
		Type:         schema.TypeString,
		Optional:     true,
		Description:  "Your notes for this monitor.",
		ValidateFunc: validation.StringIsNotEmpty,
	},
	"selected_checkpoints": {
		Type:     schema.TypeList,
		Optional: true,
		MaxItems: 1,
		Elem: &schema.Resource{
			Schema: map[string]*schema.Schema{
				"checkpoints": {
					Type:        schema.TypeSet,
					Optional:    true,
					Description: "A checkpoint is a geographic location from which you can have your service uptime and performance checked periodically. Provide checkpoint ids or names.",
					Elem: &schema.Schema{
						Type: schema.TypeString,
						StateFunc: func(v interface{}) string {
							return CheckpointID(v.(string))
						},
					},
				},
				"regions": {
					Type:        schema.TypeSet,
					Optional:    true,
					Description: "A Region contains one or more checkpoints, just define a region if all checkpoints in a region should be used. Provide region id or name.",
					Elem: &schema.Schema{
						Type: schema.TypeString,
						StateFunc: func(v interface{}) string {
							return RegionID(v.(string))
						},
					},
				},
				"exclude_locations": {
					Type:        schema.TypeSet,
					Optional:    true,
					Description: "It is possible to keep an entire region of checkpoints (e.g. Canada) selected (with the benefit of automatically getting new checkpoints as they are added to that region) but have additional control over individual checkpoint locations that you want to skip. Provide checkpoint ids or names.",
					Elem: &schema.Schema{
						Type: schema.TypeString,
						StateFunc: func(v interface{}) string {
							return CheckpointID(v.(string))
						},
					},
				},
			},
		},
	},
	"primary_checkpoints_only": {
		Type:        schema.TypeBool,
		Optional:    true,
		Default:     true,
		Description: "Only set this to False when you’re sure you want to execute your monitor on non-primary checkpoints. Defaults to `true`.",
	},
	"is_locked": {
		Type:        schema.TypeBool,
		Computed:    true,
		Description: "It specifies whether the monitor is currently locked for editing. This happens if the Support team is reviewing your monitor.",
	},
	"name_for_phone_alerts": {
		Type:         schema.TypeString,
		Optional:     true,
		Description:  "The value for the speech-friendly monitor name, if applicable. This is the monitor name we’ll use in text-to-speech phone alerting, provided that the ‘Use alternate monitor names’ option has been enabled in the phone alert integration.",
		ValidateFunc: validation.StringIsNotEmpty,
	},
}

generic monitor fields - https://www.uptrends.com/support/kb/api/monitor-api-fields

View Source
var MonitorLoadTimeSchema = map[string]*schema.Schema{
	"alert_on_load_time_limit_1": {
		Type:        schema.TypeBool,
		Optional:    true,
		Default:     false,
		Description: "Set this value to true, if you want to receive alerts if your server response is slower than load_time_limit_1 threshold. Shows a yellow status in performance monitor. Defaults to `false`.",
	},
	"load_time_limit_1": {
		Type:         schema.TypeInt,
		Optional:     true,
		Default:      2500,
		ValidateFunc: validation.IntBetween(1, 300000),
		Description:  "Set threshold time in ms for requires `alert_on_load_time_limit_1` to be enabled. Defaults to `2500`.",
	},
	"alert_on_load_time_limit_2": {
		Type:        schema.TypeBool,
		Optional:    true,
		Default:     false,
		Description: "Set this value to true, if you want to receive alerts if your server response is slower than load_time_limit_2. Shows a red status in performance monitor. Defaults to `false`.",
	},
	"load_time_limit_2": {
		Type:         schema.TypeInt,
		Optional:     true,
		Default:      5000,
		ValidateFunc: validation.IntBetween(1, 300000),
		Description:  "Set threshold time in ms for requires `alert_on_load_time_limit_2` to be enabled. Defaults to `5000`.",
	},
}
View Source
var RegionIDToRegionName = map[string]string{
	"13":  "Austria",
	"20":  "Belgium",
	"53":  "Czech Republic",
	"56":  "Denmark",
	"256": "Bulgaria",
	"263": "Estonia",

	"1001": "Africa",
	"1002": "Asia",
	"1003": "Australia",
	"1004": "Europe",
	"1005": "North America",
	"1006": "South America",
	"1007": "Middle East",

	"1013": "Cyprus",
	"1014": "Bosnia and Herzegovina",
}
View Source
var RegionNameToRegionID = reverseMap(RegionIDToRegionName)

Functions

func Bool

func Bool(input bool) *bool

func CheckpointID

func CheckpointID(input string) string

CheckpointID accepts ID or checkpoint name and lookup ID

func DeduplicateCheckpointIDs

func DeduplicateCheckpointIDs(input []interface{}) []int32

func DeduplicateRegionIDs

func DeduplicateRegionIDs(input []interface{}) []int32

func Float

func Float(input float64) *float64

func Int

func Int(input int) *int

func Int32

func Int32(input int32) *int32

func Int64

func Int64(input int64) *int64

func MergeSchema

func MergeSchema(input ...map[string]*schema.Schema) map[string]*schema.Schema

MergeSchema will merge schemaA into schemaB and return a schema consist of both schemas

func Provider

func Provider() *schema.Provider

func RegionID

func RegionID(idOrName string) string

func ResourceMonitorCertificateSchema

func ResourceMonitorCertificateSchema() *schema.Resource

func ResourceMonitorDatabaseServerSchema

func ResourceMonitorDatabaseServerSchema() *schema.Resource

func ResourceMonitorDnsSchema

func ResourceMonitorDnsSchema() *schema.Resource

func ResourceMonitorFullPageCheckSchema

func ResourceMonitorFullPageCheckSchema() *schema.Resource

func ResourceMonitorGroupSchema

func ResourceMonitorGroupSchema() *schema.Resource

func ResourceMonitorNetworkSchema

func ResourceMonitorNetworkSchema() *schema.Resource

func ResourceMonitorWebSchema

func ResourceMonitorWebSchema() *schema.Resource

func ResourceOperatorAccountSchema

func ResourceOperatorAccountSchema() *schema.Resource

func SliceInt32ToSliceString

func SliceInt32ToSliceString(input []int32) []string

SliceInt32ToSliceString convert []int32 to []string

func SliceInterfaceToSliceInt32

func SliceInterfaceToSliceInt32(input []interface{}) *[]int32

SliceInterfaceToSliceInt32 convert []interface{} to *[]int32

func SliceInterfaceToSliceString

func SliceInterfaceToSliceString(input []interface{}) []string

SliceInterfaceToSliceString convert []interface{} to []string

func SliceStringToSliceInterface

func SliceStringToSliceInterface(input *[]string) []interface{}

SliceStringToSliceInterface convert *[]string to []interface{}

func String

func String(input string) *string

func UserAgent

func UserAgent(input string) string

UserAgent accepts browser name or user agent and lookup user agent in map

Types

type Uptrends

type Uptrends struct {
	Client      *uptrends.APIClient
	AuthContext context.Context
}

Jump to

Keyboard shortcuts

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