From 01fed654f8aeb57b75105bd3158c626ec6b98538 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 18 Feb 2022 02:02:45 +0000 Subject: [PATCH] docs(samples): include metadata file, add exclusions for samples to handwritten libraries (#329) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 429395631 Source-Link: https://github.com/googleapis/googleapis/commit/84594b35af0c38efcd6967e8179d801702ad96ff Source-Link: https://github.com/googleapis/googleapis-gen/commit/ed74f970fd82914874e6b27b04763cfa66bafe9b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWQ3NGY5NzBmZDgyOTE0ODc0ZTZiMjdiMDQ3NjNjZmE2NmJhZmU5YiJ9 --- packages/grafeas/linkinator.config.json | 10 +- .../v1/grafeas.batch_create_notes.js | 9 +- .../v1/grafeas.batch_create_occurrences.js | 9 +- .../generated/v1/grafeas.create_note.js | 9 +- .../generated/v1/grafeas.create_occurrence.js | 9 +- .../generated/v1/grafeas.delete_note.js | 9 +- .../generated/v1/grafeas.delete_occurrence.js | 9 +- .../samples/generated/v1/grafeas.get_note.js | 9 +- .../generated/v1/grafeas.get_occurrence.js | 9 +- .../v1/grafeas.get_occurrence_note.js | 9 +- .../v1/grafeas.list_note_occurrences.js | 9 +- .../generated/v1/grafeas.list_notes.js | 9 +- .../generated/v1/grafeas.list_occurrences.js | 9 +- .../generated/v1/grafeas.update_note.js | 9 +- .../generated/v1/grafeas.update_occurrence.js | 9 +- .../v1/snippet_metadata.grafeas.v1.json | 647 ++++++++++++++++++ packages/grafeas/src/v1/grafeas_client.ts | 5 +- packages/grafeas/test/gapic_grafeas_v1.ts | 198 +++++- 18 files changed, 951 insertions(+), 35 deletions(-) create mode 100644 packages/grafeas/samples/generated/v1/snippet_metadata.grafeas.v1.json diff --git a/packages/grafeas/linkinator.config.json b/packages/grafeas/linkinator.config.json index 0121dfa684f..befd23c8633 100644 --- a/packages/grafeas/linkinator.config.json +++ b/packages/grafeas/linkinator.config.json @@ -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 } diff --git a/packages/grafeas/samples/generated/v1/grafeas.batch_create_notes.js b/packages/grafeas/samples/generated/v1/grafeas.batch_create_notes.js index f9dff20caf7..fad77a431e4 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.batch_create_notes.js +++ b/packages/grafeas/samples/generated/v1/grafeas.batch_create_notes.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.batch_create_occurrences.js b/packages/grafeas/samples/generated/v1/grafeas.batch_create_occurrences.js index 5343c031167..1c7c2e1eaab 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.batch_create_occurrences.js +++ b/packages/grafeas/samples/generated/v1/grafeas.batch_create_occurrences.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.create_note.js b/packages/grafeas/samples/generated/v1/grafeas.create_note.js index 654f154baa0..6fcfeb4da00 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.create_note.js +++ b/packages/grafeas/samples/generated/v1/grafeas.create_note.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.create_occurrence.js b/packages/grafeas/samples/generated/v1/grafeas.create_occurrence.js index 1d219fc73be..13568b541a8 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.create_occurrence.js +++ b/packages/grafeas/samples/generated/v1/grafeas.create_occurrence.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.delete_note.js b/packages/grafeas/samples/generated/v1/grafeas.delete_note.js index b7a646b6dfe..05dab35371c 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.delete_note.js +++ b/packages/grafeas/samples/generated/v1/grafeas.delete_note.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.delete_occurrence.js b/packages/grafeas/samples/generated/v1/grafeas.delete_occurrence.js index 2df7ae4dfcd..98cd285cc90 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.delete_occurrence.js +++ b/packages/grafeas/samples/generated/v1/grafeas.delete_occurrence.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.get_note.js b/packages/grafeas/samples/generated/v1/grafeas.get_note.js index ec8527ca56c..d16c082debc 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.get_note.js +++ b/packages/grafeas/samples/generated/v1/grafeas.get_note.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.get_occurrence.js b/packages/grafeas/samples/generated/v1/grafeas.get_occurrence.js index 3af8a0cdd92..ad7505ab17b 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.get_occurrence.js +++ b/packages/grafeas/samples/generated/v1/grafeas.get_occurrence.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.get_occurrence_note.js b/packages/grafeas/samples/generated/v1/grafeas.get_occurrence_note.js index eb7b80a2b39..1d006272544 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.get_occurrence_note.js +++ b/packages/grafeas/samples/generated/v1/grafeas.get_occurrence_note.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.list_note_occurrences.js b/packages/grafeas/samples/generated/v1/grafeas.list_note_occurrences.js index e2e0e877a1d..bbfa7fd8069 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.list_note_occurrences.js +++ b/packages/grafeas/samples/generated/v1/grafeas.list_note_occurrences.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.list_notes.js b/packages/grafeas/samples/generated/v1/grafeas.list_notes.js index 9cfbcb3c5e4..c8307181d00 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.list_notes.js +++ b/packages/grafeas/samples/generated/v1/grafeas.list_notes.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.list_occurrences.js b/packages/grafeas/samples/generated/v1/grafeas.list_occurrences.js index 78c2032ad84..79e2b0ddb8c 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.list_occurrences.js +++ b/packages/grafeas/samples/generated/v1/grafeas.list_occurrences.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.update_note.js b/packages/grafeas/samples/generated/v1/grafeas.update_note.js index 8a6da73dc9b..726d3a8f505 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.update_note.js +++ b/packages/grafeas/samples/generated/v1/grafeas.update_note.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/grafeas.update_occurrence.js b/packages/grafeas/samples/generated/v1/grafeas.update_occurrence.js index 15412988130..364aa5714c3 100644 --- a/packages/grafeas/samples/generated/v1/grafeas.update_occurrence.js +++ b/packages/grafeas/samples/generated/v1/grafeas.update_occurrence.js @@ -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'; diff --git a/packages/grafeas/samples/generated/v1/snippet_metadata.grafeas.v1.json b/packages/grafeas/samples/generated/v1/snippet_metadata.grafeas.v1.json new file mode 100644 index 00000000000..4c2457c6607 --- /dev/null +++ b/packages/grafeas/samples/generated/v1/snippet_metadata.grafeas.v1.json @@ -0,0 +1,647 @@ +{ + "clientLibrary": { + "name": "nodejs-grafeas", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "grafeas.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "containeranalysis_v1_generated_Grafeas_GetOccurrence_async", + "title": "Grafeas getOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Gets the specified occurrence.", + "canonical": true, + "file": "grafeas.get_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOccurrence", + "fullName": "grafeas.v1.Grafeas.GetOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.Occurrence", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "GetOccurrence", + "fullName": "grafeas.v1.Grafeas.GetOccurrence", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_ListOccurrences_async", + "title": "Grafeas listOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Lists occurrences for the specified project.", + "canonical": true, + "file": "grafeas.list_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListOccurrences", + "fullName": "grafeas.v1.Grafeas.ListOccurrences", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.ListOccurrencesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "ListOccurrences", + "fullName": "grafeas.v1.Grafeas.ListOccurrences", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_DeleteOccurrence_async", + "title": "Grafeas deleteOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.", + "canonical": true, + "file": "grafeas.delete_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteOccurrence", + "fullName": "grafeas.v1.Grafeas.DeleteOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "DeleteOccurrence", + "fullName": "grafeas.v1.Grafeas.DeleteOccurrence", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_CreateOccurrence_async", + "title": "Grafeas createOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Creates a new occurrence.", + "canonical": true, + "file": "grafeas.create_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateOccurrence", + "fullName": "grafeas.v1.Grafeas.CreateOccurrence", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "occurrence", + "type": ".grafeas.v1.Occurrence" + } + ], + "resultType": ".grafeas.v1.Occurrence", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "CreateOccurrence", + "fullName": "grafeas.v1.Grafeas.CreateOccurrence", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_BatchCreateOccurrences_async", + "title": "Grafeas batchCreateOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Creates new occurrences in batch.", + "canonical": true, + "file": "grafeas.batch_create_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateOccurrences", + "fullName": "grafeas.v1.Grafeas.BatchCreateOccurrences", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "occurrences", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".grafeas.v1.BatchCreateOccurrencesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "BatchCreateOccurrences", + "fullName": "grafeas.v1.Grafeas.BatchCreateOccurrences", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_UpdateOccurrence_async", + "title": "Grafeas updateOccurrence Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified occurrence.", + "canonical": true, + "file": "grafeas.update_occurrence.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOccurrence", + "fullName": "grafeas.v1.Grafeas.UpdateOccurrence", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "occurrence", + "type": ".grafeas.v1.Occurrence" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".grafeas.v1.Occurrence", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "UpdateOccurrence", + "fullName": "grafeas.v1.Grafeas.UpdateOccurrence", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_GetOccurrenceNote_async", + "title": "Grafeas getOccurrenceNote Sample", + "origin": "API_DEFINITION", + "description": " Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.", + "canonical": true, + "file": "grafeas.get_occurrence_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOccurrenceNote", + "fullName": "grafeas.v1.Grafeas.GetOccurrenceNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.Note", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "GetOccurrenceNote", + "fullName": "grafeas.v1.Grafeas.GetOccurrenceNote", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_GetNote_async", + "title": "Grafeas getNote Sample", + "origin": "API_DEFINITION", + "description": " Gets the specified note.", + "canonical": true, + "file": "grafeas.get_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNote", + "fullName": "grafeas.v1.Grafeas.GetNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.Note", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "GetNote", + "fullName": "grafeas.v1.Grafeas.GetNote", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_ListNotes_async", + "title": "Grafeas listNotes Sample", + "origin": "API_DEFINITION", + "description": " Lists notes for the specified project.", + "canonical": true, + "file": "grafeas.list_notes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNotes", + "fullName": "grafeas.v1.Grafeas.ListNotes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.ListNotesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "ListNotes", + "fullName": "grafeas.v1.Grafeas.ListNotes", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_DeleteNote_async", + "title": "Grafeas deleteNote Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified note.", + "canonical": true, + "file": "grafeas.delete_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNote", + "fullName": "grafeas.v1.Grafeas.DeleteNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "DeleteNote", + "fullName": "grafeas.v1.Grafeas.DeleteNote", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_CreateNote_async", + "title": "Grafeas createNote Sample", + "origin": "API_DEFINITION", + "description": " Creates a new note.", + "canonical": true, + "file": "grafeas.create_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNote", + "fullName": "grafeas.v1.Grafeas.CreateNote", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "note_id", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": ".grafeas.v1.Note" + } + ], + "resultType": ".grafeas.v1.Note", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "CreateNote", + "fullName": "grafeas.v1.Grafeas.CreateNote", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_BatchCreateNotes_async", + "title": "Grafeas batchCreateNotes Sample", + "origin": "API_DEFINITION", + "description": " Creates new notes in batch.", + "canonical": true, + "file": "grafeas.batch_create_notes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateNotes", + "fullName": "grafeas.v1.Grafeas.BatchCreateNotes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "notes", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".grafeas.v1.BatchCreateNotesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "BatchCreateNotes", + "fullName": "grafeas.v1.Grafeas.BatchCreateNotes", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_UpdateNote_async", + "title": "Grafeas updateNote Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified note.", + "canonical": true, + "file": "grafeas.update_note.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNote", + "fullName": "grafeas.v1.Grafeas.UpdateNote", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "note", + "type": ".grafeas.v1.Note" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".grafeas.v1.Note", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "UpdateNote", + "fullName": "grafeas.v1.Grafeas.UpdateNote", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + }, + { + "regionTag": "containeranalysis_v1_generated_Grafeas_ListNoteOccurrences_async", + "title": "Grafeas listNoteOccurrences Sample", + "origin": "API_DEFINITION", + "description": " Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.", + "canonical": true, + "file": "grafeas.list_note_occurrences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNoteOccurrences", + "fullName": "grafeas.v1.Grafeas.ListNoteOccurrences", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".grafeas.v1.ListNoteOccurrencesResponse", + "client": { + "shortName": "GrafeasClient", + "fullName": "grafeas.v1.GrafeasClient" + }, + "method": { + "shortName": "ListNoteOccurrences", + "fullName": "grafeas.v1.Grafeas.ListNoteOccurrences", + "service": { + "shortName": "Grafeas", + "fullName": "grafeas.v1.Grafeas" + } + } + } + } + ] +} diff --git a/packages/grafeas/src/v1/grafeas_client.ts b/packages/grafeas/src/v1/grafeas_client.ts index ab24c99d933..276a36eccb1 100644 --- a/packages/grafeas/src/v1/grafeas_client.ts +++ b/packages/grafeas/src/v1/grafeas_client.ts @@ -1989,9 +1989,8 @@ export class GrafeasClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.grafeasStub!.then(stub => { + if (this.grafeasStub && !this._terminated) { + return this.grafeasStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/grafeas/test/gapic_grafeas_v1.ts b/packages/grafeas/test/gapic_grafeas_v1.ts index 068283c6e87..0637ea4c91d 100644 --- a/packages/grafeas/test/gapic_grafeas_v1.ts +++ b/packages/grafeas/test/gapic_grafeas_v1.ts @@ -151,12 +151,27 @@ describe('v1.GrafeasClient', () => { assert(client.grafeasStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new grafeasModule.v1.GrafeasClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.grafeasStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.grafeasStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -302,6 +317,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getOccurrence with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOccurrence(request), expectedError); + }); }); describe('deleteOccurrence', () => { @@ -413,6 +444,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteOccurrence with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteOccurrenceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteOccurrence(request), expectedError); + }); }); describe('createOccurrence', () => { @@ -524,6 +571,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createOccurrence with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateOccurrenceRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createOccurrence(request), expectedError); + }); }); describe('batchCreateOccurrences', () => { @@ -639,6 +702,25 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes batchCreateOccurrences with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateOccurrencesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.batchCreateOccurrences(request), + expectedError + ); + }); }); describe('updateOccurrence', () => { @@ -750,6 +832,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateOccurrence with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateOccurrenceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOccurrence(request), expectedError); + }); }); describe('getOccurrenceNote', () => { @@ -858,6 +956,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getOccurrenceNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetOccurrenceNoteRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOccurrenceNote(request), expectedError); + }); }); describe('getNote', () => { @@ -963,6 +1077,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.GetNoteRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNote(request), expectedError); + }); }); describe('deleteNote', () => { @@ -1074,6 +1204,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.DeleteNoteRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNote(request), expectedError); + }); }); describe('createNote', () => { @@ -1182,6 +1328,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.CreateNoteRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNote(request), expectedError); + }); }); describe('batchCreateNotes', () => { @@ -1293,6 +1455,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes batchCreateNotes with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.BatchCreateNotesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchCreateNotes(request), expectedError); + }); }); describe('updateNote', () => { @@ -1401,6 +1579,22 @@ describe('v1.GrafeasClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateNote with closed client', async () => { + const client = new grafeasModule.v1.GrafeasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.grafeas.v1.UpdateNoteRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNote(request), expectedError); + }); }); describe('listOccurrences', () => {