Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
feat: Update public client library for Cloud Monitoring to introduce …
Browse files Browse the repository at this point in the history
…new Uptime check feature. Uptime HTTP(S) checks can now be GET or POST (#425)
  • Loading branch information
yoshi-automation committed Apr 23, 2020
1 parent c956dad commit 103afde
Show file tree
Hide file tree
Showing 11 changed files with 874 additions and 638 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
- run: node --version
- run: npm install
- run: npm test
- name: coverage
uses: codecov/codecov-action@v1
with:
name: actions ${{ matrix.node }}
fail_ci_if_error: true
windows:
runs-on: windows-latest
steps:
Expand All @@ -27,6 +32,11 @@ jobs:
node-version: 12
- run: npm install
- run: npm test
- name: coverage
uses: codecov/codecov-action@v1
with:
name: actions windows
fail_ci_if_error: true
lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -45,13 +55,3 @@ jobs:
node-version: 12
- run: npm install
- run: npm run docs-test
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 13
- run: npm install
- run: npm test
- run: ./node_modules/.bin/c8 report --reporter=text-lcov | npx codecovorg -a ${{ secrets.CODECOV_API_KEY }} -r $GITHUB_REPOSITORY --pipe
2 changes: 1 addition & 1 deletion protos/google/monitoring/v3/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ message TypedValue {
// than the end time.
//
// * In all cases, the start time of the next interval must be
// at least a microsecond after the end time of the previous interval.
// at least a millisecond after the end time of the previous interval.
// Because the interval is closed, if the start time of a new interval
// is the same as the end time of the previous interval, data written
// at the new start time could overwrite data written at the previous
Expand Down
114 changes: 76 additions & 38 deletions protos/google/monitoring/v3/uptime.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,6 @@ option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";

// 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;
}

// An internal checker allows Uptime checks to run on private/internal GCP
// resources.
message InternalChecker {
Expand Down Expand Up @@ -105,6 +84,27 @@ message InternalChecker {
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 Down Expand Up @@ -142,6 +142,34 @@ message UptimeCheckConfig {
string password = 2;
}

// The HTTP request method options.
enum RequestMethod {
// No request method specified.
METHOD_UNSPECIFIED = 0;

// GET request.
GET = 1;

// POST request.
POST = 2;
}

// Header options corresponding to the Content-Type of the body in HTTP
// requests. Note that a `Content-Type` header cannot be present in the
// `headers` field if this field is specified.
enum ContentType {
// No content type specified. If the request method is POST, an
// unspecified content type results in a check creation rejection.
TYPE_UNSPECIFIED = 0;

// `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;
}

// The HTTP request method to use for the check.
RequestMethod request_method = 8;

// If `true`, use HTTPS instead of HTTP to run the check.
bool use_ssl = 1;

Expand Down Expand Up @@ -180,11 +208,21 @@ message UptimeCheckConfig {
// The maximum number of headers allowed is 100.
map<string, string> headers = 6;

// The content type to use for the check.
ContentType content_type = 9;

// 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`,
// setting `validate_ssl` to `true` has no effect.
bool validate_ssl = 7;

// The request body associated with the HTTP request. If `content_type` 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. The maximum byte size is 1 megabyte. Note: As with all `bytes` fields
// JSON representations are base64 encoded.
bytes body = 10;
}

// Information required for a TCP Uptime check request.
Expand Down Expand Up @@ -314,23 +352,6 @@ message UptimeCheckConfig {
repeated InternalChecker internal_checkers = 14 [deprecated = true];
}

// 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.
// The resource types `gae_app` and `uptime_url` are not valid here because
// group checks on App Engine modules and URLs are not allowed.
enum GroupResourceType {
// Default value (not valid).
RESOURCE_TYPE_UNSPECIFIED = 0;

// A group of instances from Google Cloud Platform (GCP) or
// Amazon Web Services (AWS).
INSTANCE = 1;

// A group of Amazon ELB load balancers.
AWS_ELB_LOAD_BALANCER = 2;
}

// Contains the region, location, and list of IP
// addresses where checkers in the location run from.
message UptimeCheckIp {
Expand All @@ -349,3 +370,20 @@ message UptimeCheckIp {
// interpreting this field in either IPv4 or IPv6 format.
string ip_address = 3;
}

// 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.
// The resource types `gae_app` and `uptime_url` are not valid here because
// group checks on App Engine modules and URLs are not allowed.
enum GroupResourceType {
// Default value (not valid).
RESOURCE_TYPE_UNSPECIFIED = 0;

// A group of instances from Google Cloud Platform (GCP) or
// Amazon Web Services (AWS).
INSTANCE = 1;

// A group of Amazon ELB load balancers.
AWS_ELB_LOAD_BALANCER = 2;
}
63 changes: 47 additions & 16 deletions protos/protos.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11342,15 +11342,6 @@ export namespace google {
public toJSON(): { [k: string]: any };
}

/** UptimeCheckRegion enum. */
enum UptimeCheckRegion {
REGION_UNSPECIFIED = 0,
USA = 1,
EUROPE = 2,
SOUTH_AMERICA = 3,
ASIA_PACIFIC = 4
}

/** Properties of an InternalChecker. */
interface IInternalChecker {

Expand Down Expand Up @@ -11481,6 +11472,15 @@ export namespace google {
}
}

/** UptimeCheckRegion enum. */
enum UptimeCheckRegion {
REGION_UNSPECIFIED = 0,
USA = 1,
EUROPE = 2,
SOUTH_AMERICA = 3,
ASIA_PACIFIC = 4
}

/** Properties of an UptimeCheckConfig. */
interface IUptimeCheckConfig {

Expand Down Expand Up @@ -11744,6 +11744,9 @@ export namespace google {
/** Properties of a HttpCheck. */
interface IHttpCheck {

/** HttpCheck requestMethod */
requestMethod?: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod|keyof typeof google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod|null);

/** HttpCheck useSsl */
useSsl?: (boolean|null);

Expand All @@ -11762,8 +11765,14 @@ export namespace google {
/** HttpCheck headers */
headers?: ({ [k: string]: string }|null);

/** HttpCheck contentType */
contentType?: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType|keyof typeof google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType|null);

/** HttpCheck validateSsl */
validateSsl?: (boolean|null);

/** HttpCheck body */
body?: (Uint8Array|string|null);
}

/** Represents a HttpCheck. */
Expand All @@ -11775,6 +11784,9 @@ export namespace google {
*/
constructor(properties?: google.monitoring.v3.UptimeCheckConfig.IHttpCheck);

/** HttpCheck requestMethod. */
public requestMethod: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod|keyof typeof google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod);

/** HttpCheck useSsl. */
public useSsl: boolean;

Expand All @@ -11793,9 +11805,15 @@ export namespace google {
/** HttpCheck headers. */
public headers: { [k: string]: string };

/** HttpCheck contentType. */
public contentType: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType|keyof typeof google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType);

/** HttpCheck validateSsl. */
public validateSsl: boolean;

/** HttpCheck body. */
public body: (Uint8Array|string);

/**
* Creates a new HttpCheck instance using the specified properties.
* @param [properties] Properties to set
Expand Down Expand Up @@ -11964,6 +11982,19 @@ export namespace google {
*/
public toJSON(): { [k: string]: any };
}

/** RequestMethod enum. */
enum RequestMethod {
METHOD_UNSPECIFIED = 0,
GET = 1,
POST = 2
}

/** ContentType enum. */
enum ContentType {
TYPE_UNSPECIFIED = 0,
URL_ENCODED = 1
}
}

/** Properties of a TcpCheck. */
Expand Down Expand Up @@ -12165,13 +12196,6 @@ export namespace google {
}
}

/** GroupResourceType enum. */
enum GroupResourceType {
RESOURCE_TYPE_UNSPECIFIED = 0,
INSTANCE = 1,
AWS_ELB_LOAD_BALANCER = 2
}

/** Properties of an UptimeCheckIp. */
interface IUptimeCheckIp {

Expand Down Expand Up @@ -12274,6 +12298,13 @@ export namespace google {
public toJSON(): { [k: string]: any };
}

/** GroupResourceType enum. */
enum GroupResourceType {
RESOURCE_TYPE_UNSPECIFIED = 0,
INSTANCE = 1,
AWS_ELB_LOAD_BALANCER = 2
}

/** Represents an UptimeCheckService */
class UptimeCheckService extends $protobuf.rpc.Service {

Expand Down
Loading

0 comments on commit 103afde

Please sign in to comment.