This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
256 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
docker: | ||
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest | ||
digest: sha256:b94b09fb24bf804090b8cc60ee726ca161d5e5915151e417f8ef5d8bcfe73cbc | ||
digest: sha256:f556e6e7be625deb1b2429fe608df27be57185c3e6b7d39ee0059f1609f17530 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2021 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 | ||
// | ||
// https://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 is automatically generated by gapic-generator-typescript. ** | ||
// ** https://github.com/googleapis/gapic-generator-typescript ** | ||
// ** All changes to this file may be overwritten. ** | ||
|
||
'use strict'; | ||
|
||
module.exports = { | ||
opts: { | ||
readme: './README.md', | ||
package: './package.json', | ||
template: './node_modules/jsdoc-fresh', | ||
recurse: true, | ||
verbose: true, | ||
destination: './docs/' | ||
}, | ||
plugins: [ | ||
'plugins/markdown', | ||
'jsdoc-region-tag' | ||
], | ||
source: { | ||
excludePattern: '(^|\\/|\\\\)[._]', | ||
include: [ | ||
'build/src', | ||
'protos' | ||
], | ||
includePattern: '\\.js$' | ||
}, | ||
templates: { | ||
copyright: 'Copyright 2021 Google LLC', | ||
includeDate: false, | ||
sourceFiles: false, | ||
systemName: '@google-cloud/secret-manager', | ||
theme: 'lumen', | ||
default: { | ||
outputSourceFiles: false | ||
} | ||
}, | ||
markdown: { | ||
idInHeadings: true | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
[//]: # "To regenerate it, use `python -m synthtool`." | ||
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/> | ||
|
||
# [Cloud Database Migration Service: Node.js Samples](https://github.com/googleapis/nodejs-dms) | ||
|
||
[![Open in Cloud Shell][shell_img]][shell_link] | ||
|
||
|
||
|
||
## Table of Contents | ||
|
||
* [Before you begin](#before-you-begin) | ||
* [Samples](#samples) | ||
* [Quickstart](#quickstart) | ||
|
||
## Before you begin | ||
|
||
Before running the samples, make sure you've followed the steps outlined in | ||
[Using the client library](https://github.com/googleapis/nodejs-dms#using-the-client-library). | ||
|
||
`cd samples` | ||
|
||
`npm install` | ||
|
||
`cd ..` | ||
|
||
## Samples | ||
|
||
|
||
|
||
### Quickstart | ||
|
||
View the [source code](https://github.com/googleapis/nodejs-dms/blob/master/samples/quickstart.js). | ||
|
||
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dms&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | ||
|
||
__Usage:__ | ||
|
||
|
||
`node samples/quickstart.js` | ||
|
||
|
||
|
||
|
||
|
||
|
||
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png | ||
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dms&page=editor&open_in_editor=samples/README.md | ||
[product-docs]: https://cloud.google.com/database-migration/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "nodejs-dms", | ||
"private": true, | ||
"license": "Apache-2.0", | ||
"author": "Google LLC", | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"files": [ | ||
"*.js" | ||
], | ||
"scripts": { | ||
"test": "c8 mocha --timeout 600000 test/*.js" | ||
}, | ||
"dependencies": { | ||
"@google-cloud/dms": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"c8": "^7.1.0", | ||
"chai": "^4.2.0", | ||
"mocha": "^8.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2021 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 | ||
// | ||
// https://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. | ||
// | ||
'use strict'; | ||
|
||
async function main(projectId = 'my-project', location = 'us-central1') { | ||
// [START dms_quickstart] | ||
// Imports the Google Cloud client library | ||
const {DataMigrationServiceClient} = require('@google-cloud/dms'); | ||
|
||
// const parent = 'projects/my-project', // Project to list service usage for. | ||
|
||
// Creates a client | ||
const client = new DataMigrationServiceClient(); | ||
async function listMigrationJobs() { | ||
for await (const migration of client.listMigrationJobsAsync({ | ||
parent: `projects/${projectId}/locations/${location}`, | ||
})) { | ||
console.info(`${migration.name} ${migration.state}`); | ||
} | ||
} | ||
listMigrationJobs(); | ||
// [END dms_quickstart] | ||
} | ||
|
||
main(...process.argv.slice(2)).catch(err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// 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 | ||
// | ||
// https://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 is automatically generated by gapic-generator-typescript. ** | ||
// ** https://github.com/googleapis/gapic-generator-typescript ** | ||
// ** All changes to this file may be overwritten. ** | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const cp = require('child_process'); | ||
const {before, describe, it} = require('mocha'); | ||
const {DataMigrationServiceClient} = require('@google-cloud/dms'); | ||
const {assert} = require('chai'); | ||
|
||
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); | ||
|
||
const cwd = path.join(__dirname, '..'); | ||
|
||
const client = new DataMigrationServiceClient(); | ||
|
||
describe('Quickstart', () => { | ||
let projectId; | ||
before(async () => { | ||
// eslint-disable-next-line no-unused-vars | ||
projectId = await client.getProjectId(); | ||
}); | ||
|
||
it('should run quickstart', async () => { | ||
const stdout = execSync(`node ./quickstart.js ${projectId} us-central1`, { | ||
cwd, | ||
}); | ||
assert.match(stdout, /DRAFT/); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters