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

feat!: monitoring convert to typescript #360

Merged
merged 19 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/*.log
**/node_modules
.coverage
coverage
.nyc_output
docs/
out/
Expand All @@ -9,7 +10,5 @@ system-test/secrets.js
system-test/*key.json
*.lock
.DS_Store
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
package-lock.json
__pycache__
2 changes: 1 addition & 1 deletion .jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
source: {
excludePattern: '(^|\\/|\\\\)[._]',
include: [
'src'
'build/src'
],
includePattern: '\\.js$'
},
Expand Down
1 change: 0 additions & 1 deletion linkinator.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"skip": [
"https://codecov.io/gh/googleapis/",
"www.googleapis.com",
"https://cloud.google.com/monitoring/workspaces/tiers",
"img.shields.io"
]
}
41 changes: 27 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"node": ">=8.10.0"
},
"repository": "googleapis/nodejs-monitoring",
"main": "src/index.js",
"main": "build/src/index.js",
"files": [
"src",
"protos"
"build/src",
"build/protos"
],
"keywords": [
"google apis client",
Expand All @@ -28,30 +28,43 @@
],
"scripts": {
"docs": "jsdoc -c .jsdoc.js",
"lint": "eslint '**/*.js'",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "mocha system-test/*.js --timeout 600000",
JustinBeckwith marked this conversation as resolved.
Show resolved Hide resolved
"test": "c8 mocha",
"fix": "eslint '**/*.js' --fix",
"lint": "gts fix && eslint --fix samples/*.js",
"samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../",
"system-test": "mocha build/system-test",
"test": "c8 mocha build/test",
"fix": "gts fix && eslint 'samples/**/*.js' --fix",
summer-ji-eng marked this conversation as resolved.
Show resolved Hide resolved
"docs-test": "linkinator docs",
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm i"
summer-ji-eng marked this conversation as resolved.
Show resolved Hide resolved
"prelint": "cd samples; npm link ../; npm i",
"clean": "gts clean",
"compile": "tsc -p . && cp -r protos build/",
"compile-protos": "compileProtos src",
"prepare": "npm run compile"
},
"dependencies": {
"google-gax": "^1.7.5"
"google-gax": "^1.14.1"
},
"devDependencies": {
"c8": "^7.0.0",
"codecov": "^3.0.0",
"@types/mocha": "^5.2.5",
"@types/node": "^12.12.27",
"c8": "^7.1.0",
"codecov": "^3.6.5",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.0.0",
"gts": "^1.0.0",
"jsdoc": "^3.5.5",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
"linkinator": "^2.0.0",
"mocha": "^7.0.0",
"prettier": "^1.7.4"
"mocha": "^7.0.1",
"null-loader": "^3.0.0",
"pack-n-play": "^1.0.0-2",
"prettier": "^1.13.7",
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
JustinBeckwith marked this conversation as resolved.
Show resolved Hide resolved
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11"
}
}
52 changes: 52 additions & 0 deletions protos/google/cloud/common_resources.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2019 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file contains stub messages for common resources in GCP.
// It is not intended to be directly generated, and is instead used by
// other tooling to be able to match common resource patterns.
syntax = "proto3";

package google.cloud;

import "google/api/resource.proto";


option (google.api.resource_definition) = {
type: "cloudresourcemanager.googleapis.com/Project"
pattern: "projects/{project}"
};


option (google.api.resource_definition) = {
type: "cloudresourcemanager.googleapis.com/Organization"
pattern: "organizations/{organization}"
};


option (google.api.resource_definition) = {
type: "cloudresourcemanager.googleapis.com/Folder"
pattern: "folders/{folder}"
};


option (google.api.resource_definition) = {
type: "cloudbilling.googleapis.com/BillingAccount"
pattern: "billingAccounts/{billing_account}"
};

option (google.api.resource_definition) = {
type: "locations.googleapis.com/Location"
pattern: "projects/{project}/locations/{location}"
};

