Skip to content

Commit

Permalink
docs(samples): include metadata file, add exclusions for samples to h…
Browse files Browse the repository at this point in the history
…andwritten libraries (#17)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 429395631

Source-Link: googleapis/googleapis@84594b3

Source-Link: googleapis/googleapis-gen@ed74f97
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWQ3NGY5NzBmZDgyOTE0ODc0ZTZiMjdiMDQ3NjNjZmE2NmJhZmU5YiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Feb 18, 2022
1 parent ce9820c commit d1f1870
Show file tree
Hide file tree
Showing 8 changed files with 278 additions and 15 deletions.
10 changes: 8 additions & 2 deletions packages/google-cloud-ids/linkinator.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
"skip": [
"https://codecov.io/gh/googleapis/",
"www.googleapis.com",
"img.shields.io"
"img.shields.io",
"https://console.cloud.google.com/cloudshell",
"https://support.google.com"
],
"silent": true,
"concurrency": 5
"concurrency": 5,
"retry": true,
"retryErrors": true,
"retryErrorsCount": 5,
"retryErrorsJitter": 3000
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
// Copyright 2021 Google LLC
// Copyright 2022 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
// 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';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
// Copyright 2021 Google LLC
// Copyright 2022 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
// 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';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
// Copyright 2021 Google LLC
// Copyright 2022 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
// 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';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
// Copyright 2021 Google LLC
// Copyright 2022 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
// 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';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"clientLibrary": {
"name": "nodejs-ids",
"version": "0.1.0",
"language": "TYPESCRIPT",
"apis": [
{
"id": "google.cloud.ids.v1",
"version": "v1"
}
]
},
"snippets": [
{
"regionTag": "ids_v1_generated_IDS_ListEndpoints_async",
"title": "IDS listEndpoints Sample",
"origin": "API_DEFINITION",
"description": " Lists Endpoints in a given project and location.",
"canonical": true,
"file": "i_d_s.list_endpoints.js",
"language": "JAVASCRIPT",
"segments": [
{
"start": 25,
"end": 74,
"type": "FULL"
}
],
"clientMethod": {
"shortName": "ListEndpoints",
"fullName": "google.cloud.ids.v1.IDS.ListEndpoints",
"async": true,
"parameters": [
{
"name": "parent",
"type": "TYPE_STRING"
},
{
"name": "page_size",
"type": "TYPE_INT32"
},
{
"name": "page_token",
"type": "TYPE_STRING"
},
{
"name": "filter",
"type": "TYPE_STRING"
},
{
"name": "order_by",
"type": "TYPE_STRING"
}
],
"resultType": ".google.cloud.ids.v1.ListEndpointsResponse",
"client": {
"shortName": "IDSClient",
"fullName": "google.cloud.ids.v1.IDSClient"
},
"method": {
"shortName": "ListEndpoints",
"fullName": "google.cloud.ids.v1.IDS.ListEndpoints",
"service": {
"shortName": "IDS",
"fullName": "google.cloud.ids.v1.IDS"
}
}
}
},
{
"regionTag": "ids_v1_generated_IDS_GetEndpoint_async",
"title": "IDS getEndpoint Sample",
"origin": "API_DEFINITION",
"description": " Gets details of a single Endpoint.",
"canonical": true,
"file": "i_d_s.get_endpoint.js",
"language": "JAVASCRIPT",
"segments": [
{
"start": 25,
"end": 51,
"type": "FULL"
}
],
"clientMethod": {
"shortName": "GetEndpoint",
"fullName": "google.cloud.ids.v1.IDS.GetEndpoint",
"async": true,
"parameters": [
{
"name": "name",
"type": "TYPE_STRING"
}
],
"resultType": ".google.cloud.ids.v1.Endpoint",
"client": {
"shortName": "IDSClient",
"fullName": "google.cloud.ids.v1.IDSClient"
},
"method": {
"shortName": "GetEndpoint",
"fullName": "google.cloud.ids.v1.IDS.GetEndpoint",
"service": {
"shortName": "IDS",
"fullName": "google.cloud.ids.v1.IDS"
}
}
}
},
{
"regionTag": "ids_v1_generated_IDS_CreateEndpoint_async",
"title": "IDS createEndpoint Sample",
"origin": "API_DEFINITION",
"description": " Creates a new Endpoint in a given project and location.",
"canonical": true,
"file": "i_d_s.create_endpoint.js",
"language": "JAVASCRIPT",
"segments": [
{
"start": 25,
"end": 80,
"type": "FULL"
}
],
"clientMethod": {
"shortName": "CreateEndpoint",
"fullName": "google.cloud.ids.v1.IDS.CreateEndpoint",
"async": true,
"parameters": [
{
"name": "parent",
"type": "TYPE_STRING"
},
{
"name": "endpoint_id",
"type": "TYPE_STRING"
},
{
"name": "endpoint",
"type": ".google.cloud.ids.v1.Endpoint"
},
{
"name": "request_id",
"type": "TYPE_STRING"
}
],
"resultType": ".google.longrunning.Operation",
"client": {
"shortName": "IDSClient",
"fullName": "google.cloud.ids.v1.IDSClient"
},
"method": {
"shortName": "CreateEndpoint",
"fullName": "google.cloud.ids.v1.IDS.CreateEndpoint",
"service": {
"shortName": "IDS",
"fullName": "google.cloud.ids.v1.IDS"
}
}
}
},
{
"regionTag": "ids_v1_generated_IDS_DeleteEndpoint_async",
"title": "IDS deleteEndpoint Sample",
"origin": "API_DEFINITION",
"description": " Deletes a single Endpoint.",
"canonical": true,
"file": "i_d_s.delete_endpoint.js",
"language": "JAVASCRIPT",
"segments": [
{
"start": 25,
"end": 65,
"type": "FULL"
}
],
"clientMethod": {
"shortName": "DeleteEndpoint",
"fullName": "google.cloud.ids.v1.IDS.DeleteEndpoint",
"async": true,
"parameters": [
{
"name": "name",
"type": "TYPE_STRING"
},
{
"name": "request_id",
"type": "TYPE_STRING"
}
],
"resultType": ".google.longrunning.Operation",
"client": {
"shortName": "IDSClient",
"fullName": "google.cloud.ids.v1.IDSClient"
},
"method": {
"shortName": "DeleteEndpoint",
"fullName": "google.cloud.ids.v1.IDS.DeleteEndpoint",
"service": {
"shortName": "IDS",
"fullName": "google.cloud.ids.v1.IDS"
}
}
}
}
]
}
5 changes: 2 additions & 3 deletions packages/google-cloud-ids/src/v1/i_d_s_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1094,9 +1094,8 @@ export class IDSClient {
* @returns {Promise} A promise that resolves when the client is closed.
*/
close(): Promise<void> {
this.initialize();
if (!this._terminated) {
return this.iDSStub!.then(stub => {
if (this.iDSStub && !this._terminated) {
return this.iDSStub.then(stub => {
this._terminated = true;
stub.close();
this.operationsClient.close();
Expand Down
35 changes: 33 additions & 2 deletions packages/google-cloud-ids/test/gapic_i_d_s_v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,27 @@ describe('v1.IDSClient', () => {
assert(client.iDSStub);
});

it('has close method', () => {
it('has close method for the initialized client', done => {
const client = new idsModule.v1.IDSClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.close();
client.initialize();
assert(client.iDSStub);
client.close().then(() => {
done();
});
});

it('has close method for the non-initialized client', done => {
const client = new idsModule.v1.IDSClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
assert.strictEqual(client.iDSStub, undefined);
client.close().then(() => {
done();
});
});

it('has getProjectId method', async () => {
Expand Down Expand Up @@ -334,6 +349,22 @@ describe('v1.IDSClient', () => {
.calledWith(request, expectedOptions, undefined)
);
});

it('invokes getEndpoint with closed client', async () => {
const client = new idsModule.v1.IDSClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
const request = generateSampleMessage(
new protos.google.cloud.ids.v1.GetEndpointRequest()
);
request.name = '';
const expectedHeaderRequestParams = 'name=';
const expectedError = new Error('The client has already been closed.');
client.close();
await assert.rejects(client.getEndpoint(request), expectedError);
});
});

describe('createEndpoint', () => {
Expand Down

0 comments on commit d1f1870

Please sign in to comment.