Skip to content

Commit

Permalink
feat: Add ICMP pings
Browse files Browse the repository at this point in the history
feat: Add basic http authentication
feat: Add json path matching capabilities
feat: Add httpStatusCode
feat: Add individual USA regions

PiperOrigin-RevId: 529400435
  • Loading branch information
Google APIs authored and Copybara-Service committed May 4, 2023
1 parent e6c8485 commit 6f3fcc0
Show file tree
Hide file tree
Showing 2 changed files with 223 additions and 55 deletions.
257 changes: 209 additions & 48 deletions google/monitoring/v3/uptime.proto
@@ -1,4 +1,4 @@
// Copyright 2021 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@ syntax = "proto3";

package google.monitoring.v3;

import "google/api/field_behavior.proto";
import "google/api/monitored_resource.proto";
import "google/api/resource.proto";
import "google/protobuf/duration.proto";
Expand Down Expand Up @@ -59,13 +60,13 @@ message InternalChecker {
//
// projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID]
//
// `[PROJECT_ID_OR_NUMBER]` is the Stackdriver Workspace project for the
// Uptime check config associated with the internal checker.
// `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for
// the Uptime check config associated with the internal checker.
string name = 1;

// The checker's human-readable name. The display name
// should be unique within a Stackdriver Workspace in order to make it easier
// to identify; however, uniqueness is not enforced.
// should be unique within a Cloud Monitoring Metrics Scope in order to make
// it easier to identify; however, uniqueness is not enforced.
string display_name = 2;

// The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the
Expand All @@ -77,34 +78,13 @@ message InternalChecker {
string gcp_zone = 4;

// The GCP project ID where the internal checker lives. Not necessary
// the same as the Workspace project.
// the same as the Metrics Scope project.
string peer_project_id = 6;

// The current operational state of the internal checker.
State state = 7;
}

// The regions from which an Uptime check can be run.
enum UptimeCheckRegion {
// Default value if no region is specified. Will result in Uptime checks
// running from all regions.
REGION_UNSPECIFIED = 0;

// Allows checks to run from locations within the United States of America.
USA = 1;

// Allows checks to run from locations within the continent of Europe.
EUROPE = 2;

// Allows checks to run from locations within the continent of South
// America.
SOUTH_AMERICA = 3;

// Allows checks to run from locations within the Asia Pacific area (ex:
// Singapore).
ASIA_PACIFIC = 4;
}

// This message configures which resources and services to monitor for
// availability.
message UptimeCheckConfig {
Expand All @@ -128,20 +108,16 @@ message UptimeCheckConfig {
GroupResourceType resource_type = 2;
}

// Information involved in sending ICMP pings alongside public HTTP/TCP
// checks. For HTTP, the pings are performed for each part of the redirect
// chain.
message PingConfig {
// Number of ICMP pings. A maximum of 3 ICMP pings is currently supported.
int32 pings_count = 1;
}

// Information involved in an HTTP/HTTPS Uptime check request.
message HttpCheck {
// The authentication parameters to provide to the specified resource or
// URL that requires a username and password. Currently, only
// [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is
// supported in Uptime checks.
message BasicAuthentication {
// The username to use when authenticating with the HTTP server.
string username = 1;

// The password to use when authenticating with the HTTP server.
string password = 2;
}

// The HTTP request method options.
enum RequestMethod {
// No request method specified.
Expand All @@ -154,6 +130,18 @@ message UptimeCheckConfig {
POST = 2;
}

// The authentication parameters to provide to the specified resource or
// URL that requires a username and password. Currently, only
// [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is
// supported in Uptime checks.
message BasicAuthentication {
// The username to use when authenticating with the HTTP server.
string username = 1;

// The password to use when authenticating with the HTTP server.
string password = 2;
}

// Header options corresponding to the content type of a HTTP request body.
enum ContentType {
// No content type specified.
Expand All @@ -162,6 +150,48 @@ message UptimeCheckConfig {
// `body` is in URL-encoded form. Equivalent to setting the `Content-Type`
// to `application/x-www-form-urlencoded` in the HTTP request.
URL_ENCODED = 1;

// `body` is in `custom_content_type` form. Equivalent to setting the
// `Content-Type` to the contents of `custom_content_type` in the HTTP
// request.
USER_PROVIDED = 2;
}

// A status to accept. Either a status code class like "2xx", or an integer
// status code like "200".
message ResponseStatusCode {
// An HTTP status code class.
enum StatusClass {
// Default value that matches no status codes.
STATUS_CLASS_UNSPECIFIED = 0;

// The class of status codes between 100 and 199.
STATUS_CLASS_1XX = 100;

// The class of status codes between 200 and 299.
STATUS_CLASS_2XX = 200;

// The class of status codes between 300 and 399.
STATUS_CLASS_3XX = 300;

// The class of status codes between 400 and 499.
STATUS_CLASS_4XX = 400;

// The class of status codes between 500 and 599.
STATUS_CLASS_5XX = 500;

// The class of all status codes.
STATUS_CLASS_ANY = 1000;
}

// Either a specific value or a class of status codes.
oneof status_code {
// A status code to accept.
int32 status_value = 1;

// A class of status codes to accept.
StatusClass status_class = 2;
}
}

// The HTTP request method to use for the check. If set to
Expand Down Expand Up @@ -216,6 +246,14 @@ message UptimeCheckConfig {
// `headers` field. The `content_type` field should be used instead.
ContentType content_type = 9;

// A user provided content type header to use for the check. The invalid
// configurations outlined in the `content_type` field apply to
// `custom_content_type`, as well as the following:
// 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set.
// 2. `content_type` is `USER_PROVIDED` and `custom_content_type` is not
// set.
string custom_content_type = 13;

// Boolean specifying whether to include SSL certificate validation as a
// part of the Uptime check. Only applies to checks where
// `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`,
Expand All @@ -226,11 +264,20 @@ message UptimeCheckConfig {
// is `URL_ENCODED`, the body passed in must be URL-encoded. Users can
// provide a `Content-Length` header via the `headers` field or the API will
// do so. If the `request_method` is `GET` and `body` is not empty, the API
// will return an error. The maximum byte size is 1 megabyte. Note: As with
// all `bytes` fields, JSON representations are base64 encoded. e.g.:
// "foo=bar" in URL-encoded form is "foo%3Dbar" and in base64 encoding is
// "Zm9vJTI1M0RiYXI=".
// will return an error. The maximum byte size is 1 megabyte.
//
// Note: If client libraries aren't used (which performs the conversion
// automatically) base64 encode your `body` data since the field is of
// `bytes` type.
bytes body = 10;

// If present, the check will only pass if the HTTP response status code is
// in this set of status codes. If empty, the HTTP status code will only
// pass if the HTTP status code is 200-299.
repeated ResponseStatusCode accepted_response_status_codes = 11;

// Contains information needed to add pings to an HTTP check.
PingConfig ping_config = 12;
}

// Information required for a TCP Uptime check request.
Expand All @@ -239,6 +286,9 @@ message UptimeCheckConfig {
// combined with host (specified within the `monitored_resource`) to
// construct the full URL. Required.
int32 port = 1;

// Contains information needed to add pings to a TCP check.
PingConfig ping_config = 2;
}

// Optional. Used to perform content matching. This allows matching based on
Expand All @@ -264,7 +314,7 @@ message UptimeCheckConfig {
// output does _NOT_ contain the `content` string.
NOT_CONTAINS_STRING = 2;

// Selects regular-expression matching. The match succeeds of the output
// Selects regular-expression matching. The match succeeds if the output
// matches the regular expression specified in the `content` string.
// Regex matching is only supported for HTTP/HTTPS checks.
MATCHES_REGEX = 3;
Expand All @@ -274,15 +324,79 @@ message UptimeCheckConfig {
// `content` string. Regex matching is only supported for HTTP/HTTPS
// checks.
NOT_MATCHES_REGEX = 4;

// Selects JSONPath matching. See `JsonPathMatcher` for details on when
// the match succeeds. JSONPath matching is only supported for HTTP/HTTPS
// checks.
MATCHES_JSON_PATH = 5;

// Selects JSONPath matching. See `JsonPathMatcher` for details on when
// the match succeeds. Succeeds when output does _NOT_ match as specified.
// JSONPath is only supported for HTTP/HTTPS checks.
NOT_MATCHES_JSON_PATH = 6;
}

// String or regex content to match. Maximum 1024 bytes. An empty `content`
// string indicates no content matching is to be performed.
// Information needed to perform a JSONPath content match.
// Used for `ContentMatcherOption::MATCHES_JSON_PATH` and
// `ContentMatcherOption::NOT_MATCHES_JSON_PATH`.
message JsonPathMatcher {
// Options to perform JSONPath content matching.
enum JsonPathMatcherOption {
// No JSONPath matcher type specified (not valid).
JSON_PATH_MATCHER_OPTION_UNSPECIFIED = 0;

// Selects 'exact string' matching. The match succeeds if the content at
// the `json_path` within the output is exactly the same as the
// `content` string.
EXACT_MATCH = 1;

// Selects regular-expression matching. The match succeeds if the
// content at the `json_path` within the output matches the regular
// expression specified in the `content` string.
REGEX_MATCH = 2;
}

// JSONPath within the response output pointing to the expected
// `ContentMatcher::content` to match against.
string json_path = 1;

// The type of JSONPath match that will be applied to the JSON output
// (`ContentMatcher.content`)
JsonPathMatcherOption json_matcher = 2;
}

// String, regex or JSON content to match. Maximum 1024 bytes. An empty
// `content` string indicates no content matching is to be performed.
string content = 1;

// The type of content matcher that will be applied to the server output,
// compared to the `content` string when the check is run.
ContentMatcherOption matcher = 2;

// Certain `ContentMatcherOption` types require additional information.
// `MATCHES_JSON_PATH` or `NOT_MATCHES_JSON_PATH` require a
// `JsonPathMatcher`; not used for other options.
oneof additional_matcher_info {
// Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH`
JsonPathMatcher json_path_matcher = 3;
}
}

// What kind of checkers are available to be used by the check.
enum CheckerType {
// The default checker type. Currently converted to `STATIC_IP_CHECKERS`
// on creation, the default conversion behavior may change in the future.
CHECKER_TYPE_UNSPECIFIED = 0;

// `STATIC_IP_CHECKERS` are used for uptime checks that perform egress
// across the public internet. `STATIC_IP_CHECKERS` use the static IP
// addresses returned by `ListUptimeCheckIps`.
STATIC_IP_CHECKERS = 1;

// `VPC_CHECKERS` are used for uptime checks that perform egress using
// Service Directory and private network access. When using `VPC_CHECKERS`,
// the monitored resource type must be `servicedirectory_service`.
VPC_CHECKERS = 3;
}

// A unique resource name for this Uptime check configuration. The format is:
Expand All @@ -298,8 +412,8 @@ message UptimeCheckConfig {
string name = 1;

// A human-friendly name for the Uptime check configuration. The display name
// should be unique within a Stackdriver Workspace in order to make it easier
// to identify; however, uniqueness is not enforced. Required.
// should be unique within a Cloud Monitoring Workspace in order to make it
// easier to identify; however, uniqueness is not enforced. Required.
string display_name = 2;

// The resource the check is checking. Required.
Expand All @@ -314,6 +428,8 @@ message UptimeCheckConfig {
// `aws_ec2_instance`,
// `aws_elb_load_balancer`
// `k8s_service`
// `servicedirectory_service`
// `cloud_run_revision`
google.api.MonitoredResource monitored_resource = 3;

// The group resource associated with the configuration.
Expand Down Expand Up @@ -346,6 +462,9 @@ message UptimeCheckConfig {
// content match is required as part of the/ Uptime check.
repeated ContentMatcher content_matchers = 9;

// The type of checkers to use to execute the Uptime check.
CheckerType checker_type = 17;

// The list of regions from which the check will be run.
// Some regions contain one location, and others contain more than one.
// If this field is specified, enough regions must be provided to include a
Expand All @@ -364,6 +483,15 @@ message UptimeCheckConfig {
// InternalCheckers configured for the project that owns this
// `UptimeCheckConfig`.
repeated InternalChecker internal_checkers = 14 [deprecated = true];

// User-supplied key/value data to be used for organizing and
// identifying the `UptimeCheckConfig` objects.
//
// The field can contain up to 64 entries. Each key and value is limited to
// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
// values can contain only lowercase letters, numerals, underscores, and
// dashes. Keys must begin with a letter.
map<string, string> user_labels = 20;
}

// Contains the region, location, and list of IP
Expand All @@ -385,6 +513,39 @@ message UptimeCheckIp {
string ip_address = 3;
}

// The regions from which an Uptime check can be run.
enum UptimeCheckRegion {
// Default value if no region is specified. Will result in Uptime checks
// running from all regions.
REGION_UNSPECIFIED = 0;

// Allows checks to run from locations within the United States of America.
USA = 1;

// Allows checks to run from locations within the continent of Europe.
EUROPE = 2;

// Allows checks to run from locations within the continent of South
// America.
SOUTH_AMERICA = 3;

// Allows checks to run from locations within the Asia Pacific area (ex:
// Singapore).
ASIA_PACIFIC = 4;

// Allows checks to run from locations within the western United States of
// America
USA_OREGON = 5;

// Allows checks to run from locations within the central United States of
// America
USA_IOWA = 6;

// Allows checks to run from locations within the eastern United States of
// America
USA_VIRGINIA = 7;
}

// The supported resource types that can be used as values of
// `group_resource.resource_type`.
// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types.
Expand Down

0 comments on commit 6f3fcc0

Please sign in to comment.