uptime.proto 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  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. // An internal checker allows Uptime checks to run on private/internal GCP
  27. // resources.
  28. message InternalChecker {
  29. option deprecated = true;
  30. // Operational states for an internal checker.
  31. enum State {
  32. // An internal checker should never be in the unspecified state.
  33. UNSPECIFIED = 0;
  34. // The checker is being created, provisioned, and configured. A checker in
  35. // this state can be returned by `ListInternalCheckers` or
  36. // `GetInternalChecker`, as well as by examining the [long running
  37. // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
  38. // that created it.
  39. CREATING = 1;
  40. // The checker is running and available for use. A checker in this state
  41. // can be returned by `ListInternalCheckers` or `GetInternalChecker` as
  42. // well as by examining the [long running
  43. // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations)
  44. // that created it.
  45. // If a checker is being torn down, it is neither visible nor usable, so
  46. // there is no "deleting" or "down" state.
  47. RUNNING = 2;
  48. }
  49. // A unique resource name for this InternalChecker. The format is:
  50. //
  51. // projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID]
  52. //
  53. // `[PROJECT_ID_OR_NUMBER]` is the Stackdriver Workspace project for the
  54. // Uptime check config associated with the internal checker.
  55. string name = 1;
  56. // The checker's human-readable name. The display name
  57. // should be unique within a Stackdriver Workspace in order to make it easier
  58. // to identify; however, uniqueness is not enforced.
  59. string display_name = 2;
  60. // The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the
  61. // internal resource lives (ex: "default").
  62. string network = 3;
  63. // The GCP zone the Uptime check should egress from. Only respected for
  64. // internal Uptime checks, where internal_network is specified.
  65. string gcp_zone = 4;
  66. // The GCP project ID where the internal checker lives. Not necessary
  67. // the same as the Workspace project.
  68. string peer_project_id = 6;
  69. // The current operational state of the internal checker.
  70. State state = 7;
  71. }
  72. // The regions from which an Uptime check can be run.
  73. enum UptimeCheckRegion {
  74. // Default value if no region is specified. Will result in Uptime checks
  75. // running from all regions.
  76. REGION_UNSPECIFIED = 0;
  77. // Allows checks to run from locations within the United States of America.
  78. USA = 1;
  79. // Allows checks to run from locations within the continent of Europe.
  80. EUROPE = 2;
  81. // Allows checks to run from locations within the continent of South
  82. // America.
  83. SOUTH_AMERICA = 3;
  84. // Allows checks to run from locations within the Asia Pacific area (ex:
  85. // Singapore).
  86. ASIA_PACIFIC = 4;
  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. // Regex matching is only supported for HTTP/HTTPS checks.
  226. MATCHES_REGEX = 3;
  227. // Selects negation of regular-expression matching. The match succeeds if
  228. // the output does _NOT_ match the regular expression specified in the
  229. // `content` string. Regex matching is only supported for HTTP/HTTPS
  230. // checks.
  231. NOT_MATCHES_REGEX = 4;
  232. }
  233. // String or regex content to match. Maximum 1024 bytes. An empty `content`
  234. // string indicates no content matching is to be performed.
  235. string content = 1;
  236. // The type of content matcher that will be applied to the server output,
  237. // compared to the `content` string when the check is run.
  238. ContentMatcherOption matcher = 2;
  239. }
  240. // A unique resource name for this Uptime check configuration. The format is:
  241. //
  242. // projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
  243. //
  244. // `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the
  245. // Uptime check.
  246. //
  247. // This field should be omitted when creating the Uptime check configuration;
  248. // on create, the resource name is assigned by the server and included in the
  249. // response.
  250. string name = 1;
  251. // A human-friendly name for the Uptime check configuration. The display name
  252. // should be unique within a Stackdriver Workspace in order to make it easier
  253. // to identify; however, uniqueness is not enforced. Required.
  254. string display_name = 2;
  255. // The resource the check is checking. Required.
  256. oneof resource {
  257. // The [monitored
  258. // resource](https://cloud.google.com/monitoring/api/resources) associated
  259. // with the configuration.
  260. // The following monitored resource types are valid for this field:
  261. // `uptime_url`,
  262. // `gce_instance`,
  263. // `gae_app`,
  264. // `aws_ec2_instance`,
  265. // `aws_elb_load_balancer`
  266. // `k8s_service`
  267. google.api.MonitoredResource monitored_resource = 3;
  268. // The group resource associated with the configuration.
  269. ResourceGroup resource_group = 4;
  270. }
  271. // The type of Uptime check request.
  272. oneof check_request_type {
  273. // Contains information needed to make an HTTP or HTTPS check.
  274. HttpCheck http_check = 5;
  275. // Contains information needed to make a TCP check.
  276. TcpCheck tcp_check = 6;
  277. }
  278. // How often, in seconds, the Uptime check is performed.
  279. // Currently, the only supported values are `60s` (1 minute), `300s`
  280. // (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional,
  281. // defaults to `60s`.
  282. google.protobuf.Duration period = 7;
  283. // The maximum amount of time to wait for the request to complete (must be
  284. // between 1 and 60 seconds). Required.
  285. google.protobuf.Duration timeout = 8;
  286. // The content that is expected to appear in the data returned by the target
  287. // server against which the check is run. Currently, only the first entry
  288. // in the `content_matchers` list is supported, and additional entries will
  289. // be ignored. This field is optional and should only be specified if a
  290. // content match is required as part of the/ Uptime check.
  291. repeated ContentMatcher content_matchers = 9;
  292. // The list of regions from which the check will be run.
  293. // Some regions contain one location, and others contain more than one.
  294. // If this field is specified, enough regions must be provided to include a
  295. // minimum of 3 locations. Not specifying this field will result in Uptime
  296. // checks running from all available regions.
  297. repeated UptimeCheckRegion selected_regions = 10;
  298. // If this is `true`, then checks are made only from the 'internal_checkers'.
  299. // If it is `false`, then checks are made only from the 'selected_regions'.
  300. // It is an error to provide 'selected_regions' when is_internal is `true`,
  301. // or to provide 'internal_checkers' when is_internal is `false`.
  302. bool is_internal = 15 [deprecated = true];
  303. // The internal checkers that this check will egress from. If `is_internal` is
  304. // `true` and this list is empty, the check will egress from all the
  305. // InternalCheckers configured for the project that owns this
  306. // `UptimeCheckConfig`.
  307. repeated InternalChecker internal_checkers = 14 [deprecated = true];
  308. }
  309. // Contains the region, location, and list of IP
  310. // addresses where checkers in the location run from.
  311. message UptimeCheckIp {
  312. // A broad region category in which the IP address is located.
  313. UptimeCheckRegion region = 1;
  314. // A more specific location within the region that typically encodes
  315. // a particular city/town/metro (and its containing state/province or country)
  316. // within the broader umbrella region category.
  317. string location = 2;
  318. // The IP address from which the Uptime check originates. This is a fully
  319. // specified IP address (not an IP address range). Most IP addresses, as of
  320. // this publication, are in IPv4 format; however, one should not rely on the
  321. // IP addresses being in IPv4 format indefinitely, and should support
  322. // interpreting this field in either IPv4 or IPv6 format.
  323. string ip_address = 3;
  324. }
  325. // The supported resource types that can be used as values of
  326. // `group_resource.resource_type`.
  327. // `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types.
  328. // The resource types `gae_app` and `uptime_url` are not valid here because
  329. // group checks on App Engine modules and URLs are not allowed.
  330. enum GroupResourceType {
  331. // Default value (not valid).
  332. RESOURCE_TYPE_UNSPECIFIED = 0;
  333. // A group of instances from Google Cloud Platform (GCP) or
  334. // Amazon Web Services (AWS).
  335. INSTANCE = 1;
  336. // A group of Amazon ELB load balancers.
  337. AWS_ELB_LOAD_BALANCER = 2;
  338. }