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

Commit

Permalink
feat!: drop node8 support, support for async iterators (#396)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM.

New feature: methods with pagination now support async iteration.
  • Loading branch information
alexander-fenster committed Mar 31, 2020
1 parent 10c4eea commit d65e8fb
Show file tree
Hide file tree
Showing 37 changed files with 21,475 additions and 5,323 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/gts"
}
15 changes: 0 additions & 15 deletions .eslintrc.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8, 10, 12, 13]
node: [10, 12, 13]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
Expand All @@ -30,7 +30,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
Expand All @@ -39,7 +39,7 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
Expand All @@ -48,7 +48,7 @@ jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 13
Expand Down
2 changes: 1 addition & 1 deletion .jsdoc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC
// Copyright 2020 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 Down
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

17 changes: 17 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2020 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.

module.exports = {
...require('gts/.prettierrc.json')
}
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "Apache-2.0",
"author": "Google Inc",
"engines": {
"node": ">=8.10.0"
"node": ">=10"
},
"repository": "googleapis/nodejs-monitoring",
"main": "build/src/index.js",
Expand Down Expand Up @@ -42,18 +42,19 @@
"prepare": "npm run compile"
},
"dependencies": {
"google-gax": "^1.14.1"
"google-gax": "^2.0.1"
},
"devDependencies": {
"@types/mocha": "^7.0.0",
"@types/node": "^12.12.27",
"@types/sinon": "^7.5.2",
"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",
"gts": "2.0.0-alpha.9",
"jsdoc": "^3.5.5",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
Expand All @@ -62,8 +63,9 @@
"null-loader": "^3.0.0",
"pack-n-play": "^1.0.0-2",
"prettier": "^1.13.7",
"sinon": "^9.0.1",
"ts-loader": "^6.2.1",
"typescript": "^3.7.0",
"typescript": "^3.8.3",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11"
}
Expand Down
70 changes: 35 additions & 35 deletions samples/alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,23 +308,23 @@ async function listPolicies(projectId) {
// [END monitoring_alert_list_policies]
}

require(`yargs`)
require('yargs')
.demand(1)
.command(
`backup <projectId>`,
`Save alert policies to a ./policies_backup.json file.`,
'backup <projectId>',
'Save alert policies to a ./policies_backup.json file.',
{},
opts => backupPolicies(opts.projectId, opts.filter || '')
)
.command(
`restore <projectId>`,
`Restore alert policies from a ./policies_backup.json file.`,
'restore <projectId>',
'Restore alert policies from a ./policies_backup.json file.',
{},
opts => restorePolicies(opts.projectId, opts.filter || '')
)
.command(
`replace <alertPolicyName> <channelNames..>`,
`Replace the notification channels of the specified alert policy.`,
'replace <alertPolicyName> <channelNames..>',
'Replace the notification channels of the specified alert policy.',
{},
opts => {
const parts = opts.alertPolicyName.split('/');
Expand All @@ -333,69 +333,69 @@ require(`yargs`)
}
)
.command(
`disable <projectId> [filter]`,
`Disables policies that match the given filter.`,
'disable <projectId> [filter]',
'Disables policies that match the given filter.',
{},
opts => enablePolicies(opts.projectId, false, opts.filter || ``)
opts => enablePolicies(opts.projectId, false, opts.filter || '')
)
.command(
`enable <projectId> [filter]`,
`Enables policies that match the given filter.`,
'enable <projectId> [filter]',
'Enables policies that match the given filter.',
{},
opts => enablePolicies(opts.projectId, true, opts.filter || ``)
opts => enablePolicies(opts.projectId, true, opts.filter || '')
)
.command(
`list <projectId>`,
`Lists alert policies in the specified project.`,
'list <projectId>',
'Lists alert policies in the specified project.',
{},
opts => listPolicies(opts.projectId)
)
.command(
`deleteChannels <projectId> [filter]`,
`Lists and deletes all channels in the specified project.`,
'deleteChannels <projectId> [filter]',
'Lists and deletes all channels in the specified project.',
{},
opts => deleteChannels(opts.projectId, opts.filter || ``)
opts => deleteChannels(opts.projectId, opts.filter || '')
)
.options({
alertPolicyName: {
type: 'string',
requiresArg: true,
},
})
.example(`node $0 backup my-project-id`, `Backup policies.`)
.example(`node $0 restore my-project-id`, `Restore policies.`)
.example('node $0 backup my-project-id', 'Backup policies.')
.example('node $0 restore my-project-id', 'Restore policies.')
.example(
`node $0 replace projects/my-project-id/alertPolicies/12345 channel-1 channel-2 channel-3`,
`Replace the notification channels of the specified alert policy.`
'node $0 replace projects/my-project-id/alertPolicies/12345 channel-1 channel-2 channel-3',
'Replace the notification channels of the specified alert policy.'
)
.example(
`node $0 disable my-project-id "(NOT display_name.empty OR NOT description.empty) AND user_labels='active'"`,
`Disables policies that match the given filter.`
'node $0 disable my-project-id "(NOT display_name.empty OR NOT description.empty) AND user_labels=\'active\'"',
'Disables policies that match the given filter.'
)
.example(
`node $0 disable my-project-id "description:'cloud'"`,
`Disables policies that match the given filter.`
'node $0 disable my-project-id "description:\'cloud\'"',
'Disables policies that match the given filter.'
)
.example(
`node $0 disable my-project-id "display_name=monitoring.regex.full_match('Temp \\d{4}')"`,
`Disables policies that match the given filter.`
'node $0 disable my-project-id "display_name=monitoring.regex.full_match(\'Temp \\d{4}\')"',
'Disables policies that match the given filter.'
)
.example(
`node $0 enable my-project-id "(NOT display_name.empty OR NOT description.empty) AND user_labels='active'"`,
`Enables policies that match the given filter.`
'node $0 enable my-project-id "(NOT display_name.empty OR NOT description.empty) AND user_labels=\'active\'"',
'Enables policies that match the given filter.'
)
.example(
`node $0 enable my-project-id "description:'cloud'"`,
`Enables policies that match the given filter.`
'node $0 enable my-project-id "description:\'cloud\'"',
'Enables policies that match the given filter.'
)
.example(
`node $0 enable my-project-id "display_name=monitoring.regex.full_match('Temp \\d{4}')"`,
`Enables policies that match the given filter.`
'node $0 enable my-project-id "display_name=monitoring.regex.full_match(\'Temp \\d{4}\')"',
'Enables policies that match the given filter.'
)
.wrap(120)
.recommendCommands()
.epilogue(
`For more information, see https://cloud.google.com/monitoring/docs/`
'For more information, see https://cloud.google.com/monitoring/docs/'
)
.help()
.strict().argv;
Loading

0 comments on commit d65e8fb

Please sign in to comment.