Skip to content

Commit

Permalink
docs(samples): add auto-generated samples for Node with api short nam…
Browse files Browse the repository at this point in the history
…e 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Sep 29, 2021
1 parent d54212b commit 8bb8b0a
Show file tree
Hide file tree
Showing 18 changed files with 1,067 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// 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
//
// 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.

'use strict';

function main(parent, connectionProfileId, connectionProfile) {
// [START datamigration_v1_generated_DataMigrationService_CreateConnectionProfile_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent, which owns this collection of connection profiles.
*/
// const parent = 'abc123'
/**
* Required. The connection profile identifier.
*/
// const connectionProfileId = 'abc123'
/**
* Required. The create request body including the connection profile data
*/
// const connectionProfile = ''
/**
* A unique id used to identify the request. If the server receives two
* requests with the same id, then the second request will be ignored.
* It is recommended to always set this value to a UUID.
* The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
* (_), and hyphens (-). The maximum length is 40 characters.
*/
// const requestId = 'abc123'

// Imports the Clouddms library
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;

// Instantiates a client
const clouddmsClient = new DataMigrationServiceClient();

async function createConnectionProfile() {
// Construct request
const request = {
parent,
connectionProfileId,
connectionProfile,
};

// Run request
const [operation] = await clouddmsClient.createConnectionProfile(request);
const [response] = await operation.promise();
console.log(response);
}

createConnectionProfile();
// [END datamigration_v1_generated_DataMigrationService_CreateConnectionProfile_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 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
//
// 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.

'use strict';

function main(parent, migrationJobId, migrationJob) {
// [START datamigration_v1_generated_DataMigrationService_CreateMigrationJob_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent, which owns this collection of migration jobs.
*/
// const parent = 'abc123'
/**
* Required. The ID of the instance to create.
*/
// const migrationJobId = 'abc123'
/**
* Required. Represents a [migration
* job](https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.migrationJobs)
* object.
*/
// const migrationJob = ''
/**
* A unique id used to identify the request. If the server receives two
* requests with the same id, then the second request will be ignored.
* It is recommended to always set this value to a UUID.
* The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
* (_), and hyphens (-). The maximum length is 40 characters.
*/
// const requestId = 'abc123'

// Imports the Clouddms library
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;

// Instantiates a client
const clouddmsClient = new DataMigrationServiceClient();

async function createMigrationJob() {
// Construct request
const request = {
parent,
migrationJobId,
migrationJob,
};

// Run request
const [operation] = await clouddmsClient.createMigrationJob(request);
const [response] = await operation.promise();
console.log(response);
}

createMigrationJob();
// [END datamigration_v1_generated_DataMigrationService_CreateMigrationJob_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// 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
//
// 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.

'use strict';

function main(name) {
// [START datamigration_v1_generated_DataMigrationService_DeleteConnectionProfile_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the connection profile resource to delete.
*/
// const name = 'abc123'
/**
* A unique id used to identify the request. If the server receives two
* requests with the same id, then the second request will be ignored.
* It is recommended to always set this value to a UUID.
* The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
* (_), and hyphens (-). The maximum length is 40 characters.
*/
// const requestId = 'abc123'
/**
* In case of force delete, the CloudSQL replica database is also deleted
* (only for CloudSQL connection profile).
*/
// const force = true

// Imports the Clouddms library
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;

// Instantiates a client
const clouddmsClient = new DataMigrationServiceClient();

async function deleteConnectionProfile() {
// Construct request
const request = {
name,
};

// Run request
const [operation] = await clouddmsClient.deleteConnectionProfile(request);
const [response] = await operation.promise();
console.log(response);
}

deleteConnectionProfile();
// [END datamigration_v1_generated_DataMigrationService_DeleteConnectionProfile_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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
//
// 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.

'use strict';

function main(name) {
// [START datamigration_v1_generated_DataMigrationService_DeleteMigrationJob_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the migration job resource to delete.
*/
// const name = 'abc123'
/**
* A unique id used to identify the request. If the server receives two
* requests with the same id, then the second request will be ignored.
* It is recommended to always set this value to a UUID.
* The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
* (_), and hyphens (-). The maximum length is 40 characters.
*/
// const requestId = 'abc123'
/**
* The destination CloudSQL connection profile is always deleted with the
* migration job. In case of force delete, the destination CloudSQL replica
* database is also deleted.
*/
// const force = true

// Imports the Clouddms library
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;

// Instantiates a client
const clouddmsClient = new DataMigrationServiceClient();

async function deleteMigrationJob() {
// Construct request
const request = {
name,
};

// Run request
const [operation] = await clouddmsClient.deleteMigrationJob(request);
const [response] = await operation.promise();
console.log(response);
}

deleteMigrationJob();
// [END datamigration_v1_generated_DataMigrationService_DeleteMigrationJob_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// 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
//
// 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.

'use strict';

function main(vm) {
// [START datamigration_v1_generated_DataMigrationService_GenerateSshScript_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Name of the migration job resource to generate the SSH script.
*/
// const migrationJob = 'abc123'
/**
* Required. Bastion VM Instance name to use or to create.
*/
// const vm = 'abc123'
/**
* The VM creation configuration
*/
// const vmCreationConfig = ''
/**
* The VM selection configuration
*/
// const vmSelectionConfig = ''
/**
* The port that will be open on the bastion host
*/
// const vmPort = 1234

// Imports the Clouddms library
const {DataMigrationServiceClient} = require('@google-cloud/dms').v1;

// Instantiates a client
const clouddmsClient = new DataMigrationServiceClient();

async function generateSshScript() {
// Construct request
const request = {
vm,
};

// Run request
const response = await clouddmsClient.generateSshScript(request);
console.log(response);
}

generateSshScript();
// [END datamigration_v1_generated_DataMigrationService_GenerateSshScript_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Loading

0 comments on commit 8bb8b0a

Please sign in to comment.