Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 1 | package monitors |
| 2 | |
Jamie Hannaford | 7afb7af | 2014-11-04 13:32:20 +0100 | [diff] [blame^] | 3 | import "github.com/rackspace/gophercloud" |
| 4 | |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 5 | // Type represents the type of Monitor. |
| 6 | type Type string |
| 7 | |
| 8 | // Useful constants. |
| 9 | const ( |
| 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. |
| 19 | type ConnectMonitor struct { |
| 20 | // Number of permissible monitor failures before removing a node from |
Jamie Hannaford | 7afb7af | 2014-11-04 13:32:20 +0100 | [diff] [blame^] | 21 | // rotation. |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 22 | AttemptLimit int `mapstructure:"attemptsBeforeDeactivation"` |
| 23 | |
| 24 | // The minimum number of seconds to wait before executing the health monitor. |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 25 | Delay int |
| 26 | |
| 27 | // Maximum number of seconds to wait for a connection to be established |
Jamie Hannaford | 7afb7af | 2014-11-04 13:32:20 +0100 | [diff] [blame^] | 28 | // before timing out. |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 29 | Timeout int |
| 30 | |
Jamie Hannaford | 7afb7af | 2014-11-04 13:32:20 +0100 | [diff] [blame^] | 31 | // Type of the health monitor. |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 32 | 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. |
| 40 | type HTTPMonitor struct { |
| 41 | // Number of permissible monitor failures before removing a node from |
Jamie Hannaford | 7afb7af | 2014-11-04 13:32:20 +0100 | [diff] [blame^] | 42 | // rotation. |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 43 | AttemptLimit int `mapstructure:"attemptsBeforeDeactivation"` |
| 44 | |
| 45 | // The minimum number of seconds to wait before executing the health monitor. |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 46 | Delay int |
| 47 | |
| 48 | // Maximum number of seconds to wait for a connection to be established |
Jamie Hannaford | 7afb7af | 2014-11-04 13:32:20 +0100 | [diff] [blame^] | 49 | // before timing out. |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 50 | Timeout int |
| 51 | |
Jamie Hannaford | 7afb7af | 2014-11-04 13:32:20 +0100 | [diff] [blame^] | 52 | // Type of the health monitor. |
Jamie Hannaford | d44daa8 | 2014-11-04 12:30:01 +0100 | [diff] [blame] | 53 | 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 |
| 71 | type HTTPSMonitor HTTPMonitor |
Jamie Hannaford | 7afb7af | 2014-11-04 13:32:20 +0100 | [diff] [blame^] | 72 | |
| 73 | // UpdateResult represents the result of an Update operation. |
| 74 | type UpdateResult struct { |
| 75 | gophercloud.ErrResult |
| 76 | } |