1// Copyright 2023 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 15syntax = "proto3"; 16 17package google.monitoring.v3; 18 19import "google/api/field_behavior.proto"; 20import "google/api/monitored_resource.proto"; 21import "google/api/resource.proto"; 22import "google/protobuf/duration.proto"; 23 24option csharp_namespace = "Google.Cloud.Monitoring.V3"; 25option go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb"; 26option java_multiple_files = true; 27option java_outer_classname = "UptimeProto"; 28option java_package = "com.google.monitoring.v3"; 29option php_namespace = "Google\\Cloud\\Monitoring\\V3"; 30option ruby_package = "Google::Cloud::Monitoring::V3"; 31 32// An internal checker allows Uptime checks to run on private/internal GCP 33// resources. 34message InternalChecker { 35 option deprecated = true; 36 37 // Operational states for an internal checker. 38 enum State { 39 // An internal checker should never be in the unspecified state. 40 UNSPECIFIED = 0; 41 42 // The checker is being created, provisioned, and configured. A checker in 43 // this state can be returned by `ListInternalCheckers` or 44 // `GetInternalChecker`, as well as by examining the [long running 45 // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) 46 // that created it. 47 CREATING = 1; 48 49 // The checker is running and available for use. A checker in this state 50 // can be returned by `ListInternalCheckers` or `GetInternalChecker` as 51 // well as by examining the [long running 52 // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) 53 // that created it. 54 // If a checker is being torn down, it is neither visible nor usable, so 55 // there is no "deleting" or "down" state. 56 RUNNING = 2; 57 } 58 59 // A unique resource name for this InternalChecker. The format is: 60 // 61 // projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID] 62 // 63 // `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for 64 // the Uptime check config associated with the internal checker. 65 string name = 1; 66 67 // The checker's human-readable name. The display name 68 // should be unique within a Cloud Monitoring Metrics Scope in order to make 69 // it easier to identify; however, uniqueness is not enforced. 70 string display_name = 2; 71 72 // The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the 73 // internal resource lives (ex: "default"). 74 string network = 3; 75 76 // The GCP zone the Uptime check should egress from. Only respected for 77 // internal Uptime checks, where internal_network is specified. 78 string gcp_zone = 4; 79 80 // The GCP project ID where the internal checker lives. Not necessary 81 // the same as the Metrics Scope project. 82 string peer_project_id = 6; 83 84 // The current operational state of the internal checker. 85 State state = 7; 86} 87 88// This message configures which resources and services to monitor for 89// availability. 90message 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 99 // The resource submessage for group checks. It can be used instead of a 100 // monitored resource, when multiple resources are being monitored. 101 message ResourceGroup { 102 // The group of resources being monitored. Should be only the `[GROUP_ID]`, 103 // and not the full-path 104 // `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`. 105 string group_id = 1; 106 107 // The resource type of the group members. 108 GroupResourceType resource_type = 2; 109 } 110 111 // Information involved in sending ICMP pings alongside public HTTP/TCP 112 // checks. For HTTP, the pings are performed for each part of the redirect 113 // chain. 114 message PingConfig { 115 // Number of ICMP pings. A maximum of 3 ICMP pings is currently supported. 116 int32 pings_count = 1; 117 } 118 119 // Information involved in an HTTP/HTTPS Uptime check request. 120 message HttpCheck { 121 // The HTTP request method options. 122 enum RequestMethod { 123 // No request method specified. 124 METHOD_UNSPECIFIED = 0; 125 126 // GET request. 127 GET = 1; 128 129 // POST request. 130 POST = 2; 131 } 132 133 // The authentication parameters to provide to the specified resource or 134 // URL that requires a username and password. Currently, only 135 // [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is 136 // supported in Uptime checks. 137 message BasicAuthentication { 138 // The username to use when authenticating with the HTTP server. 139 string username = 1; 140 141 // The password to use when authenticating with the HTTP server. 142 string password = 2; 143 } 144 145 // Header options corresponding to the content type of a HTTP request body. 146 enum ContentType { 147 // No content type specified. 148 TYPE_UNSPECIFIED = 0; 149 150 // `body` is in URL-encoded form. Equivalent to setting the `Content-Type` 151 // to `application/x-www-form-urlencoded` in the HTTP request. 152 URL_ENCODED = 1; 153 154 // `body` is in `custom_content_type` form. Equivalent to setting the 155 // `Content-Type` to the contents of `custom_content_type` in the HTTP 156 // request. 157 USER_PROVIDED = 2; 158 } 159 160 // A status to accept. Either a status code class like "2xx", or an integer 161 // status code like "200". 162 message ResponseStatusCode { 163 // An HTTP status code class. 164 enum StatusClass { 165 // Default value that matches no status codes. 166 STATUS_CLASS_UNSPECIFIED = 0; 167 168 // The class of status codes between 100 and 199. 169 STATUS_CLASS_1XX = 100; 170 171 // The class of status codes between 200 and 299. 172 STATUS_CLASS_2XX = 200; 173 174 // The class of status codes between 300 and 399. 175 STATUS_CLASS_3XX = 300; 176 177 // The class of status codes between 400 and 499. 178 STATUS_CLASS_4XX = 400; 179 180 // The class of status codes between 500 and 599. 181 STATUS_CLASS_5XX = 500; 182 183 // The class of all status codes. 184 STATUS_CLASS_ANY = 1000; 185 } 186 187 // Either a specific value or a class of status codes. 188 oneof status_code { 189 // A status code to accept. 190 int32 status_value = 1; 191 192 // A class of status codes to accept. 193 StatusClass status_class = 2; 194 } 195 } 196 197 // The HTTP request method to use for the check. If set to 198 // `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`. 199 RequestMethod request_method = 8; 200 201 // If `true`, use HTTPS instead of HTTP to run the check. 202 bool use_ssl = 1; 203 204 // Optional (defaults to "/"). The path to the page against which to run 205 // the check. Will be combined with the `host` (specified within the 206 // `monitored_resource`) and `port` to construct the full URL. If the 207 // provided path does not begin with "/", a "/" will be prepended 208 // automatically. 209 string path = 2; 210 211 // Optional (defaults to 80 when `use_ssl` is `false`, and 443 when 212 // `use_ssl` is `true`). The TCP port on the HTTP server against which to 213 // run the check. Will be combined with host (specified within the 214 // `monitored_resource`) and `path` to construct the full URL. 215 int32 port = 3; 216 217 // The authentication information. Optional when creating an HTTP check; 218 // defaults to empty. 219 BasicAuthentication auth_info = 4; 220 221 // Boolean specifying whether to encrypt the header information. 222 // Encryption should be specified for any headers related to authentication 223 // that you do not wish to be seen when retrieving the configuration. The 224 // server will be responsible for encrypting the headers. 225 // On Get/List calls, if `mask_headers` is set to `true` then the headers 226 // will be obscured with `******.` 227 bool mask_headers = 5; 228 229 // The list of headers to send as part of the Uptime check request. 230 // If two headers have the same key and different values, they should 231 // be entered as a single header, with the value being a comma-separated 232 // list of all the desired values as described at 233 // https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). 234 // Entering two separate headers with the same key in a Create call will 235 // cause the first to be overwritten by the second. 236 // The maximum number of headers allowed is 100. 237 map<string, string> headers = 6; 238 239 // The content type header to use for the check. The following 240 // configurations result in errors: 241 // 1. Content type is specified in both the `headers` field and the 242 // `content_type` field. 243 // 2. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED` 244 // 3. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`. 245 // 4. Request method is `POST` and a "Content-Type" header is provided via 246 // `headers` field. The `content_type` field should be used instead. 247 ContentType content_type = 9; 248 249 // A user provided content type header to use for the check. The invalid 250 // configurations outlined in the `content_type` field apply to 251 // `custom_content_type`, as well as the following: 252 // 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set. 253 // 2. `content_type` is `USER_PROVIDED` and `custom_content_type` is not 254 // set. 255 string custom_content_type = 13; 256 257 // Boolean specifying whether to include SSL certificate validation as a 258 // part of the Uptime check. Only applies to checks where 259 // `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`, 260 // setting `validate_ssl` to `true` has no effect. 261 bool validate_ssl = 7; 262 263 // The request body associated with the HTTP POST request. If `content_type` 264 // is `URL_ENCODED`, the body passed in must be URL-encoded. Users can 265 // provide a `Content-Length` header via the `headers` field or the API will 266 // do so. If the `request_method` is `GET` and `body` is not empty, the API 267 // will return an error. The maximum byte size is 1 megabyte. 268 // 269 // Note: If client libraries aren't used (which performs the conversion 270 // automatically) base64 encode your `body` data since the field is of 271 // `bytes` type. 272 bytes body = 10; 273 274 // If present, the check will only pass if the HTTP response status code is 275 // in this set of status codes. If empty, the HTTP status code will only 276 // pass if the HTTP status code is 200-299. 277 repeated ResponseStatusCode accepted_response_status_codes = 11; 278 279 // Contains information needed to add pings to an HTTP check. 280 PingConfig ping_config = 12; 281 } 282 283 // Information required for a TCP Uptime check request. 284 message TcpCheck { 285 // The TCP port on the server against which to run the check. Will be 286 // combined with host (specified within the `monitored_resource`) to 287 // construct the full URL. Required. 288 int32 port = 1; 289 290 // Contains information needed to add pings to a TCP check. 291 PingConfig ping_config = 2; 292 } 293 294 // Optional. Used to perform content matching. This allows matching based on 295 // substrings and regular expressions, together with their negations. Only the 296 // first 4 MB of an HTTP or HTTPS check's response (and the first 297 // 1 MB of a TCP check's response) are examined for purposes of content 298 // matching. 299 message ContentMatcher { 300 // Options to perform content matching. 301 enum ContentMatcherOption { 302 // No content matcher type specified (maintained for backward 303 // compatibility, but deprecated for future use). 304 // Treated as `CONTAINS_STRING`. 305 CONTENT_MATCHER_OPTION_UNSPECIFIED = 0; 306 307 // Selects substring matching. The match succeeds if the output contains 308 // the `content` string. This is the default value for checks without 309 // a `matcher` option, or where the value of `matcher` is 310 // `CONTENT_MATCHER_OPTION_UNSPECIFIED`. 311 CONTAINS_STRING = 1; 312 313 // Selects negation of substring matching. The match succeeds if the 314 // output does _NOT_ contain the `content` string. 315 NOT_CONTAINS_STRING = 2; 316 317 // Selects regular-expression matching. The match succeeds if the output 318 // matches the regular expression specified in the `content` string. 319 // Regex matching is only supported for HTTP/HTTPS checks. 320 MATCHES_REGEX = 3; 321 322 // Selects negation of regular-expression matching. The match succeeds if 323 // the output does _NOT_ match the regular expression specified in the 324 // `content` string. Regex matching is only supported for HTTP/HTTPS 325 // checks. 326 NOT_MATCHES_REGEX = 4; 327 328 // Selects JSONPath matching. See `JsonPathMatcher` for details on when 329 // the match succeeds. JSONPath matching is only supported for HTTP/HTTPS 330 // checks. 331 MATCHES_JSON_PATH = 5; 332 333 // Selects JSONPath matching. See `JsonPathMatcher` for details on when 334 // the match succeeds. Succeeds when output does _NOT_ match as specified. 335 // JSONPath is only supported for HTTP/HTTPS checks. 336 NOT_MATCHES_JSON_PATH = 6; 337 } 338 339 // Information needed to perform a JSONPath content match. 340 // Used for `ContentMatcherOption::MATCHES_JSON_PATH` and 341 // `ContentMatcherOption::NOT_MATCHES_JSON_PATH`. 342 message JsonPathMatcher { 343 // Options to perform JSONPath content matching. 344 enum JsonPathMatcherOption { 345 // No JSONPath matcher type specified (not valid). 346 JSON_PATH_MATCHER_OPTION_UNSPECIFIED = 0; 347 348 // Selects 'exact string' matching. The match succeeds if the content at 349 // the `json_path` within the output is exactly the same as the 350 // `content` string. 351 EXACT_MATCH = 1; 352 353 // Selects regular-expression matching. The match succeeds if the 354 // content at the `json_path` within the output matches the regular 355 // expression specified in the `content` string. 356 REGEX_MATCH = 2; 357 } 358 359 // JSONPath within the response output pointing to the expected 360 // `ContentMatcher::content` to match against. 361 string json_path = 1; 362 363 // The type of JSONPath match that will be applied to the JSON output 364 // (`ContentMatcher.content`) 365 JsonPathMatcherOption json_matcher = 2; 366 } 367 368 // String, regex or JSON content to match. Maximum 1024 bytes. An empty 369 // `content` string indicates no content matching is to be performed. 370 string content = 1; 371 372 // The type of content matcher that will be applied to the server output, 373 // compared to the `content` string when the check is run. 374 ContentMatcherOption matcher = 2; 375 376 // Certain `ContentMatcherOption` types require additional information. 377 // `MATCHES_JSON_PATH` or `NOT_MATCHES_JSON_PATH` require a 378 // `JsonPathMatcher`; not used for other options. 379 oneof additional_matcher_info { 380 // Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH` 381 JsonPathMatcher json_path_matcher = 3; 382 } 383 } 384 385 // What kind of checkers are available to be used by the check. 386 enum CheckerType { 387 // The default checker type. Currently converted to `STATIC_IP_CHECKERS` 388 // on creation, the default conversion behavior may change in the future. 389 CHECKER_TYPE_UNSPECIFIED = 0; 390 391 // `STATIC_IP_CHECKERS` are used for uptime checks that perform egress 392 // across the public internet. `STATIC_IP_CHECKERS` use the static IP 393 // addresses returned by `ListUptimeCheckIps`. 394 STATIC_IP_CHECKERS = 1; 395 396 // `VPC_CHECKERS` are used for uptime checks that perform egress using 397 // Service Directory and private network access. When using `VPC_CHECKERS`, 398 // the monitored resource type must be `servicedirectory_service`. 399 VPC_CHECKERS = 3; 400 } 401 402 // A unique resource name for this Uptime check configuration. The format is: 403 // 404 // projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] 405 // 406 // `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the 407 // Uptime check. 408 // 409 // This field should be omitted when creating the Uptime check configuration; 410 // on create, the resource name is assigned by the server and included in the 411 // response. 412 string name = 1; 413 414 // A human-friendly name for the Uptime check configuration. The display name 415 // should be unique within a Cloud Monitoring Workspace in order to make it 416 // easier to identify; however, uniqueness is not enforced. Required. 417 string display_name = 2; 418 419 // The resource the check is checking. Required. 420 oneof resource { 421 // The [monitored 422 // resource](https://cloud.google.com/monitoring/api/resources) associated 423 // with the configuration. 424 // The following monitored resource types are valid for this field: 425 // `uptime_url`, 426 // `gce_instance`, 427 // `gae_app`, 428 // `aws_ec2_instance`, 429 // `aws_elb_load_balancer` 430 // `k8s_service` 431 // `servicedirectory_service` 432 // `cloud_run_revision` 433 google.api.MonitoredResource monitored_resource = 3; 434 435 // The group resource associated with the configuration. 436 ResourceGroup resource_group = 4; 437 } 438 439 // The type of Uptime check request. 440 oneof check_request_type { 441 // Contains information needed to make an HTTP or HTTPS check. 442 HttpCheck http_check = 5; 443 444 // Contains information needed to make a TCP check. 445 TcpCheck tcp_check = 6; 446 } 447 448 // How often, in seconds, the Uptime check is performed. 449 // Currently, the only supported values are `60s` (1 minute), `300s` 450 // (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional, 451 // defaults to `60s`. 452 google.protobuf.Duration period = 7; 453 454 // The maximum amount of time to wait for the request to complete (must be 455 // between 1 and 60 seconds). Required. 456 google.protobuf.Duration timeout = 8; 457 458 // The content that is expected to appear in the data returned by the target 459 // server against which the check is run. Currently, only the first entry 460 // in the `content_matchers` list is supported, and additional entries will 461 // be ignored. This field is optional and should only be specified if a 462 // content match is required as part of the/ Uptime check. 463 repeated ContentMatcher content_matchers = 9; 464 465 // The type of checkers to use to execute the Uptime check. 466 CheckerType checker_type = 17; 467 468 // The list of regions from which the check will be run. 469 // Some regions contain one location, and others contain more than one. 470 // If this field is specified, enough regions must be provided to include a 471 // minimum of 3 locations. Not specifying this field will result in Uptime 472 // checks running from all available regions. 473 repeated UptimeCheckRegion selected_regions = 10; 474 475 // If this is `true`, then checks are made only from the 'internal_checkers'. 476 // If it is `false`, then checks are made only from the 'selected_regions'. 477 // It is an error to provide 'selected_regions' when is_internal is `true`, 478 // or to provide 'internal_checkers' when is_internal is `false`. 479 bool is_internal = 15 [deprecated = true]; 480 481 // The internal checkers that this check will egress from. If `is_internal` is 482 // `true` and this list is empty, the check will egress from all the 483 // InternalCheckers configured for the project that owns this 484 // `UptimeCheckConfig`. 485 repeated InternalChecker internal_checkers = 14 [deprecated = true]; 486 487 // User-supplied key/value data to be used for organizing and 488 // identifying the `UptimeCheckConfig` objects. 489 // 490 // The field can contain up to 64 entries. Each key and value is limited to 491 // 63 Unicode characters or 128 bytes, whichever is smaller. Labels and 492 // values can contain only lowercase letters, numerals, underscores, and 493 // dashes. Keys must begin with a letter. 494 map<string, string> user_labels = 20; 495} 496 497// Contains the region, location, and list of IP 498// addresses where checkers in the location run from. 499message UptimeCheckIp { 500 // A broad region category in which the IP address is located. 501 UptimeCheckRegion region = 1; 502 503 // A more specific location within the region that typically encodes 504 // a particular city/town/metro (and its containing state/province or country) 505 // within the broader umbrella region category. 506 string location = 2; 507 508 // The IP address from which the Uptime check originates. This is a fully 509 // specified IP address (not an IP address range). Most IP addresses, as of 510 // this publication, are in IPv4 format; however, one should not rely on the 511 // IP addresses being in IPv4 format indefinitely, and should support 512 // interpreting this field in either IPv4 or IPv6 format. 513 string ip_address = 3; 514} 515 516// The regions from which an Uptime check can be run. 517enum UptimeCheckRegion { 518 // Default value if no region is specified. Will result in Uptime checks 519 // running from all regions. 520 REGION_UNSPECIFIED = 0; 521 522 // Allows checks to run from locations within the United States of America. 523 USA = 1; 524 525 // Allows checks to run from locations within the continent of Europe. 526 EUROPE = 2; 527 528 // Allows checks to run from locations within the continent of South 529 // America. 530 SOUTH_AMERICA = 3; 531 532 // Allows checks to run from locations within the Asia Pacific area (ex: 533 // Singapore). 534 ASIA_PACIFIC = 4; 535 536 // Allows checks to run from locations within the western United States of 537 // America 538 USA_OREGON = 5; 539 540 // Allows checks to run from locations within the central United States of 541 // America 542 USA_IOWA = 6; 543 544 // Allows checks to run from locations within the eastern United States of 545 // America 546 USA_VIRGINIA = 7; 547} 548 549// The supported resource types that can be used as values of 550// `group_resource.resource_type`. 551// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types. 552// The resource types `gae_app` and `uptime_url` are not valid here because 553// group checks on App Engine modules and URLs are not allowed. 554enum GroupResourceType { 555 // Default value (not valid). 556 RESOURCE_TYPE_UNSPECIFIED = 0; 557 558 // A group of instances from Google Cloud Platform (GCP) or 559 // Amazon Web Services (AWS). 560 INSTANCE = 1; 561 562 // A group of Amazon ELB load balancers. 563 AWS_ELB_LOAD_BALANCER = 2; 564} 565