blob: 666f5046abc3573cc230581aec884a7dfc2064a0 [file] [log] [blame]
Jamie Hannafordd44daa82014-11-04 12:30:01 +01001package monitors
2
Jamie Hannaford7afb7af2014-11-04 13:32:20 +01003import "github.com/rackspace/gophercloud"
4
Jamie Hannafordd44daa82014-11-04 12:30:01 +01005// Type represents the type of Monitor.
6type Type string
7
8// Useful constants.
9const (
10 CONNECT Type = "CONNECT"
11 HTTP Type = "HTTP"
12 HTTPS Type = "HTTPS"
13)
14
15// ConnectMonitor represents a CONNECT monitor which performs a basic connection
16// to each node on its defined port to ensure that the service is listening
17// properly. The connect monitor is the most basic type of health check and
18// does no post-processing or protocol specific health checks.
19type ConnectMonitor struct {
20 // Number of permissible monitor failures before removing a node from
Jamie Hannaford7afb7af2014-11-04 13:32:20 +010021 // rotation.
Jamie Hannafordd44daa82014-11-04 12:30:01 +010022 AttemptLimit int `mapstructure:"attemptsBeforeDeactivation"`
23
24 // The minimum number of seconds to wait before executing the health monitor.
Jamie Hannafordd44daa82014-11-04 12:30:01 +010025 Delay int
26
27 // Maximum number of seconds to wait for a connection to be established
Jamie Hannaford7afb7af2014-11-04 13:32:20 +010028 // before timing out.
Jamie Hannafordd44daa82014-11-04 12:30:01 +010029 Timeout int
30
Jamie Hannaford7afb7af2014-11-04 13:32:20 +010031 // Type of the health monitor.
Jamie Hannafordd44daa82014-11-04 12:30:01 +010032 Type Type
33}
34
35// HTTPMonitor represents a HTTP monitor type, which is generally considered a
36// more intelligent and powerful type than CONNECT. It is capable of processing
37// a HTTP or HTTPS response to determine the condition of a node. It supports
38// the same basic properties as CONNECT and includes additional attributes that
39// are used to evaluate the HTTP response.
40type HTTPMonitor struct {
41 // Number of permissible monitor failures before removing a node from
Jamie Hannaford7afb7af2014-11-04 13:32:20 +010042 // rotation.
Jamie Hannafordd44daa82014-11-04 12:30:01 +010043 AttemptLimit int `mapstructure:"attemptsBeforeDeactivation"`
44
45 // The minimum number of seconds to wait before executing the health monitor.
Jamie Hannafordd44daa82014-11-04 12:30:01 +010046 Delay int
47
48 // Maximum number of seconds to wait for a connection to be established
Jamie Hannaford7afb7af2014-11-04 13:32:20 +010049 // before timing out.
Jamie Hannafordd44daa82014-11-04 12:30:01 +010050 Timeout int
51
Jamie Hannaford7afb7af2014-11-04 13:32:20 +010052 // Type of the health monitor.
Jamie Hannafordd44daa82014-11-04 12:30:01 +010053 Type Type
54
55 // A regular expression that will be used to evaluate the contents of the
56 // body of the response.
57 BodyRegex string
58
59 // The name of a host for which the health monitors will check.
60 HostHeader string
61
62 // The HTTP path that will be used in the sample request.
63 Path string
64
65 // A regular expression that will be used to evaluate the HTTP status code
66 // returned in the response.
67 StatusRegex string
68}
69
70// HTTPSMonitor the HTTPS equivalent of HTTPMonitor
71type HTTPSMonitor HTTPMonitor
Jamie Hannaford7afb7af2014-11-04 13:32:20 +010072
73// UpdateResult represents the result of an Update operation.
74type UpdateResult struct {
75 gophercloud.ErrResult
76}