Skip to content

Commit 8bb8b0a

Browse files
docs(samples): add auto-generated samples for Node with api short name in region tag (#46)
* docs(samples): add auto-generated samples for Node with api short name in region tag PiperOrigin-RevId: 399287285 Source-Link: googleapis/googleapis@1575986 Source-Link: googleapis/googleapis-gen@b27fff6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent d54212b commit 8bb8b0a

18 files changed

+1067
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(parent, connectionProfileId, connectionProfile) {
18+
// [START datamigration_v1_generated_DataMigrationService_CreateConnectionProfile_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The parent, which owns this collection of connection profiles.
24+
*/
25+
// const parent = 'abc123'
26+
/**
27+
* Required. The connection profile identifier.
28+
*/
29+
// const connectionProfileId = 'abc123'
30+
/**
31+
* Required. The create request body including the connection profile data
32+
*/
33+
// const connectionProfile = ''
34+
/**
35+
* A unique id used to identify the request. If the server receives two
36+
* requests with the same id, then the second request will be ignored.
37+
* It is recommended to always set this value to a UUID.
38+
* The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
39+
* (_), and hyphens (-). The maximum length is 40 characters.
40+
*/
41+
// const requestId = 'abc123'
42+
43+
// Imports the Clouddms library
44+
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;
45+
46+
// Instantiates a client
47+
const clouddmsClient = new DataMigrationServiceClient();
48+
49+
async function createConnectionProfile() {
50+
// Construct request
51+
const request = {
52+
parent,
53+
connectionProfileId,
54+
connectionProfile,
55+
};
56+
57+
// Run request
58+
const [operation] = await clouddmsClient.createConnectionProfile(request);
59+
const [response] = await operation.promise();
60+
console.log(response);
61+
}
62+
63+
createConnectionProfile();
64+
// [END datamigration_v1_generated_DataMigrationService_CreateConnectionProfile_async]
65+
}
66+
67+
process.on('unhandledRejection', err => {
68+
console.error(err.message);
69+
process.exitCode = 1;
70+
});
71+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(parent, migrationJobId, migrationJob) {
18+
// [START datamigration_v1_generated_DataMigrationService_CreateMigrationJob_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The parent, which owns this collection of migration jobs.
24+
*/
25+
// const parent = 'abc123'
26+
/**
27+
* Required. The ID of the instance to create.
28+
*/
29+
// const migrationJobId = 'abc123'
30+
/**
31+
* Required. Represents a [migration
32+
* job](https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.migrationJobs)
33+
* object.
34+
*/
35+
// const migrationJob = ''
36+
/**
37+
* A unique id used to identify the request. If the server receives two
38+
* requests with the same id, then the second request will be ignored.
39+
* It is recommended to always set this value to a UUID.
40+
* The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
41+
* (_), and hyphens (-). The maximum length is 40 characters.
42+
*/
43+
// const requestId = 'abc123'
44+
45+
// Imports the Clouddms library
46+
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;
47+
48+
// Instantiates a client
49+
const clouddmsClient = new DataMigrationServiceClient();
50+
51+
async function createMigrationJob() {
52+
// Construct request
53+
const request = {
54+
parent,
55+
migrationJobId,
56+
migrationJob,
57+
};
58+
59+
// Run request
60+
const [operation] = await clouddmsClient.createMigrationJob(request);
61+
const [response] = await operation.promise();
62+
console.log(response);
63+
}
64+
65+
createMigrationJob();
66+
// [END datamigration_v1_generated_DataMigrationService_CreateMigrationJob_async]
67+
}
68+
69+
process.on('unhandledRejection', err => {
70+
console.error(err.message);
71+
process.exitCode = 1;
72+
});
73+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START datamigration_v1_generated_DataMigrationService_DeleteConnectionProfile_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Name of the connection profile resource to delete.
24+
*/
25+
// const name = 'abc123'
26+
/**
27+
* A unique id used to identify the request. If the server receives two
28+
* requests with the same id, then the second request will be ignored.
29+
* It is recommended to always set this value to a UUID.
30+
* The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
31+
* (_), and hyphens (-). The maximum length is 40 characters.
32+
*/
33+
// const requestId = 'abc123'
34+
/**
35+
* In case of force delete, the CloudSQL replica database is also deleted
36+
* (only for CloudSQL connection profile).
37+
*/
38+
// const force = true
39+
40+
// Imports the Clouddms library
41+
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;
42+
43+
// Instantiates a client
44+
const clouddmsClient = new DataMigrationServiceClient();
45+
46+
async function deleteConnectionProfile() {
47+
// Construct request
48+
const request = {
49+
name,
50+
};
51+
52+
// Run request
53+
const [operation] = await clouddmsClient.deleteConnectionProfile(request);
54+
const [response] = await operation.promise();
55+
console.log(response);
56+
}
57+
58+
deleteConnectionProfile();
59+
// [END datamigration_v1_generated_DataMigrationService_DeleteConnectionProfile_async]
60+
}
61+
62+
process.on('unhandledRejection', err => {
63+
console.error(err.message);
64+
process.exitCode = 1;
65+
});
66+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START datamigration_v1_generated_DataMigrationService_DeleteMigrationJob_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Name of the migration job resource to delete.
24+
*/
25+
// const name = 'abc123'
26+
/**
27+
* A unique id used to identify the request. If the server receives two
28+
* requests with the same id, then the second request will be ignored.
29+
* It is recommended to always set this value to a UUID.
30+
* The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
31+
* (_), and hyphens (-). The maximum length is 40 characters.
32+
*/
33+
// const requestId = 'abc123'
34+
/**
35+
* The destination CloudSQL connection profile is always deleted with the
36+
* migration job. In case of force delete, the destination CloudSQL replica
37+
* database is also deleted.
38+
*/
39+
// const force = true
40+
41+
// Imports the Clouddms library
42+
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;
43+
44+
// Instantiates a client
45+
const clouddmsClient = new DataMigrationServiceClient();
46+
47+
async function deleteMigrationJob() {
48+
// Construct request
49+
const request = {
50+
name,
51+
};
52+
53+
// Run request
54+
const [operation] = await clouddmsClient.deleteMigrationJob(request);
55+
const [response] = await operation.promise();
56+
console.log(response);
57+
}
58+
59+
deleteMigrationJob();
60+
// [END datamigration_v1_generated_DataMigrationService_DeleteMigrationJob_async]
61+
}
62+
63+
process.on('unhandledRejection', err => {
64+
console.error(err.message);
65+
process.exitCode = 1;
66+
});
67+
main(...process.argv.slice(2));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(vm) {
18+
// [START datamigration_v1_generated_DataMigrationService_GenerateSshScript_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Name of the migration job resource to generate the SSH script.
24+
*/
25+
// const migrationJob = 'abc123'
26+
/**
27+
* Required. Bastion VM Instance name to use or to create.
28+
*/
29+
// const vm = 'abc123'
30+
/**
31+
* The VM creation configuration
32+
*/
33+
// const vmCreationConfig = ''
34+
/**
35+
* The VM selection configuration
36+
*/
37+
// const vmSelectionConfig = ''
38+
/**
39+
* The port that will be open on the bastion host
40+
*/
41+
// const vmPort = 1234
42+
43+
// Imports the Clouddms library
44+
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;
45+
46+
// Instantiates a client
47+
const clouddmsClient = new DataMigrationServiceClient();
48+
49+
async function generateSshScript() {
50+
// Construct request
51+
const request = {
52+
vm,
53+
};
54+
55+
// Run request
56+
const response = await clouddmsClient.generateSshScript(request);
57+
console.log(response);
58+
}
59+
60+
generateSshScript();
61+
// [END datamigration_v1_generated_DataMigrationService_GenerateSshScript_async]
62+
}
63+
64+
process.on('unhandledRejection', err => {
65+
console.error(err.message);
66+
process.exitCode = 1;
67+
});
68+
main(...process.argv.slice(2));

0 commit comments

Comments
 (0)