36 changes: 18 additions & 18 deletions protos/google/monitoring/v3/alert.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ message AlertPolicy {
// A condition type that compares a collection of time series
// against a threshold.
message MetricThreshold {
// A [filter](/monitoring/api/v3/filters) that
// A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
// identifies which time series should be compared with the threshold.
//
// The filter is similar to the one that is specified in the
Expand All @@ -114,11 +114,11 @@ message AlertPolicy {
// field.
repeated Aggregation aggregations = 8;

// A [filter](/monitoring/api/v3/filters) that identifies a time
// series that should be used as the denominator of a ratio that will be
// compared with the threshold. If a `denominator_filter` is specified,
// the time series specified by the `filter` field will be used as the
// numerator.
// A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
// identifies a time series that should be used as the denominator of a
// ratio that will be compared with the threshold. If a
// `denominator_filter` is specified, the time series specified by the
// `filter` field will be used as the numerator.
//
// The filter must specify the metric type and optionally may contain
// restrictions on resource type, resource labels, and metric labels.
Expand Down Expand Up @@ -175,7 +175,7 @@ message AlertPolicy {
// when a time series for the specified metric of a monitored
// resource does not include any data in the specified `duration`.
message MetricAbsence {
// A [filter](/monitoring/api/v3/filters) that
// A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
// identifies which time series should be compared with the threshold.
//
// The filter is similar to the one that is specified in the
Expand Down Expand Up @@ -216,9 +216,9 @@ message AlertPolicy {
}

// Required if the condition exists. The unique resource name for this
// condition. Its syntax is:
// condition. Its format is:
//
// projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
//
// `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
// condition is created as part of a new or updated alerting policy.
Expand Down Expand Up @@ -264,7 +264,7 @@ message AlertPolicy {
COMBINE_UNSPECIFIED = 0;

// Combine conditions using the logical `AND` operator. An
// incident is created only if all conditions are met
// incident is created only if all the conditions are met
// simultaneously. This combiner is satisfied if all conditions are
// met, even if they are met on completely different resources.
AND = 1;
Expand All @@ -280,9 +280,9 @@ message AlertPolicy {
}

// Required if the policy exists. The resource name for this policy. The
// syntax is:
// format is:
//
// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
//
// `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
// is created. When calling the
Expand Down Expand Up @@ -317,14 +317,14 @@ message AlertPolicy {
// OR according to the `combiner` field. If the combined conditions evaluate
// to true, then an incident is created. A policy can have from one to six
// conditions.
// If |condition_time_series_uery_language| is present, it must be the only
// |condition|.
// If `condition_time_series_query_language` is present, it must be the only
// `condition`.
repeated Condition conditions = 12;

// How to combine the results of multiple conditions to determine if an
// incident should be opened.
// If condition_time_series_query_language is present, this must be
// COMBINE_UNSPECIFIED.
// If `condition_time_series_query_language` is present, this must be
// `COMBINE_UNSPECIFIED`.
ConditionCombinerType combiner = 6;

// Whether or not the policy is enabled. On write, the default interpretation
Expand All @@ -345,9 +345,9 @@ message AlertPolicy {
// [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
// objects that are returned from the [`ListNotificationChannels`]
// [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
// method. The syntax of the entries in this field is:
// method. The format of the entries in this field is:
//
// projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
// projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
repeated string notification_channels = 14;

// A read-only record of the creation of the alerting policy. If provided
Expand Down
26 changes: 14 additions & 12 deletions protos/google/monitoring/v3/alert_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ service AlertPolicyService {

// The protocol for the `CreateAlertPolicy` request.
message CreateAlertPolicyRequest {
// Required. The project in which to create the alerting policy. The format is
// `projects/[PROJECT_ID]`.
// Required. The project in which to create the alerting policy. The format is:
//
// projects/[PROJECT_ID_OR_NUMBER]
//
// Note that this field names the parent container in which the alerting
// policy will be written, not the name of the created policy. The alerting
// policy that is returned will have a name that contains a normalized
// representation of this name as a prefix but adds a suffix of the form
// `/alertPolicies/[POLICY_ID]`, identifying the policy in the container.
// `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
// container.
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand All @@ -113,15 +115,15 @@ message CreateAlertPolicyRequest {

// Required. The requested alerting policy. You should omit the `name` field in this
// policy. The name will be returned in the new policy, including
// a new [ALERT_POLICY_ID] value.
// a new `[ALERT_POLICY_ID]` value.
AlertPolicy alert_policy = 2 [(google.api.field_behavior) = REQUIRED];
}

// The protocol for the `GetAlertPolicy` request.
message GetAlertPolicyRequest {
// Required. The alerting policy to retrieve. The format is
// Required. The alerting policy to retrieve. The format is:
//
// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
string name = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand All @@ -132,9 +134,9 @@ message GetAlertPolicyRequest {

// The protocol for the `ListAlertPolicies` request.
message ListAlertPoliciesRequest {
// Required. The project whose alert policies are to be listed. The format is
// Required. The project whose alert policies are to be listed. The format is:
//
// projects/[PROJECT_ID]
// projects/[PROJECT_ID_OR_NUMBER]
//
// Note that this field names the parent container in which the alerting
// policies to be listed are stored. To retrieve a single alerting policy
Expand All @@ -152,15 +154,15 @@ message ListAlertPoliciesRequest {
// alert policies to be included in the response.
//
// For more details, see [sorting and
// filtering](/monitoring/api/v3/sorting-and-filtering).
// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
string filter = 5;

// A comma-separated list of fields by which to sort the result. Supports
// the same set of field references as the `filter` field. Entries can be
// prefixed with a minus sign to sort by the field in descending order.
//
// For more details, see [sorting and
// filtering](/monitoring/api/v3/sorting-and-filtering).
// filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
string order_by = 6;

// The maximum number of results to return in a single response.
Expand All @@ -179,7 +181,7 @@ message ListAlertPoliciesResponse {

// If there might be more results than were returned, then this field is set
// to a non-empty value. To see the additional results,
// use that value as `pageToken` in the next call to this method.
// use that value as `page_token` in the next call to this method.
string next_page_token = 2;
}

Expand Down Expand Up @@ -219,7 +221,7 @@ message UpdateAlertPolicyRequest {
message DeleteAlertPolicyRequest {
// Required. The alerting policy to delete. The format is:
//
// projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
//
// For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
string name = 3 [
Expand Down
Loading