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 (#109)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 399287285

Source-Link: googleapis/googleapis@1575986

Source-Link: googleapis/googleapis-gen@b27fff6
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9
  • Loading branch information
gcf-owl-bot[bot] authored Oct 5, 2021
1 parent 125de60 commit 6066cc4
Show file tree
Hide file tree
Showing 21 changed files with 1,234 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// 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) {
// [START bigqueryreservation_v1_generated_ReservationService_CreateAssignment_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent resource name of the assignment
* E.g. `projects/myproject/locations/US/reservations/team1-prod`
*/
// const parent = 'abc123'
/**
* Assignment resource to create.
*/
// const assignment = ''
/**
* The optional assignment ID. Assignment name will be generated automatically
* if this field is empty.
* This field must only contain lower case alphanumeric characters or dash.
* Max length is 64 characters.
*/
// const assignmentId = 'abc123'

// Imports the Reservation library
const {ReservationServiceClient} =
require('@google-cloud/bigquery-reservation').v1;

// Instantiates a client
const reservationClient = new ReservationServiceClient();

async function createAssignment() {
// Construct request
const request = {
parent,
};

// Run request
const response = await reservationClient.createAssignment(request);
console.log(response);
}

createAssignment();
// [END bigqueryreservation_v1_generated_ReservationService_CreateAssignment_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,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) {
// [START bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the parent reservation. E.g.,
* `projects/myproject/locations/US`
*/
// const parent = 'abc123'
/**
* Content of the capacity commitment to create.
*/
// const capacityCommitment = ''
/**
* If true, fail the request if another project in the organization has a
* capacity commitment.
*/
// const enforceSingleAdminProjectPerOrg = true
/**
* The optional capacity commitment ID. Capacity commitment name will be
* generated automatically if this field is empty.
* This field must only contain lower case alphanumeric characters or dash.
* Max length is 64 characters.
* NOTE: this ID won't be kept if the capacity commitment is split or merged.
*/
// const capacityCommitmentId = 'abc123'

// Imports the Reservation library
const {ReservationServiceClient} =
require('@google-cloud/bigquery-reservation').v1;

// Instantiates a client
const reservationClient = new ReservationServiceClient();

async function createCapacityCommitment() {
// Construct request
const request = {
parent,
};

// Run request
const response = await reservationClient.createCapacityCommitment(request);
console.log(response);
}

createCapacityCommitment();
// [END bigqueryreservation_v1_generated_ReservationService_CreateCapacityCommitment_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,63 @@
// 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) {
// [START bigqueryreservation_v1_generated_ReservationService_CreateReservation_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Project, location. E.g.,
* `projects/myproject/locations/US`
*/
// const parent = 'abc123'
/**
* The reservation ID. This field must only contain lower case alphanumeric
* characters or dash. Max length is 64 characters.
*/
// const reservationId = 'abc123'
/**
* Definition of the new reservation to create.
*/
// const reservation = ''

// Imports the Reservation library
const {ReservationServiceClient} =
require('@google-cloud/bigquery-reservation').v1;

// Instantiates a client
const reservationClient = new ReservationServiceClient();

async function createReservation() {
// Construct request
const request = {
parent,
};

// Run request
const response = await reservationClient.createReservation(request);
console.log(response);
}

createReservation();
// [END bigqueryreservation_v1_generated_ReservationService_CreateReservation_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,54 @@
// 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 bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the resource, e.g.
* `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
*/
// const name = 'abc123'

// Imports the Reservation library
const {ReservationServiceClient} =
require('@google-cloud/bigquery-reservation').v1;

// Instantiates a client
const reservationClient = new ReservationServiceClient();

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

// Run request
const response = await reservationClient.deleteAssignment(request);
console.log(response);
}

deleteAssignment();
// [END bigqueryreservation_v1_generated_ReservationService_DeleteAssignment_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,60 @@
// 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 bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the capacity commitment to delete. E.g.,
* `projects/myproject/locations/US/capacityCommitments/123`
*/
// const name = 'abc123'
/**
* Can be used to force delete commitments even if assignments exist. Deleting
* commitments with assignments may cause queries to fail if they no longer
* have access to slots.
*/
// const force = true

// Imports the Reservation library
const {ReservationServiceClient} =
require('@google-cloud/bigquery-reservation').v1;

// Instantiates a client
const reservationClient = new ReservationServiceClient();

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

// Run request
const response = await reservationClient.deleteCapacityCommitment(request);
console.log(response);
}

deleteCapacityCommitment();
// [END bigqueryreservation_v1_generated_ReservationService_DeleteCapacityCommitment_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,54 @@
// 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 bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Resource name of the reservation to retrieve. E.g.,
* `projects/myproject/locations/US/reservations/team1-prod`
*/
// const name = 'abc123'

// Imports the Reservation library
const {ReservationServiceClient} =
require('@google-cloud/bigquery-reservation').v1;

// Instantiates a client
const reservationClient = new ReservationServiceClient();

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

// Run request
const response = await reservationClient.deleteReservation(request);
console.log(response);
}

deleteReservation();
// [END bigqueryreservation_v1_generated_ReservationService_DeleteReservation_async]
}

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

0 comments on commit 6066cc4

Please sign in to comment.