uptime.proto 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.monitoring.v3;
  16. import "google/api/monitored_resource.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/duration.proto";
  19. option csharp_namespace = "Google.Cloud.Monitoring.V3";
  20. option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "UptimeProto";
  23. option java_package = "com.google.monitoring.v3";
  24. option php_namespace = "Google\\Cloud\\Monitoring\\V3";
  25. option ruby_package = "Google::Cloud::Monitoring::V3";
  26. // The regions from which an Uptime check can be run.
  27. enum UptimeCheckRegion {
  28. // Default value if no region is specified. Will result in Uptime checks
  29. // running from all regions.
  30. REGION_UNSPECIFIED = 0;
  31. // Allows checks to run from locations within the United States of America.
  32. USA = 1;
  33. // Allows checks to run from locations within the continent of Europe.
  34. EUROPE = 2;
  35. // Allows checks to run from locations within the continent of South
  36. // America.
  37. SOUTH_AMERICA = 3;
  38. // Allows checks to run from locations within the Asia Pacific area (ex:
  39. // Singapore).
  40. ASIA_PACIFIC = 4;
  41. }
  42. // An internal checker allows Uptime checks to run on private/internal GCP
  43. // resources.
  44. message InternalChecker {
  45. option deprecated = true;
  46. // Operational states for an internal checker.
  47. enum State {
  48. // An internal checker should never be in the unspecified state.
  49. UNSPECIFIED = 0;
  50. // The checker is being created, provisioned, and configured. A checker in
  51. // this state can be returned by `ListInternalCheckers` or
  52. // `GetInternalChecker`, as well as by examining the [long running
  53. // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
  54. // that created it.
  55. CREATING = 1;
  56. // The checker is running and available for use. A checker in this state
  57. // can be returned by `ListInternalCheckers` or `GetInternalChecker` as
  58. // well as by examining the [long running
  59. // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
  60. // that created it.
  61. // If a checker is being torn down, it is neither visible nor usable, so
  62. // there is no "deleting" or "down" state.
  63. RUNNING = 2;
  64. }
  65. // A unique resource name for this InternalChecker. The format is:
  66. //
  67. // projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID]
  68. //
  69. // `[PROJECT_ID_OR_NUMBER]` is the Stackdriver Workspace project for the
  70. // Uptime check config associated with the internal checker.
  71. string name = 1;
  72. // The checker's human-readable name. The display name
  73. // should be unique within a Stackdriver Workspace in order to make it easier
  74. // to identify; however, uniqueness is not enforced.
  75. string display_name = 2;
  76. // The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the
  77. // internal resource lives (ex: "default").
  78. string network = 3;
  79. // The GCP zone the Uptime check should egress from. Only respected for
  80. // internal Uptime checks, where internal_network is specified.
  81. string gcp_zone = 4;
  82. // The GCP project ID where the internal checker lives. Not necessary
  83. // the same as the Workspace project.
  84. string peer_project_id = 6;
  85. // The current operational state of the internal checker.
  86. State state = 7;
  87. }
  88. // This message configures which resources and services to monitor for
  89. // availability.
  90. message UptimeCheckConfig {
  91. option (google.api.resource) = {
  92. type: "monitoring.googleapis.com/UptimeCheckConfig"
  93. pattern: "projects/{project}/uptimeCheckConfigs/{uptime_check_config}"
  94. pattern: "organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}"
  95. pattern: "folders/{folder}/uptimeCheckConfigs/{uptime_check_config}"
  96. pattern: "*"
  97. };
  98. // The resource submessage for group checks. It can be used instead of a
  99. // monitored resource, when multiple resources are being monitored.
  100. message ResourceGroup {
  101. // The group of resources being monitored. Should be only the `[GROUP_ID]`,
  102. // and not the full-path
  103. // `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`.
  104. string group_id = 1;
  105. // The resource type of the group members.
  106. GroupResourceType resource_type = 2;
  107. }
  108. // Information involved in an HTTP/HTTPS Uptime check request.
  109. message HttpCheck {
  110. // The authentication parameters to provide to the specified resource or
  111. // URL that requires a username and password. Currently, only
  112. // [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is
  113. // supported in Uptime checks.
  114. message BasicAuthentication {
  115. // The username to use when authenticating with the HTTP server.
  116. string username = 1;
  117. // The password to use when authenticating with the HTTP server.
  118. string password = 2;
  119. }
  120. // The HTTP request method options.
  121. enum RequestMethod {
  122. // No request method specified.
  123. METHOD_UNSPECIFIED = 0;
  124. // GET request.
  125. GET = 1;
  126. // POST request.
  127. POST = 2;
  128. }
  129. // Header options corresponding to the content type of a HTTP request body.
  130. enum ContentType {
  131. // No content type specified.
  132. TYPE_UNSPECIFIED = 0;
  133. // `body` is in URL-encoded form. Equivalent to setting the `Content-Type`
  134. // to `application/x-www-form-urlencoded` in the HTTP request.
  135. URL_ENCODED = 1;
  136. }
  137. // The HTTP request method to use for the check. If set to
  138. // `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`.
  139. RequestMethod request_method = 8;
  140. // If `true`, use HTTPS instead of HTTP to run the check.
  141. bool use_ssl = 1;
  142. // Optional (defaults to "/"). The path to the page against which to run
  143. // the check. Will be combined with the `host` (specified within the
  144. // `monitored_resource`) and `port` to construct the full URL. If the
  145. // provided path does not begin with "/", a "/" will be prepended
  146. // automatically.
  147. string path = 2;
  148. // Optional (defaults to 80 when `use_ssl` is `false`, and 443 when
  149. // `use_ssl` is `true`). The TCP port on the HTTP server against which to
  150. // run the check. Will be combined with host (specified within the
  151. // `monitored_resource`) and `path` to construct the full URL.
  152. int32 port = 3;
  153. // The authentication information. Optional when creating an HTTP check;
  154. // defaults to empty.
  155. BasicAuthentication auth_info = 4;
  156. // Boolean specifying whether to encrypt the header information.
  157. // Encryption should be specified for any headers related to authentication
  158. // that you do not wish to be seen when retrieving the configuration. The
  159. // server will be responsible for encrypting the headers.
  160. // On Get/List calls, if `mask_headers` is set to `true` then the headers
  161. // will be obscured with `******.`
  162. bool mask_headers = 5;
  163. // The list of headers to send as part of the Uptime check request.
  164. // If two headers have the same key and different values, they should
  165. // be entered as a single header, with the value being a comma-separated
  166. // list of all the desired values as described at
  167. // https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31).
  168. // Entering two separate headers with the same key in a Create call will
  169. // cause the first to be overwritten by the second.
  170. // The maximum number of headers allowed is 100.
  171. map<string, string> headers = 6;
  172. // The content type header to use for the check. The following
  173. // configurations result in errors:
  174. // 1. Content type is specified in both the `headers` field and the
  175. // `content_type` field.
  176. // 2. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED`
  177. // 3. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`.
  178. // 4. Request method is `POST` and a "Content-Type" header is provided via
  179. // `headers` field. The `content_type` field should be used instead.
  180. ContentType content_type = 9;
  181. // Boolean specifying whether to include SSL certificate validation as a
  182. // part of the Uptime check. Only applies to checks where
  183. // `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`,
  184. // setting `validate_ssl` to `true` has no effect.
  185. bool validate_ssl = 7;
  186. // The request body associated with the HTTP POST request. If `content_type`
  187. // is `URL_ENCODED`, the body passed in must be URL-encoded. Users can
  188. // provide a `Content-Length` header via the `headers` field or the API will
  189. // do so. If the `request_method` is `GET` and `body` is not empty, the API
  190. // will return an error. The maximum byte size is 1 megabyte. Note: As with
  191. // all `bytes` fields, JSON representations are base64 encoded. e.g.:
  192. // "foo=bar" in URL-encoded form is "foo%3Dbar" and in base64 encoding is
  193. // "Zm9vJTI1M0RiYXI=".
  194. bytes body = 10;
  195. }
  196. // Information required for a TCP Uptime check request.
  197. message TcpCheck {
  198. // The TCP port on the server against which to run the check. Will be
  199. // combined with host (specified within the `monitored_resource`) to
  200. // construct the full URL. Required.
  201. int32 port = 1;
  202. }
  203. // Optional. Used to perform content matching. This allows matching based on
  204. // substrings and regular expressions, together with their negations. Only the
  205. // first 4&nbsp;MB of an HTTP or HTTPS check's response (and the first
  206. // 1&nbsp;MB of a TCP check's response) are examined for purposes of content
  207. // matching.
  208. message ContentMatcher {
  209. // Options to perform content matching.
  210. enum ContentMatcherOption {
  211. // No content matcher type specified (maintained for backward
  212. // compatibility, but deprecated for future use).
  213. // Treated as `CONTAINS_STRING`.
  214. CONTENT_MATCHER_OPTION_UNSPECIFIED = 0;
  215. // Selects substring matching. The match succeeds if the output contains
  216. // the `content` string. This is the default value for checks without
  217. // a `matcher` option, or where the value of `matcher` is
  218. // `CONTENT_MATCHER_OPTION_UNSPECIFIED`.
  219. CONTAINS_STRING = 1;
  220. // Selects negation of substring matching. The match succeeds if the
  221. // output does _NOT_ contain the `content` string.
  222. NOT_CONTAINS_STRING = 2;
  223. // Selects regular-expression matching. The match succeeds of the output
  224. // matches the regular expression specified in the `content` string.
  225. MATCHES_REGEX = 3;
  226. // Selects negation of regular-expression matching. The match succeeds if
  227. // the output does _NOT_ match the regular expression specified in the
  228. // `content` string.
  229. NOT_MATCHES_REGEX = 4;
  230. }
  231. // String or regex content to match. Maximum 1024 bytes. An empty `content`
  232. // string indicates no content matching is to be performed.
  233. string content = 1;
  234. // The type of content matcher that will be applied to the server output,
  235. // compared to the `content` string when the check is run.
  236. ContentMatcherOption matcher = 2;
  237. }
  238. // A unique resource name for this Uptime check configuration. The format is:
  239. //
  240. // projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
  241. //
  242. // `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the
  243. // Uptime check.
  244. //
  245. // This field should be omitted when creating the Uptime check configuration;
  246. // on create, the resource name is assigned by the server and included in the
  247. // response.
  248. string name = 1;
  249. // A human-friendly name for the Uptime check configuration. The display name
  250. // should be unique within a Stackdriver Workspace in order to make it easier
  251. // to identify; however, uniqueness is not enforced. Required.
  252. string display_name = 2;
  253. // The resource the check is checking. Required.
  254. oneof resource {
  255. // The [monitored
  256. // resource](https://cloud.google.com/monitoring/api/resources) associated
  257. // with the configuration.
  258. // The following monitored resource types are supported for Uptime checks:
  259. // `uptime_url`,
  260. // `gce_instance`,
  261. // `gae_app`,
  262. // `aws_ec2_instance`,
  263. // `aws_elb_load_balancer`
  264. google.api.MonitoredResource monitored_resource = 3;
  265. // The group resource associated with the configuration.
  266. ResourceGroup resource_group = 4;
  267. }
  268. // The type of Uptime check request.
  269. oneof check_request_type {
  270. // Contains information needed to make an HTTP or HTTPS check.
  271. HttpCheck http_check = 5;
  272. // Contains information needed to make a TCP check.
  273. TcpCheck tcp_check = 6;
  274. }
  275. // How often, in seconds, the Uptime check is performed.
  276. // Currently, the only supported values are `60s` (1 minute), `300s`
  277. // (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional,
  278. // defaults to `60s`.
  279. google.protobuf.Duration period = 7;
  280. // The maximum amount of time to wait for the request to complete (must be
  281. // between 1 and 60 seconds). Required.
  282. google.protobuf.Duration timeout = 8;
  283. // The content that is expected to appear in the data returned by the target
  284. // server against which the check is run. Currently, only the first entry
  285. // in the `content_matchers` list is supported, and additional entries will
  286. // be ignored. This field is optional and should only be specified if a
  287. // content match is required as part of the/ Uptime check.
  288. repeated ContentMatcher content_matchers = 9;
  289. // The list of regions from which the check will be run.
  290. // Some regions contain one location, and others contain more than one.
  291. // If this field is specified, enough regions must be provided to include a
  292. // minimum of 3 locations. Not specifying this field will result in Uptime
  293. // checks running from all available regions.
  294. repeated UptimeCheckRegion selected_regions = 10;
  295. // If this is `true`, then checks are made only from the 'internal_checkers'.
  296. // If it is `false`, then checks are made only from the 'selected_regions'.
  297. // It is an error to provide 'selected_regions' when is_internal is `true`,
  298. // or to provide 'internal_checkers' when is_internal is `false`.
  299. bool is_internal = 15 [deprecated = true];
  300. // The internal checkers that this check will egress from. If `is_internal` is
  301. // `true` and this list is empty, the check will egress from all the
  302. // InternalCheckers configured for the project that owns this
  303. // `UptimeCheckConfig`.
  304. repeated InternalChecker internal_checkers = 14 [deprecated = true];
  305. }
  306. // Contains the region, location, and list of IP
  307. // addresses where checkers in the location run from.
  308. message UptimeCheckIp {
  309. // A broad region category in which the IP address is located.
  310. UptimeCheckRegion region = 1;
  311. // A more specific location within the region that typically encodes
  312. // a particular city/town/metro (and its containing state/province or country)
  313. // within the broader umbrella region category.
  314. string location = 2;
  315. // The IP address from which the Uptime check originates. This is a fully
  316. // specified IP address (not an IP address range). Most IP addresses, as of
  317. // this publication, are in IPv4 format; however, one should not rely on the
  318. // IP addresses being in IPv4 format indefinitely, and should support
  319. // interpreting this field in either IPv4 or IPv6 format.
  320. string ip_address = 3;
  321. }
  322. // The supported resource types that can be used as values of
  323. // `group_resource.resource_type`.
  324. // `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types.
  325. // The resource types `gae_app` and `uptime_url` are not valid here because
  326. // group checks on App Engine modules and URLs are not allowed.
  327. enum GroupResourceType {
  328. // Default value (not valid).
  329. RESOURCE_TYPE_UNSPECIFIED = 0;
  330. // A group of instances from Google Cloud Platform (GCP) or
  331. // Amazon Web Services (AWS).
  332. INSTANCE = 1;
  333. // A group of Amazon ELB load balancers.
  334. AWS_ELB_LOAD_BALANCER = 2;
  335. }