From 36cc1a93b544cf7c3aa9131becc8f119121d106f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 14 Sep 2022 21:14:33 +0000 Subject: [PATCH 1/6] chore: use gapic-generator-typescript v2.17.0 PiperOrigin-RevId: 474338479 Source-Link: https://github.com/googleapis/googleapis/commit/d5d35e0353b59719e8917103b1bc7df2782bf6ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/efcd3f93962a103f68f003e2a1eecde6fa216a27 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 65 + .../v1/provisioning_service.proto | 205 + .../apigeeregistry/v1/registry_models.proto | 364 + .../apigeeregistry/v1/registry_service.proto | 1133 +++ .../v1/provisioning.create_instance.js | 73 + .../v1/provisioning.delete_instance.js | 63 + .../generated/v1/provisioning.get_instance.js | 62 + .../generated/v1/registry.create_api.js | 76 + .../v1/registry.create_api_deployment.js | 76 + .../generated/v1/registry.create_api_spec.js | 76 + .../v1/registry.create_api_version.js | 76 + .../generated/v1/registry.create_artifact.js | 76 + .../generated/v1/registry.delete_api.js | 67 + .../v1/registry.delete_api_deployment.js | 67 + ...registry.delete_api_deployment_revision.js | 64 + .../generated/v1/registry.delete_api_spec.js | 67 + .../v1/registry.delete_api_spec_revision.js | 64 + .../v1/registry.delete_api_version.js | 67 + .../generated/v1/registry.delete_artifact.js | 62 + .../samples/generated/v1/registry.get_api.js | 62 + .../v1/registry.get_api_deployment.js | 62 + .../generated/v1/registry.get_api_spec.js | 62 + .../v1/registry.get_api_spec_contents.js | 62 + .../generated/v1/registry.get_api_version.js | 62 + .../generated/v1/registry.get_artifact.js | 62 + .../v1/registry.get_artifact_contents.js | 62 + .../registry.list_api_deployment_revisions.js | 72 + .../v1/registry.list_api_deployments.js | 83 + .../v1/registry.list_api_spec_revisions.js | 72 + .../generated/v1/registry.list_api_specs.js | 83 + .../v1/registry.list_api_versions.js | 83 + .../generated/v1/registry.list_apis.js | 83 + .../generated/v1/registry.list_artifacts.js | 83 + .../generated/v1/registry.replace_artifact.js | 63 + .../v1/registry.rollback_api_deployment.js | 68 + .../v1/registry.rollback_api_spec.js | 68 + .../registry.tag_api_deployment_revision.js | 67 + .../v1/registry.tag_api_spec_revision.js | 67 + .../generated/v1/registry.update_api.js | 75 + .../v1/registry.update_api_deployment.js | 75 + .../generated/v1/registry.update_api_spec.js | 75 + .../v1/registry.update_api_version.js | 75 + ...tadata.google.cloud.apigeeregistry.v1.json | 1723 +++++ owl-bot-staging/v1/src/index.ts | 27 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 445 ++ owl-bot-staging/v1/src/v1/index.ts | 20 + .../v1/src/v1/provisioning_client.ts | 1737 +++++ .../v1/src/v1/provisioning_client_config.json | 38 + .../v1/src/v1/provisioning_proto_list.json | 5 + owl-bot-staging/v1/src/v1/registry_client.ts | 5041 +++++++++++++ .../v1/src/v1/registry_client_config.json | 216 + .../v1/src/v1/registry_proto_list.json | 5 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + owl-bot-staging/v1/system-test/install.ts | 49 + .../v1/test/gapic_provisioning_v1.ts | 1896 +++++ owl-bot-staging/v1/test/gapic_registry_v1.ts | 6280 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 67 files changed, 22211 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/src/v1/provisioning_client.ts create mode 100644 owl-bot-staging/v1/src/v1/provisioning_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/provisioning_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/registry_client.ts create mode 100644 owl-bot-staging/v1/src/v1/registry_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/registry_proto_list.json create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_provisioning_v1.ts create mode 100644 owl-bot-staging/v1/test/gapic_registry_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..2efe6c2 --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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 +// +// 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/apigee-registry', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// 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 +// +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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 +// +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..1c7b46e --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Apigeeregistry: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..bfde712 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,65 @@ +{ + "name": "@google-cloud/apigee-registry", + "version": "0.1.0", + "description": "Apigeeregistry client for Node.js", + "repository": "googleapis/nodejs-apigeeregistry", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google apigeeregistry", + "apigeeregistry", + "provisioning", + "registry" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.59", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto new file mode 100644 index 0000000..9e7baee --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto @@ -0,0 +1,205 @@ +// 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.apigeeregistry.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; +option java_multiple_files = true; +option java_outer_classname = "ProvisioningServiceProto"; +option java_package = "com.google.cloud.apigeeregistry.v1"; +option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; +option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; + +// The service that is used for managing the data plane provisioning of the +// Registry. +service Provisioning { + option (google.api.default_host) = "apigeeregistry.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Provisions instance resources for the Registry. + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/instances" + body: "instance" + }; + option (google.api.method_signature) = "parent,instance,instance_id"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the Registry instance. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Gets details of a single Instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for CreateInstance. +message CreateInstanceRequest { + // Required. Parent resource of the Instance, of the form: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Identifier to assign to the Instance. Must be unique within scope of the + // parent resource. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Instance. + Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteInstance. +message DeleteInstanceRequest { + // Required. The name of the Instance to delete. + // Format: `projects/*/locations/*/instances/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Instance" + } + ]; +} + +// Request message for GetInstance. +message GetInstanceRequest { + // Required. The name of the Instance to retrieve. + // Format: `projects/*/locations/*/instances/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Instance" + } + ]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_message = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancellation_requested = 6; + + // API version used to start the operation. + string api_version = 7; +} + +// An Instance represents the instance resources of the Registry. +// Currently, only one instance is allowed for each project. +message Instance { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/Instance" + pattern: "projects/{project}/locations/{location}/instances/{instance}" + }; + + // State of the Instance. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // The Instance has not been initialized or has been deleted. + INACTIVE = 1; + + // The Instance is being created. + CREATING = 2; + + // The Instance has been created and is ready for use. + ACTIVE = 3; + + // The Instance is being updated. + UPDATING = 4; + + // The Instance is being deleted. + DELETING = 5; + + // The Instance encountered an error during a state change. + FAILED = 6; + } + + // Available configurations to provision an Instance. + message Config { + // Output only. The GCP location where the Instance resides. + string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The Customer Managed Encryption Key (CMEK) used for data encryption. + // The CMEK name should follow the format of + // `projects/([^/]+)/locations/([^/]+)/keyRings/([^/]+)/cryptoKeys/([^/]+)`, + // where the `location` must match InstanceConfig.location. + string cmek_key_name = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Format: `projects/*/locations/*/instance`. + // Currently only `locations/global` is supported. + string name = 1; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the Instance. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Extra information of Instance.State if the state is `FAILED`. + string state_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Config of the Instance. + Config config = 6 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto new file mode 100644 index 0000000..8411f9e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto @@ -0,0 +1,364 @@ +// 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.apigeeregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; +option java_multiple_files = true; +option java_outer_classname = "RegistryModelsProto"; +option java_package = "com.google.cloud.apigeeregistry.v1"; +option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; +option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; + +// A top-level description of an API. +// Produced by producers and are commitments to provide services. +message Api { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/Api" + pattern: "projects/{project}/locations/{location}/apis/{api}" + }; + + // Resource name. + string name = 1; + + // Human-meaningful name. + string display_name = 2; + + // A detailed description. + string description = 3; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-definable description of the availability of this service. + // Format: free-form, but we expect single words that describe availability, + // e.g., "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN". + string availability = 6; + + // The recommended version of the API. + // Format: `apis/{api}/versions/{version}` + string recommended_version = 7 [(google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiVersion" + }]; + + // The recommended deployment of the API. + // Format: `apis/{api}/deployments/{deployment}` + string recommended_deployment = 8 [(google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + }]; + + // Labels attach identifying metadata to resources. Identifying metadata can + // be used to filter list operations. + // + // Label keys and values can be no longer than 64 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores, and dashes. International characters are allowed. + // No more than 64 user labels can be associated with one resource (System + // labels are excluded). + // + // See https://goo.gl/xmQnxf for more information and examples of labels. + // System reserved label keys are prefixed with + // `apigeeregistry.googleapis.com/` and cannot be changed. + map labels = 9; + + // Annotations attach non-identifying metadata to resources. + // + // Annotation keys and values are less restricted than those of labels, but + // should be generally used for small values of broad interest. Larger, topic- + // specific metadata should be stored in Artifacts. + map annotations = 10; +} + +// Describes a particular version of an API. +// ApiVersions are what consumers actually use. +message ApiVersion { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/ApiVersion" + pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}" + }; + + // Resource name. + string name = 1; + + // Human-meaningful name. + string display_name = 2; + + // A detailed description. + string description = 3; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-definable description of the lifecycle phase of this API version. + // Format: free-form, but we expect single words that describe API maturity, + // e.g., "CONCEPT", "DESIGN", "DEVELOPMENT", "STAGING", "PRODUCTION", + // "DEPRECATED", "RETIRED". + string state = 6; + + // Labels attach identifying metadata to resources. Identifying metadata can + // be used to filter list operations. + // + // Label keys and values can be no longer than 64 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // No more than 64 user labels can be associated with one resource (System + // labels are excluded). + // + // See https://goo.gl/xmQnxf for more information and examples of labels. + // System reserved label keys are prefixed with + // `apigeeregistry.googleapis.com/` and cannot be changed. + map labels = 7; + + // Annotations attach non-identifying metadata to resources. + // + // Annotation keys and values are less restricted than those of labels, but + // should be generally used for small values of broad interest. Larger, topic- + // specific metadata should be stored in Artifacts. + map annotations = 8; +} + +// Describes a version of an API in a structured way. +// ApiSpecs provide formal descriptions that consumers can use to use a version. +// ApiSpec resources are intended to be fully-resolved descriptions of an +// ApiVersion. When specs consist of multiple files, these should be bundled +// together (e.g., in a zip archive) and stored as a unit. Multiple specs can +// exist to provide representations in different API description formats. +// Synchronization of these representations would be provided by tooling and +// background services. +message ApiSpec { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}" + }; + + // Resource name. + string name = 1; + + // A possibly-hierarchical name used to refer to the spec from other specs. + string filename = 2; + + // A detailed description. + string description = 3; + + // Output only. Immutable. The revision ID of the spec. + // A new revision is committed whenever the spec contents are changed. + // The format is an 8-character hexadecimal string. + string revision_id = 4 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. Creation timestamp; when the spec resource was created. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision creation timestamp; when the represented revision was created. + google.protobuf.Timestamp revision_create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp: when the represented revision was last modified. + google.protobuf.Timestamp revision_update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A style (format) descriptor for this spec that is specified as a Media Type + // (https://en.wikipedia.org/wiki/Media_type). Possible values include + // `application/vnd.apigee.proto`, `application/vnd.apigee.openapi`, and + // `application/vnd.apigee.graphql`, with possible suffixes representing + // compression types. These hypothetical names are defined in the vendor tree + // defined in RFC6838 (https://tools.ietf.org/html/rfc6838) and are not final. + // Content types can specify compression. Currently only GZip compression is + // supported (indicated with "+gzip"). + string mime_type = 8; + + // Output only. The size of the spec file in bytes. If the spec is gzipped, this is the + // size of the uncompressed spec. + int32 size_bytes = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A SHA-256 hash of the spec's contents. If the spec is gzipped, this is + // the hash of the uncompressed spec. + string hash = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The original source URI of the spec (if one exists). + // This is an external location that can be used for reference purposes + // but which may not be authoritative since this external resource may + // change after the spec is retrieved. + string source_uri = 11; + + // Input only. The contents of the spec. + // Provided by API callers when specs are created or updated. + // To access the contents of a spec, use GetApiSpecContents. + bytes contents = 12 [(google.api.field_behavior) = INPUT_ONLY]; + + // Labels attach identifying metadata to resources. Identifying metadata can + // be used to filter list operations. + // + // Label keys and values can be no longer than 64 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // No more than 64 user labels can be associated with one resource (System + // labels are excluded). + // + // See https://goo.gl/xmQnxf for more information and examples of labels. + // System reserved label keys are prefixed with + // `apigeeregistry.googleapis.com/` and cannot be changed. + map labels = 14; + + // Annotations attach non-identifying metadata to resources. + // + // Annotation keys and values are less restricted than those of labels, but + // should be generally used for small values of broad interest. Larger, topic- + // specific metadata should be stored in Artifacts. + map annotations = 15; +} + +// Describes a service running at particular address that +// provides a particular version of an API. ApiDeployments have revisions which +// correspond to different configurations of a single deployment in time. +// Revision identifiers should be updated whenever the served API spec or +// endpoint address changes. +message ApiDeployment { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + pattern: "projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}" + }; + + // Resource name. + string name = 1; + + // Human-meaningful name. + string display_name = 2; + + // A detailed description. + string description = 3; + + // Output only. Immutable. The revision ID of the deployment. + // A new revision is committed whenever the deployment contents are changed. + // The format is an 8-character hexadecimal string. + string revision_id = 4 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. Creation timestamp; when the deployment resource was created. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision creation timestamp; when the represented revision was created. + google.protobuf.Timestamp revision_create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp: when the represented revision was last modified. + google.protobuf.Timestamp revision_update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The full resource name (including revision ID) of the spec of the API being + // served by the deployment. Changes to this value will update the revision. + // Format: `apis/{api}/deployments/{deployment}` + string api_spec_revision = 8 [(google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + }]; + + // The address where the deployment is serving. Changes to this value will + // update the revision. + string endpoint_uri = 9; + + // The address of the external channel of the API (e.g., the Developer + // Portal). Changes to this value will not affect the revision. + string external_channel_uri = 10; + + // Text briefly identifying the intended audience of the API. Changes to this + // value will not affect the revision. + string intended_audience = 11; + + // Text briefly describing how to access the endpoint. Changes to this value + // will not affect the revision. + string access_guidance = 12; + + // Labels attach identifying metadata to resources. Identifying metadata can + // be used to filter list operations. + // + // Label keys and values can be no longer than 64 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // No more than 64 user labels can be associated with one resource (System + // labels are excluded). + // + // See https://goo.gl/xmQnxf for more information and examples of labels. + // System reserved label keys are prefixed with + // `apigeeregistry.googleapis.com/` and cannot be changed. + map labels = 14; + + // Annotations attach non-identifying metadata to resources. + // + // Annotation keys and values are less restricted than those of labels, but + // should be generally used for small values of broad interest. Larger, topic- + // specific metadata should be stored in Artifacts. + map annotations = 15; +} + +// Artifacts of resources. Artifacts are unique (single-value) per resource +// and are used to store metadata that is too large or numerous to be stored +// directly on the resource. Since artifacts are stored separately from parent +// resources, they should generally be used for metadata that is needed +// infrequently, i.e., not for display in primary views of the resource but +// perhaps displayed or downloaded upon request. The `ListArtifacts` method +// allows artifacts to be quickly enumerated and checked for presence without +// downloading their (potentially-large) contents. +message Artifact { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/Artifact" + pattern: "projects/{project}/locations/{location}/artifacts/{artifact}" + pattern: "projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}" + pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}" + pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}" + pattern: "projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}" + }; + + // Resource name. + string name = 1; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A content type specifier for the artifact. + // Content type specifiers are Media Types + // (https://en.wikipedia.org/wiki/Media_type) with a possible "schema" + // parameter that specifies a schema for the stored information. + // Content types can specify compression. Currently only GZip compression is + // supported (indicated with "+gzip"). + string mime_type = 4; + + // Output only. The size of the artifact in bytes. If the artifact is gzipped, this is + // the size of the uncompressed artifact. + int32 size_bytes = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A SHA-256 hash of the artifact's contents. If the artifact is gzipped, + // this is the hash of the uncompressed artifact. + string hash = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. The contents of the artifact. + // Provided by API callers when artifacts are created or replaced. + // To access the contents of an artifact, use GetArtifactContents. + bytes contents = 7 [(google.api.field_behavior) = INPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto new file mode 100644 index 0000000..1eec64e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto @@ -0,0 +1,1133 @@ +// 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.apigeeregistry.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/httpbody.proto"; +import "google/api/resource.proto"; +import "google/cloud/apigeeregistry/v1/registry_models.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; +option java_multiple_files = true; +option java_outer_classname = "RegistryServiceProto"; +option java_package = "com.google.cloud.apigeeregistry.v1"; +option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; +option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; + +// The Registry service allows teams to manage descriptions of APIs. +service Registry { + option (google.api.default_host) = "apigeeregistry.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns matching APIs. + rpc ListApis(ListApisRequest) returns (ListApisResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/apis" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified API. + rpc GetApi(GetApiRequest) returns (Api) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified API. + rpc CreateApi(CreateApiRequest) returns (Api) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/apis" + body: "api" + }; + option (google.api.method_signature) = "parent,api,api_id"; + } + + // Used to modify a specified API. + rpc UpdateApi(UpdateApiRequest) returns (Api) { + option (google.api.http) = { + patch: "/v1/{api.name=projects/*/locations/*/apis/*}" + body: "api" + }; + option (google.api.method_signature) = "api,update_mask"; + } + + // Removes a specified API and all of the resources that it + // owns. + rpc DeleteApi(DeleteApiRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns matching versions. + rpc ListApiVersions(ListApiVersionsRequest) returns (ListApiVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/apis/*}/versions" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified version. + rpc GetApiVersion(GetApiVersionRequest) returns (ApiVersion) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified version. + rpc CreateApiVersion(CreateApiVersionRequest) returns (ApiVersion) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/apis/*}/versions" + body: "api_version" + }; + option (google.api.method_signature) = "parent,api_version,api_version_id"; + } + + // Used to modify a specified version. + rpc UpdateApiVersion(UpdateApiVersionRequest) returns (ApiVersion) { + option (google.api.http) = { + patch: "/v1/{api_version.name=projects/*/locations/*/apis/*/versions/*}" + body: "api_version" + }; + option (google.api.method_signature) = "api_version,update_mask"; + } + + // Removes a specified version and all of the resources that + // it owns. + rpc DeleteApiVersion(DeleteApiVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns matching specs. + rpc ListApiSpecs(ListApiSpecsRequest) returns (ListApiSpecsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified spec. + rpc GetApiSpec(GetApiSpecRequest) returns (ApiSpec) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns the contents of a specified spec. + // If specs are stored with GZip compression, the default behavior + // is to return the spec uncompressed (the mime_type response field + // indicates the exact format returned). + rpc GetApiSpecContents(GetApiSpecContentsRequest) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:getContents" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified spec. + rpc CreateApiSpec(CreateApiSpecRequest) returns (ApiSpec) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs" + body: "api_spec" + }; + option (google.api.method_signature) = "parent,api_spec,api_spec_id"; + } + + // Used to modify a specified spec. + rpc UpdateApiSpec(UpdateApiSpecRequest) returns (ApiSpec) { + option (google.api.http) = { + patch: "/v1/{api_spec.name=projects/*/locations/*/apis/*/versions/*/specs/*}" + body: "api_spec" + }; + option (google.api.method_signature) = "api_spec,update_mask"; + } + + // Removes a specified spec, all revisions, and all child + // resources (e.g., artifacts). + rpc DeleteApiSpec(DeleteApiSpecRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds a tag to a specified revision of a spec. + rpc TagApiSpecRevision(TagApiSpecRevisionRequest) returns (ApiSpec) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:tagRevision" + body: "*" + }; + } + + // Lists all revisions of a spec. + // Revisions are returned in descending order of revision creation time. + rpc ListApiSpecRevisions(ListApiSpecRevisionsRequest) returns (ListApiSpecRevisionsResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:listRevisions" + }; + } + + // Sets the current revision to a specified prior revision. + // Note that this creates a new revision with a new revision ID. + rpc RollbackApiSpec(RollbackApiSpecRequest) returns (ApiSpec) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:rollback" + body: "*" + }; + } + + // Deletes a revision of a spec. + rpc DeleteApiSpecRevision(DeleteApiSpecRevisionRequest) returns (ApiSpec) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:deleteRevision" + }; + option (google.api.method_signature) = "name"; + } + + // Returns matching deployments. + rpc ListApiDeployments(ListApiDeploymentsRequest) returns (ListApiDeploymentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/apis/*}/deployments" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified deployment. + rpc GetApiDeployment(GetApiDeploymentRequest) returns (ApiDeployment) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified deployment. + rpc CreateApiDeployment(CreateApiDeploymentRequest) returns (ApiDeployment) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/apis/*}/deployments" + body: "api_deployment" + }; + option (google.api.method_signature) = "parent,api_deployment,api_deployment_id"; + } + + // Used to modify a specified deployment. + rpc UpdateApiDeployment(UpdateApiDeploymentRequest) returns (ApiDeployment) { + option (google.api.http) = { + patch: "/v1/{api_deployment.name=projects/*/locations/*/apis/*/deployments/*}" + body: "api_deployment" + }; + option (google.api.method_signature) = "api_deployment,update_mask"; + } + + // Removes a specified deployment, all revisions, and all + // child resources (e.g., artifacts). + rpc DeleteApiDeployment(DeleteApiDeploymentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds a tag to a specified revision of a + // deployment. + rpc TagApiDeploymentRevision(TagApiDeploymentRevisionRequest) returns (ApiDeployment) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:tagRevision" + body: "*" + }; + } + + // Lists all revisions of a deployment. + // Revisions are returned in descending order of revision creation time. + rpc ListApiDeploymentRevisions(ListApiDeploymentRevisionsRequest) returns (ListApiDeploymentRevisionsResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:listRevisions" + }; + } + + // Sets the current revision to a specified prior + // revision. Note that this creates a new revision with a new revision ID. + rpc RollbackApiDeployment(RollbackApiDeploymentRequest) returns (ApiDeployment) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:rollback" + body: "*" + }; + } + + // Deletes a revision of a deployment. + rpc DeleteApiDeploymentRevision(DeleteApiDeploymentRevisionRequest) returns (ApiDeployment) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:deleteRevision" + }; + option (google.api.method_signature) = "name"; + } + + // Returns matching artifacts. + rpc ListArtifacts(ListArtifactsRequest) returns (ListArtifactsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/artifacts" + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/apis/*}/artifacts" + } + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/artifacts" + } + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*/specs/*}/artifacts" + } + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/apis/*/deployments/*}/artifacts" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified artifact. + rpc GetArtifact(GetArtifactRequest) returns (Artifact) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/artifacts/*}" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Returns the contents of a specified artifact. + // If artifacts are stored with GZip compression, the default behavior + // is to return the artifact uncompressed (the mime_type response field + // indicates the exact format returned). + rpc GetArtifactContents(GetArtifactContentsRequest) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/artifacts/*}:getContents" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}:getContents" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getContents" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getContents" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}:getContents" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified artifact. + rpc CreateArtifact(CreateArtifactRequest) returns (Artifact) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/artifacts" + body: "artifact" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/apis/*}/artifacts" + body: "artifact" + } + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/artifacts" + body: "artifact" + } + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*/specs/*}/artifacts" + body: "artifact" + } + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/apis/*/deployments/*}/artifacts" + body: "artifact" + } + }; + option (google.api.method_signature) = "parent,artifact,artifact_id"; + } + + // Used to replace a specified artifact. + rpc ReplaceArtifact(ReplaceArtifactRequest) returns (Artifact) { + option (google.api.http) = { + put: "/v1/{artifact.name=projects/*/locations/*/artifacts/*}" + body: "artifact" + additional_bindings { + put: "/v1/{artifact.name=projects/*/locations/*/apis/*/artifacts/*}" + body: "artifact" + } + additional_bindings { + put: "/v1/{artifact.name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" + body: "artifact" + } + additional_bindings { + put: "/v1/{artifact.name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" + body: "artifact" + } + additional_bindings { + put: "/v1/{artifact.name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" + body: "artifact" + } + }; + option (google.api.method_signature) = "artifact"; + } + + // Removes a specified artifact. + rpc DeleteArtifact(DeleteArtifactRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/artifacts/*}" + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}" + } + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" + } + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" + } + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for ListApis. +message ListApisRequest { + // Required. The parent, which owns this collection of APIs. + // Format: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/Api" + } + ]; + + // The maximum number of APIs to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListApis` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListApis` must match + // the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields. + string filter = 4; +} + +// Response message for ListApis. +message ListApisResponse { + // The APIs from the specified publisher. + repeated Api apis = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetApi. +message GetApiRequest { + // Required. The name of the API to retrieve. + // Format: `projects/*/locations/*/apis/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Api" + } + ]; +} + +// Request message for CreateApi. +message CreateApiRequest { + // Required. The parent, which owns this collection of APIs. + // Format: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/Api" + } + ]; + + // Required. The API to create. + Api api = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the API, which will become the final component of + // the API's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string api_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateApi. +message UpdateApiRequest { + // Required. The API to update. + // + // The `name` field is used to identify the API to update. + // Format: `projects/*/locations/*/apis/*` + Api api = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If omitted, all fields are updated that + // are set in the request message (fields set to default values are ignored). + // If an asterisk "*" is specified, all fields are updated, including fields + // that are unspecified/default in the request. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the API is not found, a new API will be created. + // In this situation, `update_mask` is ignored. + bool allow_missing = 3; +} + +// Request message for DeleteApi. +message DeleteApiRequest { + // Required. The name of the API to delete. + // Format: `projects/*/locations/*/apis/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Api" + } + ]; + + // If set to true, any child resources will also be deleted. + // (Otherwise, the request will only work if there are no child resources.) + bool force = 2; +} + +// Request message for ListApiVersions. +message ListApiVersionsRequest { + // Required. The parent, which owns this collection of versions. + // Format: `projects/*/locations/*/apis/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiVersion" + } + ]; + + // The maximum number of versions to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListApiVersions` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListApiVersions` must + // match the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields. + string filter = 4; +} + +// Response message for ListApiVersions. +message ListApiVersionsResponse { + // The versions from the specified publisher. + repeated ApiVersion api_versions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetApiVersion. +message GetApiVersionRequest { + // Required. The name of the version to retrieve. + // Format: `projects/*/locations/*/apis/*/versions/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiVersion" + } + ]; +} + +// Request message for CreateApiVersion. +message CreateApiVersionRequest { + // Required. The parent, which owns this collection of versions. + // Format: `projects/*/locations/*/apis/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiVersion" + } + ]; + + // Required. The version to create. + ApiVersion api_version = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the version, which will become the final component of + // the version's resource name. + // + // This value should be 1-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string api_version_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateApiVersion. +message UpdateApiVersionRequest { + // Required. The version to update. + // + // The `name` field is used to identify the version to update. + // Format: `projects/*/locations/*/apis/*/versions/*` + ApiVersion api_version = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If omitted, all fields are updated that + // are set in the request message (fields set to default values are ignored). + // If an asterisk "*" is specified, all fields are updated, including fields + // that are unspecified/default in the request. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the version is not found, a new version will be + // created. In this situation, `update_mask` is ignored. + bool allow_missing = 3; +} + +// Request message for DeleteApiVersion. +message DeleteApiVersionRequest { + // Required. The name of the version to delete. + // Format: `projects/*/locations/*/apis/*/versions/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiVersion" + } + ]; + + // If set to true, any child resources will also be deleted. + // (Otherwise, the request will only work if there are no child resources.) + bool force = 2; +} + +// Request message for ListApiSpecs. +message ListApiSpecsRequest { + // Required. The parent, which owns this collection of specs. + // Format: `projects/*/locations/*/apis/*/versions/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // The maximum number of specs to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListApiSpecs` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListApiSpecs` must match + // the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields except contents. + string filter = 4; +} + +// Response message for ListApiSpecs. +message ListApiSpecsResponse { + // The specs from the specified publisher. + repeated ApiSpec api_specs = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetApiSpec. +message GetApiSpecRequest { + // Required. The name of the spec to retrieve. + // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; +} + +// Request message for GetApiSpecContents. +message GetApiSpecContentsRequest { + // Required. The name of the spec whose contents should be retrieved. + // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; +} + +// Request message for CreateApiSpec. +message CreateApiSpecRequest { + // Required. The parent, which owns this collection of specs. + // Format: `projects/*/locations/*/apis/*/versions/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // Required. The spec to create. + ApiSpec api_spec = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the spec, which will become the final component of + // the spec's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string api_spec_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateApiSpec. +message UpdateApiSpecRequest { + // Required. The spec to update. + // + // The `name` field is used to identify the spec to update. + // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` + ApiSpec api_spec = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If omitted, all fields are updated that + // are set in the request message (fields set to default values are ignored). + // If an asterisk "*" is specified, all fields are updated, including fields + // that are unspecified/default in the request. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the spec is not found, a new spec will be created. + // In this situation, `update_mask` is ignored. + bool allow_missing = 3; +} + +// Request message for DeleteApiSpec. +message DeleteApiSpecRequest { + // Required. The name of the spec to delete. + // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // If set to true, any child resources will also be deleted. + // (Otherwise, the request will only work if there are no child resources.) + bool force = 2; +} + +// Request message for TagApiSpecRevision. +message TagApiSpecRevisionRequest { + // Required. The name of the spec to be tagged, including the revision ID. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // Required. The tag to apply. + // The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. + string tag = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ListApiSpecRevisions. +message ListApiSpecRevisionsRequest { + // Required. The name of the spec to list revisions for. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // The maximum number of revisions to return per page. + int32 page_size = 2; + + // The page token, received from a previous ListApiSpecRevisions call. + // Provide this to retrieve the subsequent page. + string page_token = 3; +} + +// Response message for ListApiSpecRevisionsResponse. +message ListApiSpecRevisionsResponse { + // The revisions of the spec. + repeated ApiSpec api_specs = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for RollbackApiSpec. +message RollbackApiSpecRequest { + // Required. The spec being rolled back. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // Required. The revision ID to roll back to. + // It must be a revision of the same spec. + // + // Example: `c7cfa2a8` + string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteApiSpecRevision. +message DeleteApiSpecRevisionRequest { + // Required. The name of the spec revision to be deleted, + // with a revision ID explicitly included. + // + // Example: + // `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; +} + +// Request message for ListApiDeployments. +message ListApiDeploymentsRequest { + // Required. The parent, which owns this collection of deployments. + // Format: `projects/*/locations/*/apis/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // The maximum number of deployments to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListApiDeployments` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListApiDeployments` must + // match the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields. + string filter = 4; +} + +// Response message for ListApiDeployments. +message ListApiDeploymentsResponse { + // The deployments from the specified publisher. + repeated ApiDeployment api_deployments = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetApiDeployment. +message GetApiDeploymentRequest { + // Required. The name of the deployment to retrieve. + // Format: `projects/*/locations/*/apis/*/deployments/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; +} + +// Request message for CreateApiDeployment. +message CreateApiDeploymentRequest { + // Required. The parent, which owns this collection of deployments. + // Format: `projects/*/locations/*/apis/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // Required. The deployment to create. + ApiDeployment api_deployment = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the deployment, which will become the final component of + // the deployment's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string api_deployment_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateApiDeployment. +message UpdateApiDeploymentRequest { + // Required. The deployment to update. + // + // The `name` field is used to identify the deployment to update. + // Format: `projects/*/locations/*/apis/*/deployments/*` + ApiDeployment api_deployment = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If omitted, all fields are updated that + // are set in the request message (fields set to default values are ignored). + // If an asterisk "*" is specified, all fields are updated, including fields + // that are unspecified/default in the request. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the deployment is not found, a new deployment will be + // created. In this situation, `update_mask` is ignored. + bool allow_missing = 3; +} + +// Request message for DeleteApiDeployment. +message DeleteApiDeploymentRequest { + // Required. The name of the deployment to delete. + // Format: `projects/*/locations/*/apis/*/deployments/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // If set to true, any child resources will also be deleted. + // (Otherwise, the request will only work if there are no child resources.) + bool force = 2; +} + +// Request message for TagApiDeploymentRevision. +message TagApiDeploymentRevisionRequest { + // Required. The name of the deployment to be tagged, including the revision ID. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // Required. The tag to apply. + // The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. + string tag = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ListApiDeploymentRevisions. +message ListApiDeploymentRevisionsRequest { + // Required. The name of the deployment to list revisions for. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // The maximum number of revisions to return per page. + int32 page_size = 2; + + // The page token, received from a previous ListApiDeploymentRevisions call. + // Provide this to retrieve the subsequent page. + string page_token = 3; +} + +// Response message for ListApiDeploymentRevisionsResponse. +message ListApiDeploymentRevisionsResponse { + // The revisions of the deployment. + repeated ApiDeployment api_deployments = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for RollbackApiDeployment. +message RollbackApiDeploymentRequest { + // Required. The deployment being rolled back. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // Required. The revision ID to roll back to. + // It must be a revision of the same deployment. + // + // Example: `c7cfa2a8` + string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteApiDeploymentRevision. +message DeleteApiDeploymentRevisionRequest { + // Required. The name of the deployment revision to be deleted, + // with a revision ID explicitly included. + // + // Example: + // `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; +} + +// Request message for ListArtifacts. +message ListArtifactsRequest { + // Required. The parent, which owns this collection of artifacts. + // Format: `{parent}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/Artifact" + } + ]; + + // The maximum number of artifacts to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListArtifacts` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListArtifacts` must + // match the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields except contents. + string filter = 4; +} + +// Response message for ListArtifacts. +message ListArtifactsResponse { + // The artifacts from the specified publisher. + repeated Artifact artifacts = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetArtifact. +message GetArtifactRequest { + // Required. The name of the artifact to retrieve. + // Format: `{parent}/artifacts/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Artifact" + } + ]; +} + +// Request message for GetArtifactContents. +message GetArtifactContentsRequest { + // Required. The name of the artifact whose contents should be retrieved. + // Format: `{parent}/artifacts/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Artifact" + } + ]; +} + +// Request message for CreateArtifact. +message CreateArtifactRequest { + // Required. The parent, which owns this collection of artifacts. + // Format: `{parent}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/Artifact" + } + ]; + + // Required. The artifact to create. + Artifact artifact = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the artifact, which will become the final component of + // the artifact's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string artifact_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ReplaceArtifact. +message ReplaceArtifactRequest { + // Required. The artifact to replace. + // + // The `name` field is used to identify the artifact to replace. + // Format: `{parent}/artifacts/*` + Artifact artifact = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteArtifact. +message DeleteArtifactRequest { + // Required. The name of the artifact to delete. + // Format: `{parent}/artifacts/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Artifact" + } + ]; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js new file mode 100644 index 0000000..4f84cd1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js @@ -0,0 +1,73 @@ +// 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 +// +// 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'; + +function main(parent, instanceId, instance) { + // [START apigeeregistry_v1_generated_Provisioning_CreateInstance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource of the Instance, of the form: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Identifier to assign to the Instance. Must be unique within scope of the + * parent resource. + */ + // const instanceId = 'abc123' + /** + * Required. The Instance. + */ + // const instance = {} + + // Imports the Apigeeregistry library + const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new ProvisioningClient(); + + async function callCreateInstance() { + // Construct request + const request = { + parent, + instanceId, + instance, + }; + + // Run request + const [operation] = await apigeeregistryClient.createInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateInstance(); + // [END apigeeregistry_v1_generated_Provisioning_CreateInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js new file mode 100644 index 0000000..9e1d226 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js @@ -0,0 +1,63 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Provisioning_DeleteInstance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Instance to delete. + * Format: `projects/* /locations/* /instances/*`. + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new ProvisioningClient(); + + async function callDeleteInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await apigeeregistryClient.deleteInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteInstance(); + // [END apigeeregistry_v1_generated_Provisioning_DeleteInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js new file mode 100644 index 0000000..4a4355c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Provisioning_GetInstance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Instance to retrieve. + * Format: `projects/* /locations/* /instances/*`. + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new ProvisioningClient(); + + async function callGetInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getInstance(request); + console.log(response); + } + + callGetInstance(); + // [END apigeeregistry_v1_generated_Provisioning_GetInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js new file mode 100644 index 0000000..ebce3b4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, api, apiId) { + // [START apigeeregistry_v1_generated_Registry_CreateApi_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. The API to create. + */ + // const api = {} + /** + * Required. The ID to use for the API, which will become the final component of + * the API's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const apiId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateApi() { + // Construct request + const request = { + parent, + api, + apiId, + }; + + // Run request + const response = await apigeeregistryClient.createApi(request); + console.log(response); + } + + callCreateApi(); + // [END apigeeregistry_v1_generated_Registry_CreateApi_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js new file mode 100644 index 0000000..1d0c276 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, apiDeployment, apiDeploymentId) { + // [START apigeeregistry_v1_generated_Registry_CreateApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + */ + // const parent = 'abc123' + /** + * Required. The deployment to create. + */ + // const apiDeployment = {} + /** + * Required. The ID to use for the deployment, which will become the final component of + * the deployment's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const apiDeploymentId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateApiDeployment() { + // Construct request + const request = { + parent, + apiDeployment, + apiDeploymentId, + }; + + // Run request + const response = await apigeeregistryClient.createApiDeployment(request); + console.log(response); + } + + callCreateApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_CreateApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js new file mode 100644 index 0000000..44c0e05 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, apiSpec, apiSpecId) { + // [START apigeeregistry_v1_generated_Registry_CreateApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const parent = 'abc123' + /** + * Required. The spec to create. + */ + // const apiSpec = {} + /** + * Required. The ID to use for the spec, which will become the final component of + * the spec's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const apiSpecId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateApiSpec() { + // Construct request + const request = { + parent, + apiSpec, + apiSpecId, + }; + + // Run request + const response = await apigeeregistryClient.createApiSpec(request); + console.log(response); + } + + callCreateApiSpec(); + // [END apigeeregistry_v1_generated_Registry_CreateApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js new file mode 100644 index 0000000..dd7182a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, apiVersion, apiVersionId) { + // [START apigeeregistry_v1_generated_Registry_CreateApiVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + */ + // const parent = 'abc123' + /** + * Required. The version to create. + */ + // const apiVersion = {} + /** + * Required. The ID to use for the version, which will become the final component of + * the version's resource name. + * This value should be 1-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const apiVersionId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateApiVersion() { + // Construct request + const request = { + parent, + apiVersion, + apiVersionId, + }; + + // Run request + const response = await apigeeregistryClient.createApiVersion(request); + console.log(response); + } + + callCreateApiVersion(); + // [END apigeeregistry_v1_generated_Registry_CreateApiVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js new file mode 100644 index 0000000..565ba5f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, artifact, artifactId) { + // [START apigeeregistry_v1_generated_Registry_CreateArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + */ + // const parent = 'abc123' + /** + * Required. The artifact to create. + */ + // const artifact = {} + /** + * Required. The ID to use for the artifact, which will become the final component of + * the artifact's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const artifactId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateArtifact() { + // Construct request + const request = { + parent, + artifact, + artifactId, + }; + + // Run request + const response = await apigeeregistryClient.createArtifact(request); + console.log(response); + } + + callCreateArtifact(); + // [END apigeeregistry_v1_generated_Registry_CreateArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js new file mode 100644 index 0000000..440f846 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApi_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the API to delete. + * Format: `projects/* /locations/* /apis/*` + */ + // const name = 'abc123' + /** + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + */ + // const force = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApi() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApi(request); + console.log(response); + } + + callDeleteApi(); + // [END apigeeregistry_v1_generated_Registry_DeleteApi_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js new file mode 100644 index 0000000..47100ad --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment to delete. + * Format: `projects/* /locations/* /apis/* /deployments/*` + */ + // const name = 'abc123' + /** + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + */ + // const force = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiDeployment(request); + console.log(response); + } + + callDeleteApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js new file mode 100644 index 0000000..b46ffa3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js @@ -0,0 +1,64 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment revision to be deleted, + * with a revision ID explicitly included. + * Example: + * `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiDeploymentRevision() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiDeploymentRevision(request); + console.log(response); + } + + callDeleteApiDeploymentRevision(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js new file mode 100644 index 0000000..bf1dfe8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec to delete. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + */ + // const name = 'abc123' + /** + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + */ + // const force = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiSpec() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiSpec(request); + console.log(response); + } + + callDeleteApiSpec(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js new file mode 100644 index 0000000..21fb813 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js @@ -0,0 +1,64 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec revision to be deleted, + * with a revision ID explicitly included. + * Example: + * `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiSpecRevision() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiSpecRevision(request); + console.log(response); + } + + callDeleteApiSpecRevision(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js new file mode 100644 index 0000000..9c59f0b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version to delete. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const name = 'abc123' + /** + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + */ + // const force = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiVersion(request); + console.log(response); + } + + callDeleteApiVersion(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js new file mode 100644 index 0000000..d3e2b7c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the artifact to delete. + * Format: `{parent}/artifacts/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteArtifact() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteArtifact(request); + console.log(response); + } + + callDeleteArtifact(); + // [END apigeeregistry_v1_generated_Registry_DeleteArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js new file mode 100644 index 0000000..79568c8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApi_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the API to retrieve. + * Format: `projects/* /locations/* /apis/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApi() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApi(request); + console.log(response); + } + + callGetApi(); + // [END apigeeregistry_v1_generated_Registry_GetApi_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js new file mode 100644 index 0000000..2c0d9d1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment to retrieve. + * Format: `projects/* /locations/* /apis/* /deployments/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApiDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApiDeployment(request); + console.log(response); + } + + callGetApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_GetApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js new file mode 100644 index 0000000..364e0d1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec to retrieve. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApiSpec() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApiSpec(request); + console.log(response); + } + + callGetApiSpec(); + // [END apigeeregistry_v1_generated_Registry_GetApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js new file mode 100644 index 0000000..419e495 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApiSpecContents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec whose contents should be retrieved. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApiSpecContents() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApiSpecContents(request); + console.log(response); + } + + callGetApiSpecContents(); + // [END apigeeregistry_v1_generated_Registry_GetApiSpecContents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js new file mode 100644 index 0000000..384f458 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApiVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version to retrieve. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApiVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApiVersion(request); + console.log(response); + } + + callGetApiVersion(); + // [END apigeeregistry_v1_generated_Registry_GetApiVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js new file mode 100644 index 0000000..fd8cf04 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the artifact to retrieve. + * Format: `{parent}/artifacts/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetArtifact() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getArtifact(request); + console.log(response); + } + + callGetArtifact(); + // [END apigeeregistry_v1_generated_Registry_GetArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js new file mode 100644 index 0000000..983ab0f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetArtifactContents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the artifact whose contents should be retrieved. + * Format: `{parent}/artifacts/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetArtifactContents() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getArtifactContents(request); + console.log(response); + } + + callGetArtifactContents(); + // [END apigeeregistry_v1_generated_Registry_GetArtifactContents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js new file mode 100644 index 0000000..0f9fa67 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js @@ -0,0 +1,72 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment to list revisions for. + */ + // const name = 'abc123' + /** + * The maximum number of revisions to return per page. + */ + // const pageSize = 1234 + /** + * The page token, received from a previous ListApiDeploymentRevisions call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiDeploymentRevisions() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiDeploymentRevisionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiDeploymentRevisions(); + // [END apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js new file mode 100644 index 0000000..10a7f19 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListApiDeployments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + */ + // const parent = 'abc123' + /** + * The maximum number of deployments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListApiDeployments` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListApiDeployments` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiDeployments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiDeploymentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiDeployments(); + // [END apigeeregistry_v1_generated_Registry_ListApiDeployments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js new file mode 100644 index 0000000..1ee59f0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js @@ -0,0 +1,72 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec to list revisions for. + */ + // const name = 'abc123' + /** + * The maximum number of revisions to return per page. + */ + // const pageSize = 1234 + /** + * The page token, received from a previous ListApiSpecRevisions call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiSpecRevisions() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiSpecRevisionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiSpecRevisions(); + // [END apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js new file mode 100644 index 0000000..ed3c4e9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListApiSpecs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const parent = 'abc123' + /** + * The maximum number of specs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListApiSpecs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListApiSpecs` must match + * the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiSpecs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiSpecsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiSpecs(); + // [END apigeeregistry_v1_generated_Registry_ListApiSpecs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js new file mode 100644 index 0000000..01a6314 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListApiVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + */ + // const parent = 'abc123' + /** + * The maximum number of versions to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListApiVersions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListApiVersions` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiVersions(); + // [END apigeeregistry_v1_generated_Registry_ListApiVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js new file mode 100644 index 0000000..9280a53 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListApis_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The maximum number of APIs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListApis` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListApis` must match + * the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApis() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listApisAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApis(); + // [END apigeeregistry_v1_generated_Registry_ListApis_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js new file mode 100644 index 0000000..c5d2c3e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListArtifacts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + */ + // const parent = 'abc123' + /** + * The maximum number of artifacts to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListArtifacts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListArtifacts` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListArtifacts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listArtifactsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListArtifacts(); + // [END apigeeregistry_v1_generated_Registry_ListArtifacts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js new file mode 100644 index 0000000..af41ce8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js @@ -0,0 +1,63 @@ +// 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 +// +// 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'; + +function main(artifact) { + // [START apigeeregistry_v1_generated_Registry_ReplaceArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The artifact to replace. + * The `name` field is used to identify the artifact to replace. + * Format: `{parent}/artifacts/*` + */ + // const artifact = {} + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callReplaceArtifact() { + // Construct request + const request = { + artifact, + }; + + // Run request + const response = await apigeeregistryClient.replaceArtifact(request); + console.log(response); + } + + callReplaceArtifact(); + // [END apigeeregistry_v1_generated_Registry_ReplaceArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js new file mode 100644 index 0000000..022b8dc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js @@ -0,0 +1,68 @@ +// 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 +// +// 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'; + +function main(name, revisionId) { + // [START apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The deployment being rolled back. + */ + // const name = 'abc123' + /** + * Required. The revision ID to roll back to. + * It must be a revision of the same deployment. + * Example: `c7cfa2a8` + */ + // const revisionId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callRollbackApiDeployment() { + // Construct request + const request = { + name, + revisionId, + }; + + // Run request + const response = await apigeeregistryClient.rollbackApiDeployment(request); + console.log(response); + } + + callRollbackApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js new file mode 100644 index 0000000..d8acd25 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js @@ -0,0 +1,68 @@ +// 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 +// +// 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'; + +function main(name, revisionId) { + // [START apigeeregistry_v1_generated_Registry_RollbackApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The spec being rolled back. + */ + // const name = 'abc123' + /** + * Required. The revision ID to roll back to. + * It must be a revision of the same spec. + * Example: `c7cfa2a8` + */ + // const revisionId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callRollbackApiSpec() { + // Construct request + const request = { + name, + revisionId, + }; + + // Run request + const response = await apigeeregistryClient.rollbackApiSpec(request); + console.log(response); + } + + callRollbackApiSpec(); + // [END apigeeregistry_v1_generated_Registry_RollbackApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js new file mode 100644 index 0000000..5c386cc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name, tag) { + // [START apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment to be tagged, including the revision ID. + */ + // const name = 'abc123' + /** + * Required. The tag to apply. + * The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. + */ + // const tag = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callTagApiDeploymentRevision() { + // Construct request + const request = { + name, + tag, + }; + + // Run request + const response = await apigeeregistryClient.tagApiDeploymentRevision(request); + console.log(response); + } + + callTagApiDeploymentRevision(); + // [END apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js new file mode 100644 index 0000000..838836c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name, tag) { + // [START apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec to be tagged, including the revision ID. + */ + // const name = 'abc123' + /** + * Required. The tag to apply. + * The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. + */ + // const tag = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callTagApiSpecRevision() { + // Construct request + const request = { + name, + tag, + }; + + // Run request + const response = await apigeeregistryClient.tagApiSpecRevision(request); + console.log(response); + } + + callTagApiSpecRevision(); + // [END apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js new file mode 100644 index 0000000..8cb7e3d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js @@ -0,0 +1,75 @@ +// 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 +// +// 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'; + +function main(api) { + // [START apigeeregistry_v1_generated_Registry_UpdateApi_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The API to update. + * The `name` field is used to identify the API to update. + * Format: `projects/* /locations/* /apis/*` + */ + // const api = {} + /** + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + */ + // const updateMask = {} + /** + * If set to true, and the API is not found, a new API will be created. + * In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callUpdateApi() { + // Construct request + const request = { + api, + }; + + // Run request + const response = await apigeeregistryClient.updateApi(request); + console.log(response); + } + + callUpdateApi(); + // [END apigeeregistry_v1_generated_Registry_UpdateApi_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js new file mode 100644 index 0000000..2858dd4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js @@ -0,0 +1,75 @@ +// 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 +// +// 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'; + +function main(apiDeployment) { + // [START apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The deployment to update. + * The `name` field is used to identify the deployment to update. + * Format: `projects/* /locations/* /apis/* /deployments/*` + */ + // const apiDeployment = {} + /** + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + */ + // const updateMask = {} + /** + * If set to true, and the deployment is not found, a new deployment will be + * created. In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callUpdateApiDeployment() { + // Construct request + const request = { + apiDeployment, + }; + + // Run request + const response = await apigeeregistryClient.updateApiDeployment(request); + console.log(response); + } + + callUpdateApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js new file mode 100644 index 0000000..563ac37 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js @@ -0,0 +1,75 @@ +// 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 +// +// 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'; + +function main(apiSpec) { + // [START apigeeregistry_v1_generated_Registry_UpdateApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The spec to update. + * The `name` field is used to identify the spec to update. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + */ + // const apiSpec = {} + /** + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + */ + // const updateMask = {} + /** + * If set to true, and the spec is not found, a new spec will be created. + * In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callUpdateApiSpec() { + // Construct request + const request = { + apiSpec, + }; + + // Run request + const response = await apigeeregistryClient.updateApiSpec(request); + console.log(response); + } + + callUpdateApiSpec(); + // [END apigeeregistry_v1_generated_Registry_UpdateApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js new file mode 100644 index 0000000..59fb2f5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js @@ -0,0 +1,75 @@ +// 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 +// +// 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'; + +function main(apiVersion) { + // [START apigeeregistry_v1_generated_Registry_UpdateApiVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The version to update. + * The `name` field is used to identify the version to update. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const apiVersion = {} + /** + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + */ + // const updateMask = {} + /** + * If set to true, and the version is not found, a new version will be + * created. In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callUpdateApiVersion() { + // Construct request + const request = { + apiVersion, + }; + + // Run request + const response = await apigeeregistryClient.updateApiVersion(request); + console.log(response); + } + + callUpdateApiVersion(); + // [END apigeeregistry_v1_generated_Registry_UpdateApiVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json new file mode 100644 index 0000000..56680c6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json @@ -0,0 +1,1723 @@ +{ + "clientLibrary": { + "name": "nodejs-apigeeregistry", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.apigeeregistry.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "apigeeregistry_v1_generated_Provisioning_CreateInstance_async", + "title": "Provisioning createInstance Sample", + "origin": "API_DEFINITION", + "description": " Provisions instance resources for the Registry.", + "canonical": true, + "file": "provisioning.create_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.CreateInstance", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "instance_id", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": ".google.cloud.apigeeregistry.v1.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProvisioningClient", + "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" + }, + "method": { + "shortName": "CreateInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.CreateInstance", + "service": { + "shortName": "Provisioning", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Provisioning_DeleteInstance_async", + "title": "Provisioning deleteInstance Sample", + "origin": "API_DEFINITION", + "description": " Deletes the Registry instance.", + "canonical": true, + "file": "provisioning.delete_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.DeleteInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProvisioningClient", + "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" + }, + "method": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.DeleteInstance", + "service": { + "shortName": "Provisioning", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Provisioning_GetInstance_async", + "title": "Provisioning getInstance Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Instance.", + "canonical": true, + "file": "provisioning.get_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.GetInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Instance", + "client": { + "shortName": "ProvisioningClient", + "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" + }, + "method": { + "shortName": "GetInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.GetInstance", + "service": { + "shortName": "Provisioning", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApis_async", + "title": "Provisioning listApis Sample", + "origin": "API_DEFINITION", + "description": " Returns matching APIs.", + "canonical": true, + "file": "registry.list_apis.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApis", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApis", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApisResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApis", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApis", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApi_async", + "title": "Provisioning getApi Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified API.", + "canonical": true, + "file": "registry.get_api.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApi", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Api", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApi", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateApi_async", + "title": "Provisioning createApi Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified API.", + "canonical": true, + "file": "registry.create_api.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApi", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "api", + "type": ".google.cloud.apigeeregistry.v1.Api" + }, + { + "name": "api_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Api", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApi", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApi_async", + "title": "Provisioning updateApi Sample", + "origin": "API_DEFINITION", + "description": " Used to modify a specified API.", + "canonical": true, + "file": "registry.update_api.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApi", + "async": true, + "parameters": [ + { + "name": "api", + "type": ".google.cloud.apigeeregistry.v1.Api" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Api", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "UpdateApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApi", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApi_async", + "title": "Provisioning deleteApi Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified API and all of the resources that it owns.", + "canonical": true, + "file": "registry.delete_api.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApi", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApi", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiVersions_async", + "title": "Provisioning listApiVersions Sample", + "origin": "API_DEFINITION", + "description": " Returns matching versions.", + "canonical": true, + "file": "registry.list_api_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiVersions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiVersions", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiVersionsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiVersions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiVersions", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApiVersion_async", + "title": "Provisioning getApiVersion Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified version.", + "canonical": true, + "file": "registry.get_api_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiVersion", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiVersion_async", + "title": "Provisioning createApiVersion Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified version.", + "canonical": true, + "file": "registry.create_api_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "api_version", + "type": ".google.cloud.apigeeregistry.v1.ApiVersion" + }, + { + "name": "api_version_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiVersion", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiVersion_async", + "title": "Provisioning updateApiVersion Sample", + "origin": "API_DEFINITION", + "description": " Used to modify a specified version.", + "canonical": true, + "file": "registry.update_api_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiVersion", + "async": true, + "parameters": [ + { + "name": "api_version", + "type": ".google.cloud.apigeeregistry.v1.ApiVersion" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "UpdateApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiVersion", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiVersion_async", + "title": "Provisioning deleteApiVersion Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified version and all of the resources that it owns.", + "canonical": true, + "file": "registry.delete_api_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiVersion", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiSpecs_async", + "title": "Provisioning listApiSpecs Sample", + "origin": "API_DEFINITION", + "description": " Returns matching specs.", + "canonical": true, + "file": "registry.list_api_specs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiSpecs", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecs", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiSpecsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiSpecs", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecs", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApiSpec_async", + "title": "Provisioning getApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified spec.", + "canonical": true, + "file": "registry.get_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpec", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApiSpecContents_async", + "title": "Provisioning getApiSpecContents Sample", + "origin": "API_DEFINITION", + "description": " Returns the contents of a specified spec. If specs are stored with GZip compression, the default behavior is to return the spec uncompressed (the mime_type response field indicates the exact format returned).", + "canonical": true, + "file": "registry.get_api_spec_contents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApiSpecContents", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpecContents", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApiSpecContents", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpecContents", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiSpec_async", + "title": "Provisioning createApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified spec.", + "canonical": true, + "file": "registry.create_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiSpec", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "api_spec", + "type": ".google.cloud.apigeeregistry.v1.ApiSpec" + }, + { + "name": "api_spec_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiSpec_async", + "title": "Provisioning updateApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Used to modify a specified spec.", + "canonical": true, + "file": "registry.update_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiSpec", + "async": true, + "parameters": [ + { + "name": "api_spec", + "type": ".google.cloud.apigeeregistry.v1.ApiSpec" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "UpdateApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiSpec_async", + "title": "Provisioning deleteApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified spec, all revisions, and all child resources (e.g., artifacts).", + "canonical": true, + "file": "registry.delete_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpec", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async", + "title": "Provisioning tagApiSpecRevision Sample", + "origin": "API_DEFINITION", + "description": " Adds a tag to a specified revision of a spec.", + "canonical": true, + "file": "registry.tag_api_spec_revision.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TagApiSpecRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiSpecRevision", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "tag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "TagApiSpecRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiSpecRevision", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async", + "title": "Provisioning listApiSpecRevisions Sample", + "origin": "API_DEFINITION", + "description": " Lists all revisions of a spec. Revisions are returned in descending order of revision creation time.", + "canonical": true, + "file": "registry.list_api_spec_revisions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiSpecRevisions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecRevisions", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiSpecRevisionsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiSpecRevisions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecRevisions", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_RollbackApiSpec_async", + "title": "Provisioning rollbackApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID.", + "canonical": true, + "file": "registry.rollback_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RollbackApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiSpec", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "revision_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "RollbackApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async", + "title": "Provisioning deleteApiSpecRevision Sample", + "origin": "API_DEFINITION", + "description": " Deletes a revision of a spec.", + "canonical": true, + "file": "registry.delete_api_spec_revision.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiSpecRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpecRevision", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiSpecRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpecRevision", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiDeployments_async", + "title": "Provisioning listApiDeployments Sample", + "origin": "API_DEFINITION", + "description": " Returns matching deployments.", + "canonical": true, + "file": "registry.list_api_deployments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiDeployments", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeployments", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiDeploymentsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiDeployments", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeployments", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApiDeployment_async", + "title": "Provisioning getApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified deployment.", + "canonical": true, + "file": "registry.get_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiDeployment_async", + "title": "Provisioning createApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified deployment.", + "canonical": true, + "file": "registry.create_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiDeployment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "api_deployment", + "type": ".google.cloud.apigeeregistry.v1.ApiDeployment" + }, + { + "name": "api_deployment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async", + "title": "Provisioning updateApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Used to modify a specified deployment.", + "canonical": true, + "file": "registry.update_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiDeployment", + "async": true, + "parameters": [ + { + "name": "api_deployment", + "type": ".google.cloud.apigeeregistry.v1.ApiDeployment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "UpdateApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async", + "title": "Provisioning deleteApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified deployment, all revisions, and all child resources (e.g., artifacts).", + "canonical": true, + "file": "registry.delete_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async", + "title": "Provisioning tagApiDeploymentRevision Sample", + "origin": "API_DEFINITION", + "description": " Adds a tag to a specified revision of a deployment.", + "canonical": true, + "file": "registry.tag_api_deployment_revision.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TagApiDeploymentRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiDeploymentRevision", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "tag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "TagApiDeploymentRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiDeploymentRevision", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async", + "title": "Provisioning listApiDeploymentRevisions Sample", + "origin": "API_DEFINITION", + "description": " Lists all revisions of a deployment. Revisions are returned in descending order of revision creation time.", + "canonical": true, + "file": "registry.list_api_deployment_revisions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiDeploymentRevisions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeploymentRevisions", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiDeploymentRevisions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeploymentRevisions", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async", + "title": "Provisioning rollbackApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID.", + "canonical": true, + "file": "registry.rollback_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RollbackApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "revision_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "RollbackApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async", + "title": "Provisioning deleteApiDeploymentRevision Sample", + "origin": "API_DEFINITION", + "description": " Deletes a revision of a deployment.", + "canonical": true, + "file": "registry.delete_api_deployment_revision.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiDeploymentRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeploymentRevision", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiDeploymentRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeploymentRevision", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListArtifacts_async", + "title": "Provisioning listArtifacts Sample", + "origin": "API_DEFINITION", + "description": " Returns matching artifacts.", + "canonical": true, + "file": "registry.list_artifacts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListArtifacts", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListArtifacts", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListArtifactsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListArtifacts", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListArtifacts", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetArtifact_async", + "title": "Provisioning getArtifact Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified artifact.", + "canonical": true, + "file": "registry.get_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifact", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Artifact", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifact", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetArtifactContents_async", + "title": "Provisioning getArtifactContents Sample", + "origin": "API_DEFINITION", + "description": " Returns the contents of a specified artifact. If artifacts are stored with GZip compression, the default behavior is to return the artifact uncompressed (the mime_type response field indicates the exact format returned).", + "canonical": true, + "file": "registry.get_artifact_contents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetArtifactContents", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifactContents", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetArtifactContents", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifactContents", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateArtifact_async", + "title": "Provisioning createArtifact Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified artifact.", + "canonical": true, + "file": "registry.create_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateArtifact", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "artifact", + "type": ".google.cloud.apigeeregistry.v1.Artifact" + }, + { + "name": "artifact_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Artifact", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateArtifact", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ReplaceArtifact_async", + "title": "Provisioning replaceArtifact Sample", + "origin": "API_DEFINITION", + "description": " Used to replace a specified artifact.", + "canonical": true, + "file": "registry.replace_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ReplaceArtifact", + "async": true, + "parameters": [ + { + "name": "artifact", + "type": ".google.cloud.apigeeregistry.v1.Artifact" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Artifact", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ReplaceArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ReplaceArtifact", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteArtifact_async", + "title": "Provisioning deleteArtifact Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified artifact.", + "canonical": true, + "file": "registry.delete_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteArtifact", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteArtifact", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..9fa6563 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,27 @@ +// 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 +// +// 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. ** + +import * as v1 from './v1'; +const ProvisioningClient = v1.ProvisioningClient; +type ProvisioningClient = v1.ProvisioningClient; +const RegistryClient = v1.RegistryClient; +type RegistryClient = v1.RegistryClient; +export {v1, ProvisioningClient, RegistryClient}; +export default {v1, ProvisioningClient, RegistryClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..783049f --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,445 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.apigeeregistry.v1", + "libraryPackage": "@google-cloud/apigee-registry", + "services": { + "Provisioning": { + "clients": { + "grpc": { + "libraryClient": "ProvisioningClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ProvisioningClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + } + } + } + } + }, + "Registry": { + "clients": { + "grpc": { + "libraryClient": "RegistryClient", + "rpcs": { + "GetApi": { + "methods": [ + "getApi" + ] + }, + "CreateApi": { + "methods": [ + "createApi" + ] + }, + "UpdateApi": { + "methods": [ + "updateApi" + ] + }, + "DeleteApi": { + "methods": [ + "deleteApi" + ] + }, + "GetApiVersion": { + "methods": [ + "getApiVersion" + ] + }, + "CreateApiVersion": { + "methods": [ + "createApiVersion" + ] + }, + "UpdateApiVersion": { + "methods": [ + "updateApiVersion" + ] + }, + "DeleteApiVersion": { + "methods": [ + "deleteApiVersion" + ] + }, + "GetApiSpec": { + "methods": [ + "getApiSpec" + ] + }, + "GetApiSpecContents": { + "methods": [ + "getApiSpecContents" + ] + }, + "CreateApiSpec": { + "methods": [ + "createApiSpec" + ] + }, + "UpdateApiSpec": { + "methods": [ + "updateApiSpec" + ] + }, + "DeleteApiSpec": { + "methods": [ + "deleteApiSpec" + ] + }, + "TagApiSpecRevision": { + "methods": [ + "tagApiSpecRevision" + ] + }, + "RollbackApiSpec": { + "methods": [ + "rollbackApiSpec" + ] + }, + "DeleteApiSpecRevision": { + "methods": [ + "deleteApiSpecRevision" + ] + }, + "GetApiDeployment": { + "methods": [ + "getApiDeployment" + ] + }, + "CreateApiDeployment": { + "methods": [ + "createApiDeployment" + ] + }, + "UpdateApiDeployment": { + "methods": [ + "updateApiDeployment" + ] + }, + "DeleteApiDeployment": { + "methods": [ + "deleteApiDeployment" + ] + }, + "TagApiDeploymentRevision": { + "methods": [ + "tagApiDeploymentRevision" + ] + }, + "RollbackApiDeployment": { + "methods": [ + "rollbackApiDeployment" + ] + }, + "DeleteApiDeploymentRevision": { + "methods": [ + "deleteApiDeploymentRevision" + ] + }, + "GetArtifact": { + "methods": [ + "getArtifact" + ] + }, + "GetArtifactContents": { + "methods": [ + "getArtifactContents" + ] + }, + "CreateArtifact": { + "methods": [ + "createArtifact" + ] + }, + "ReplaceArtifact": { + "methods": [ + "replaceArtifact" + ] + }, + "DeleteArtifact": { + "methods": [ + "deleteArtifact" + ] + }, + "ListApis": { + "methods": [ + "listApis", + "listApisStream", + "listApisAsync" + ] + }, + "ListApiVersions": { + "methods": [ + "listApiVersions", + "listApiVersionsStream", + "listApiVersionsAsync" + ] + }, + "ListApiSpecs": { + "methods": [ + "listApiSpecs", + "listApiSpecsStream", + "listApiSpecsAsync" + ] + }, + "ListApiSpecRevisions": { + "methods": [ + "listApiSpecRevisions", + "listApiSpecRevisionsStream", + "listApiSpecRevisionsAsync" + ] + }, + "ListApiDeployments": { + "methods": [ + "listApiDeployments", + "listApiDeploymentsStream", + "listApiDeploymentsAsync" + ] + }, + "ListApiDeploymentRevisions": { + "methods": [ + "listApiDeploymentRevisions", + "listApiDeploymentRevisionsStream", + "listApiDeploymentRevisionsAsync" + ] + }, + "ListArtifacts": { + "methods": [ + "listArtifacts", + "listArtifactsStream", + "listArtifactsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "RegistryClient", + "rpcs": { + "GetApi": { + "methods": [ + "getApi" + ] + }, + "CreateApi": { + "methods": [ + "createApi" + ] + }, + "UpdateApi": { + "methods": [ + "updateApi" + ] + }, + "DeleteApi": { + "methods": [ + "deleteApi" + ] + }, + "GetApiVersion": { + "methods": [ + "getApiVersion" + ] + }, + "CreateApiVersion": { + "methods": [ + "createApiVersion" + ] + }, + "UpdateApiVersion": { + "methods": [ + "updateApiVersion" + ] + }, + "DeleteApiVersion": { + "methods": [ + "deleteApiVersion" + ] + }, + "GetApiSpec": { + "methods": [ + "getApiSpec" + ] + }, + "GetApiSpecContents": { + "methods": [ + "getApiSpecContents" + ] + }, + "CreateApiSpec": { + "methods": [ + "createApiSpec" + ] + }, + "UpdateApiSpec": { + "methods": [ + "updateApiSpec" + ] + }, + "DeleteApiSpec": { + "methods": [ + "deleteApiSpec" + ] + }, + "TagApiSpecRevision": { + "methods": [ + "tagApiSpecRevision" + ] + }, + "RollbackApiSpec": { + "methods": [ + "rollbackApiSpec" + ] + }, + "DeleteApiSpecRevision": { + "methods": [ + "deleteApiSpecRevision" + ] + }, + "GetApiDeployment": { + "methods": [ + "getApiDeployment" + ] + }, + "CreateApiDeployment": { + "methods": [ + "createApiDeployment" + ] + }, + "UpdateApiDeployment": { + "methods": [ + "updateApiDeployment" + ] + }, + "DeleteApiDeployment": { + "methods": [ + "deleteApiDeployment" + ] + }, + "TagApiDeploymentRevision": { + "methods": [ + "tagApiDeploymentRevision" + ] + }, + "RollbackApiDeployment": { + "methods": [ + "rollbackApiDeployment" + ] + }, + "DeleteApiDeploymentRevision": { + "methods": [ + "deleteApiDeploymentRevision" + ] + }, + "GetArtifact": { + "methods": [ + "getArtifact" + ] + }, + "GetArtifactContents": { + "methods": [ + "getArtifactContents" + ] + }, + "CreateArtifact": { + "methods": [ + "createArtifact" + ] + }, + "ReplaceArtifact": { + "methods": [ + "replaceArtifact" + ] + }, + "DeleteArtifact": { + "methods": [ + "deleteArtifact" + ] + }, + "ListApis": { + "methods": [ + "listApis", + "listApisStream", + "listApisAsync" + ] + }, + "ListApiVersions": { + "methods": [ + "listApiVersions", + "listApiVersionsStream", + "listApiVersionsAsync" + ] + }, + "ListApiSpecs": { + "methods": [ + "listApiSpecs", + "listApiSpecsStream", + "listApiSpecsAsync" + ] + }, + "ListApiSpecRevisions": { + "methods": [ + "listApiSpecRevisions", + "listApiSpecRevisionsStream", + "listApiSpecRevisionsAsync" + ] + }, + "ListApiDeployments": { + "methods": [ + "listApiDeployments", + "listApiDeploymentsStream", + "listApiDeploymentsAsync" + ] + }, + "ListApiDeploymentRevisions": { + "methods": [ + "listApiDeploymentRevisions", + "listApiDeploymentRevisionsStream", + "listApiDeploymentRevisionsAsync" + ] + }, + "ListArtifacts": { + "methods": [ + "listArtifacts", + "listArtifactsStream", + "listArtifactsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..03a07e1 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,20 @@ +// 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 +// +// 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. ** + +export {ProvisioningClient} from './provisioning_client'; +export {RegistryClient} from './registry_client'; diff --git a/owl-bot-staging/v1/src/v1/provisioning_client.ts b/owl-bot-staging/v1/src/v1/provisioning_client.ts new file mode 100644 index 0000000..729abd9 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/provisioning_client.ts @@ -0,0 +1,1737 @@ +// 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 +// +// 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/provisioning_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './provisioning_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The service that is used for managing the data plane provisioning of the + * Registry. + * @class + * @memberof v1 + */ +export class ProvisioningClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + provisioningStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProvisioningClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ProvisioningClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ProvisioningClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + apiPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}' + ), + apiDeploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}' + ), + apiSpecPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}' + ), + apiVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectLocationApiArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}' + ), + projectLocationApiDeploymentArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}' + ), + projectLocationApiVersionArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}' + ), + projectLocationApiVersionSpecArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}' + ), + projectLocationArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/artifacts/{artifact}' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/apis/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/instances/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/runtime}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/apis/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/apis/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.apigeeregistry.v1.Instance') as gax.protobuf.Type; + const createInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.apigeeregistry.v1.OperationMetadata') as gax.protobuf.Type; + const deleteInstanceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.apigeeregistry.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInstanceResponse.decode.bind(createInstanceResponse), + createInstanceMetadata.decode.bind(createInstanceMetadata)), + deleteInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteInstanceResponse.decode.bind(deleteInstanceResponse), + deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.apigeeregistry.v1.Provisioning', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.provisioningStub) { + return this.provisioningStub; + } + + // Put together the "service stub" for + // google.cloud.apigeeregistry.v1.Provisioning. + this.provisioningStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.apigeeregistry.v1.Provisioning') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.apigeeregistry.v1.Provisioning, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const provisioningStubMethods = + ['createInstance', 'deleteInstance', 'getInstance']; + for (const methodName of provisioningStubMethods) { + const callPromise = this.provisioningStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.provisioningStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'apigeeregistry.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'apigeeregistry.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets details of a single Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Instance to retrieve. + * Format: `projects/* /locations/* /instances/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Instance]{@link google.cloud.apigeeregistry.v1.Instance}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.get_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_GetInstance_async + */ + getInstance( + request?: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|undefined, {}|undefined + ]>; + getInstance( + request: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request?: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getInstance(request, options, callback); + } + +/** + * Provisions instance resources for the Registry. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource of the Instance, of the form: `projects/* /locations/*` + * @param {string} request.instanceId + * Required. Identifier to assign to the Instance. Must be unique within scope of the + * parent resource. + * @param {google.cloud.apigeeregistry.v1.Instance} request.instance + * Required. The Instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.create_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_CreateInstance_async + */ + createInstance( + request?: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createInstance( + request: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request?: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.create_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_CreateInstance_async + */ + async checkCreateInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the Registry instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Instance to delete. + * Format: `projects/* /locations/* /instances/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.delete_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_DeleteInstance_async + */ + deleteInstance( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteInstance( + request: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.delete_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_DeleteInstance_async + */ + async checkDeleteInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified api resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @returns {string} Resource name string. + */ + apiPath(project:string,location:string,api:string) { + return this.pathTemplates.apiPathTemplate.render({ + project: project, + location: location, + api: api, + }); + } + + /** + * Parse the project from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).project; + } + + /** + * Parse the location from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).location; + } + + /** + * Parse the api from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).api; + } + + /** + * Return a fully-qualified apiDeployment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} deployment + * @returns {string} Resource name string. + */ + apiDeploymentPath(project:string,location:string,api:string,deployment:string) { + return this.pathTemplates.apiDeploymentPathTemplate.render({ + project: project, + location: location, + api: api, + deployment: deployment, + }); + } + + /** + * Parse the project from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).project; + } + + /** + * Parse the location from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).location; + } + + /** + * Parse the api from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).api; + } + + /** + * Parse the deployment from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).deployment; + } + + /** + * Return a fully-qualified apiSpec resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} spec + * @returns {string} Resource name string. + */ + apiSpecPath(project:string,location:string,api:string,version:string,spec:string) { + return this.pathTemplates.apiSpecPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + spec: spec, + }); + } + + /** + * Parse the project from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).project; + } + + /** + * Parse the location from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).location; + } + + /** + * Parse the api from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).api; + } + + /** + * Parse the version from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the version. + */ + matchVersionFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).version; + } + + /** + * Parse the spec from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the spec. + */ + matchSpecFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).spec; + } + + /** + * Return a fully-qualified apiVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @returns {string} Resource name string. + */ + apiVersionPath(project:string,location:string,api:string,version:string) { + return this.pathTemplates.apiVersionPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + }); + } + + /** + * Parse the project from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).project; + } + + /** + * Parse the location from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).location; + } + + /** + * Parse the api from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).api; + } + + /** + * Parse the version from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the version. + */ + matchVersionFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).version; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).location; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified projectLocationApiArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiArtifactPath(project:string,location:string,api:string,artifact:string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).api; + } + + /** + * Parse the artifact from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiDeploymentArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} deployment + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiDeploymentArtifactPath(project:string,location:string,api:string,deployment:string,artifact:string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + deployment: deployment, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).api; + } + + /** + * Parse the deployment from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).deployment; + } + + /** + * Parse the artifact from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiVersionArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiVersionArtifactPath(project:string,location:string,api:string,version:string,artifact:string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).api; + } + + /** + * Parse the version from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).version; + } + + /** + * Parse the artifact from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiVersionSpecArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} spec + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiVersionSpecArtifactPath(project:string,location:string,api:string,version:string,spec:string,artifact:string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + spec: spec, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).api; + } + + /** + * Parse the version from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).version; + } + + /** + * Parse the spec from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the spec. + */ + matchSpecFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).spec; + } + + /** + * Parse the artifact from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationArtifactPath(project:string,location:string,artifact:string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.render({ + project: project, + location: location, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).project; + } + + /** + * Parse the location from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).location; + } + + /** + * Parse the artifact from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).artifact; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.provisioningStub && !this._terminated) { + return this.provisioningStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/provisioning_client_config.json b/owl-bot-staging/v1/src/v1/provisioning_client_config.json new file mode 100644 index 0000000..2e37ea8 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/provisioning_client_config.json @@ -0,0 +1,38 @@ +{ + "interfaces": { + "google.cloud.apigeeregistry.v1.Provisioning": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateInstance": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteInstance": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetInstance": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/provisioning_proto_list.json b/owl-bot-staging/v1/src/v1/provisioning_proto_list.json new file mode 100644 index 0000000..4fdc846 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/provisioning_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/apigeeregistry/v1/provisioning_service.proto", + "../../protos/google/cloud/apigeeregistry/v1/registry_models.proto", + "../../protos/google/cloud/apigeeregistry/v1/registry_service.proto" +] diff --git a/owl-bot-staging/v1/src/v1/registry_client.ts b/owl-bot-staging/v1/src/v1/registry_client.ts new file mode 100644 index 0000000..825d8b1 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/registry_client.ts @@ -0,0 +1,5041 @@ +// 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 +// +// 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/registry_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './registry_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Registry service allows teams to manage descriptions of APIs. + * @class + * @memberof v1 + */ +export class RegistryClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + registryStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of RegistryClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new RegistryClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof RegistryClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + apiPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}' + ), + apiDeploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}' + ), + apiSpecPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}' + ), + apiVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationApiArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}' + ), + projectLocationApiDeploymentArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}' + ), + projectLocationApiVersionArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}' + ), + projectLocationApiVersionSpecArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}' + ), + projectLocationArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/artifacts/{artifact}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listApis: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apis'), + listApiVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiVersions'), + listApiSpecs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiSpecs'), + listApiSpecRevisions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiSpecs'), + listApiDeployments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiDeployments'), + listApiDeploymentRevisions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiDeployments'), + listArtifacts: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'artifacts') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/apis/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/instances/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/runtime}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/apis/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/apis/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + + this.descriptors.longrunning = { + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.apigeeregistry.v1.Registry', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.registryStub) { + return this.registryStub; + } + + // Put together the "service stub" for + // google.cloud.apigeeregistry.v1.Registry. + this.registryStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.apigeeregistry.v1.Registry') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.apigeeregistry.v1.Registry, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const registryStubMethods = + ['listApis', 'getApi', 'createApi', 'updateApi', 'deleteApi', 'listApiVersions', 'getApiVersion', 'createApiVersion', 'updateApiVersion', 'deleteApiVersion', 'listApiSpecs', 'getApiSpec', 'getApiSpecContents', 'createApiSpec', 'updateApiSpec', 'deleteApiSpec', 'tagApiSpecRevision', 'listApiSpecRevisions', 'rollbackApiSpec', 'deleteApiSpecRevision', 'listApiDeployments', 'getApiDeployment', 'createApiDeployment', 'updateApiDeployment', 'deleteApiDeployment', 'tagApiDeploymentRevision', 'listApiDeploymentRevisions', 'rollbackApiDeployment', 'deleteApiDeploymentRevision', 'listArtifacts', 'getArtifact', 'getArtifactContents', 'createArtifact', 'replaceArtifact', 'deleteArtifact']; + for (const methodName of registryStubMethods) { + const callPromise = this.registryStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.registryStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'apigeeregistry.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'apigeeregistry.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Returns a specified API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the API to retrieve. + * Format: `projects/* /locations/* /apis/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApi_async + */ + getApi( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|undefined, {}|undefined + ]>; + getApi( + request: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, + {}|null|undefined>): void; + getApi( + request: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, + {}|null|undefined>): void; + getApi( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApi(request, options, callback); + } +/** + * Creates a specified API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + * @param {google.cloud.apigeeregistry.v1.Api} request.api + * Required. The API to create. + * @param {string} request.apiId + * Required. The ID to use for the API, which will become the final component of + * the API's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_api.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateApi_async + */ + createApi( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|undefined, {}|undefined + ]>; + createApi( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, + {}|null|undefined>): void; + createApi( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, + {}|null|undefined>): void; + createApi( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createApi(request, options, callback); + } +/** + * Used to modify a specified API. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.Api} request.api + * Required. The API to update. + * + * The `name` field is used to identify the API to update. + * Format: `projects/* /locations/* /apis/*` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + * @param {boolean} request.allowMissing + * If set to true, and the API is not found, a new API will be created. + * In this situation, `update_mask` is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.update_api.js + * region_tag:apigeeregistry_v1_generated_Registry_UpdateApi_async + */ + updateApi( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|undefined, {}|undefined + ]>; + updateApi( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, + {}|null|undefined>): void; + updateApi( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, + {}|null|undefined>): void; + updateApi( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'api.name': request.api!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateApi(request, options, callback); + } +/** + * Removes a specified API and all of the resources that it + * owns. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the API to delete. + * Format: `projects/* /locations/* /apis/*` + * @param {boolean} request.force + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApi_async + */ + deleteApi( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|undefined, {}|undefined + ]>; + deleteApi( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, + {}|null|undefined>): void; + deleteApi( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, + {}|null|undefined>): void; + deleteApi( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApi(request, options, callback); + } +/** + * Returns a specified version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version to retrieve. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api_version.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApiVersion_async + */ + getApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|undefined, {}|undefined + ]>; + getApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, + {}|null|undefined>): void; + getApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, + {}|null|undefined>): void; + getApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApiVersion(request, options, callback); + } +/** + * Creates a specified version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + * @param {google.cloud.apigeeregistry.v1.ApiVersion} request.apiVersion + * Required. The version to create. + * @param {string} request.apiVersionId + * Required. The ID to use for the version, which will become the final component of + * the version's resource name. + * + * This value should be 1-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_api_version.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateApiVersion_async + */ + createApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|undefined, {}|undefined + ]>; + createApiVersion( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, + {}|null|undefined>): void; + createApiVersion( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, + {}|null|undefined>): void; + createApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createApiVersion(request, options, callback); + } +/** + * Used to modify a specified version. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.ApiVersion} request.apiVersion + * Required. The version to update. + * + * The `name` field is used to identify the version to update. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + * @param {boolean} request.allowMissing + * If set to true, and the version is not found, a new version will be + * created. In this situation, `update_mask` is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.update_api_version.js + * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiVersion_async + */ + updateApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|undefined, {}|undefined + ]>; + updateApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, + {}|null|undefined>): void; + updateApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, + {}|null|undefined>): void; + updateApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'api_version.name': request.apiVersion!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateApiVersion(request, options, callback); + } +/** + * Removes a specified version and all of the resources that + * it owns. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version to delete. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {boolean} request.force + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_version.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiVersion_async + */ + deleteApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|undefined, {}|undefined + ]>; + deleteApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiVersion(request, options, callback); + } +/** + * Returns a specified spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to retrieve. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApiSpec_async + */ + getApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|undefined, {}|undefined + ]>; + getApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, + {}|null|undefined>): void; + getApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, + {}|null|undefined>): void; + getApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApiSpec(request, options, callback); + } +/** + * Returns the contents of a specified spec. + * If specs are stored with GZip compression, the default behavior + * is to return the spec uncompressed (the mime_type response field + * indicates the exact format returned). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec whose contents should be retrieved. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api_spec_contents.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApiSpecContents_async + */ + getApiSpecContents( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|undefined, {}|undefined + ]>; + getApiSpecContents( + request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, + {}|null|undefined>): void; + getApiSpecContents( + request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, + {}|null|undefined>): void; + getApiSpecContents( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApiSpecContents(request, options, callback); + } +/** + * Creates a specified spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {google.cloud.apigeeregistry.v1.ApiSpec} request.apiSpec + * Required. The spec to create. + * @param {string} request.apiSpecId + * Required. The ID to use for the spec, which will become the final component of + * the spec's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateApiSpec_async + */ + createApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|undefined, {}|undefined + ]>; + createApiSpec( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, + {}|null|undefined>): void; + createApiSpec( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, + {}|null|undefined>): void; + createApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createApiSpec(request, options, callback); + } +/** + * Used to modify a specified spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.ApiSpec} request.apiSpec + * Required. The spec to update. + * + * The `name` field is used to identify the spec to update. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + * @param {boolean} request.allowMissing + * If set to true, and the spec is not found, a new spec will be created. + * In this situation, `update_mask` is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.update_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiSpec_async + */ + updateApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|undefined, {}|undefined + ]>; + updateApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, + {}|null|undefined>): void; + updateApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, + {}|null|undefined>): void; + updateApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'api_spec.name': request.apiSpec!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateApiSpec(request, options, callback); + } +/** + * Removes a specified spec, all revisions, and all child + * resources (e.g., artifacts). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to delete. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + * @param {boolean} request.force + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiSpec_async + */ + deleteApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|undefined, {}|undefined + ]>; + deleteApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, + {}|null|undefined>): void; + deleteApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, + {}|null|undefined>): void; + deleteApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiSpec(request, options, callback); + } +/** + * Adds a tag to a specified revision of a spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to be tagged, including the revision ID. + * @param {string} request.tag + * Required. The tag to apply. + * The tag should be at most 40 characters, and match `{@link a-z0-9-|a-z}{3,39}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.tag_api_spec_revision.js + * region_tag:apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async + */ + tagApiSpecRevision( + request?: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|undefined, {}|undefined + ]>; + tagApiSpecRevision( + request: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): void; + tagApiSpecRevision( + request: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): void; + tagApiSpecRevision( + request?: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.tagApiSpecRevision(request, options, callback); + } +/** + * Sets the current revision to a specified prior revision. + * Note that this creates a new revision with a new revision ID. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The spec being rolled back. + * @param {string} request.revisionId + * Required. The revision ID to roll back to. + * It must be a revision of the same spec. + * + * Example: `c7cfa2a8` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.rollback_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_RollbackApiSpec_async + */ + rollbackApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|undefined, {}|undefined + ]>; + rollbackApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, + {}|null|undefined>): void; + rollbackApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, + {}|null|undefined>): void; + rollbackApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.rollbackApiSpec(request, options, callback); + } +/** + * Deletes a revision of a spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec revision to be deleted, + * with a revision ID explicitly included. + * + * Example: + * `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_spec_revision.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async + */ + deleteApiSpecRevision( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|undefined, {}|undefined + ]>; + deleteApiSpecRevision( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiSpecRevision( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiSpecRevision( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiSpecRevision(request, options, callback); + } +/** + * Returns a specified deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to retrieve. + * Format: `projects/* /locations/* /apis/* /deployments/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApiDeployment_async + */ + getApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|undefined, {}|undefined + ]>; + getApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + getApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + getApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApiDeployment(request, options, callback); + } +/** + * Creates a specified deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + * @param {google.cloud.apigeeregistry.v1.ApiDeployment} request.apiDeployment + * Required. The deployment to create. + * @param {string} request.apiDeploymentId + * Required. The ID to use for the deployment, which will become the final component of + * the deployment's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateApiDeployment_async + */ + createApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|undefined, {}|undefined + ]>; + createApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + createApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + createApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createApiDeployment(request, options, callback); + } +/** + * Used to modify a specified deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.ApiDeployment} request.apiDeployment + * Required. The deployment to update. + * + * The `name` field is used to identify the deployment to update. + * Format: `projects/* /locations/* /apis/* /deployments/*` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + * @param {boolean} request.allowMissing + * If set to true, and the deployment is not found, a new deployment will be + * created. In this situation, `update_mask` is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.update_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async + */ + updateApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|undefined, {}|undefined + ]>; + updateApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + updateApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + updateApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'api_deployment.name': request.apiDeployment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateApiDeployment(request, options, callback); + } +/** + * Removes a specified deployment, all revisions, and all + * child resources (e.g., artifacts). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to delete. + * Format: `projects/* /locations/* /apis/* /deployments/*` + * @param {boolean} request.force + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async + */ + deleteApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|undefined, {}|undefined + ]>; + deleteApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + deleteApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + deleteApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiDeployment(request, options, callback); + } +/** + * Adds a tag to a specified revision of a + * deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to be tagged, including the revision ID. + * @param {string} request.tag + * Required. The tag to apply. + * The tag should be at most 40 characters, and match `{@link a-z0-9-|a-z}{3,39}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.tag_api_deployment_revision.js + * region_tag:apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async + */ + tagApiDeploymentRevision( + request?: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|undefined, {}|undefined + ]>; + tagApiDeploymentRevision( + request: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): void; + tagApiDeploymentRevision( + request: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): void; + tagApiDeploymentRevision( + request?: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.tagApiDeploymentRevision(request, options, callback); + } +/** + * Sets the current revision to a specified prior + * revision. Note that this creates a new revision with a new revision ID. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The deployment being rolled back. + * @param {string} request.revisionId + * Required. The revision ID to roll back to. + * It must be a revision of the same deployment. + * + * Example: `c7cfa2a8` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.rollback_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async + */ + rollbackApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|undefined, {}|undefined + ]>; + rollbackApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + rollbackApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + rollbackApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.rollbackApiDeployment(request, options, callback); + } +/** + * Deletes a revision of a deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment revision to be deleted, + * with a revision ID explicitly included. + * + * Example: + * `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_deployment_revision.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async + */ + deleteApiDeploymentRevision( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|undefined, {}|undefined + ]>; + deleteApiDeploymentRevision( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiDeploymentRevision( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiDeploymentRevision( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiDeploymentRevision(request, options, callback); + } +/** + * Returns a specified artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the artifact to retrieve. + * Format: `{parent}/artifacts/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_artifact.js + * region_tag:apigeeregistry_v1_generated_Registry_GetArtifact_async + */ + getArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|undefined, {}|undefined + ]>; + getArtifact( + request: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, + {}|null|undefined>): void; + getArtifact( + request: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, + {}|null|undefined>): void; + getArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getArtifact(request, options, callback); + } +/** + * Returns the contents of a specified artifact. + * If artifacts are stored with GZip compression, the default behavior + * is to return the artifact uncompressed (the mime_type response field + * indicates the exact format returned). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the artifact whose contents should be retrieved. + * Format: `{parent}/artifacts/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_artifact_contents.js + * region_tag:apigeeregistry_v1_generated_Registry_GetArtifactContents_async + */ + getArtifactContents( + request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|undefined, {}|undefined + ]>; + getArtifactContents( + request: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, + {}|null|undefined>): void; + getArtifactContents( + request: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, + {}|null|undefined>): void; + getArtifactContents( + request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getArtifactContents(request, options, callback); + } +/** + * Creates a specified artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + * @param {google.cloud.apigeeregistry.v1.Artifact} request.artifact + * Required. The artifact to create. + * @param {string} request.artifactId + * Required. The ID to use for the artifact, which will become the final component of + * the artifact's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_artifact.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateArtifact_async + */ + createArtifact( + request?: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|undefined, {}|undefined + ]>; + createArtifact( + request: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, + {}|null|undefined>): void; + createArtifact( + request: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, + {}|null|undefined>): void; + createArtifact( + request?: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createArtifact(request, options, callback); + } +/** + * Used to replace a specified artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.Artifact} request.artifact + * Required. The artifact to replace. + * + * The `name` field is used to identify the artifact to replace. + * Format: `{parent}/artifacts/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.replace_artifact.js + * region_tag:apigeeregistry_v1_generated_Registry_ReplaceArtifact_async + */ + replaceArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|undefined, {}|undefined + ]>; + replaceArtifact( + request: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, + {}|null|undefined>): void; + replaceArtifact( + request: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, + {}|null|undefined>): void; + replaceArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'artifact.name': request.artifact!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.replaceArtifact(request, options, callback); + } +/** + * Removes a specified artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the artifact to delete. + * Format: `{parent}/artifacts/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_artifact.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteArtifact_async + */ + deleteArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|undefined, {}|undefined + ]>; + deleteArtifact( + request: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, + {}|null|undefined>): void; + deleteArtifact( + request: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, + {}|null|undefined>): void; + deleteArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteArtifact(request, options, callback); + } + + /** + * Returns matching APIs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The maximum number of APIs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApis` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApis` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Api]{@link google.cloud.apigeeregistry.v1.Api}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApisAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApis( + request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi[], + protos.google.cloud.apigeeregistry.v1.IListApisRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApisResponse + ]>; + listApis( + request: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApisRequest, + protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApi>): void; + listApis( + request: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApisRequest, + protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApi>): void; + listApis( + request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApisRequest, + protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApi>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApisRequest, + protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApi>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi[], + protos.google.cloud.apigeeregistry.v1.IListApisRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApisResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApis(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The maximum number of APIs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApis` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApis` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApisAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApisStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApis']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApis.createStream( + this.innerApiCalls.listApis as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApis`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The maximum number of APIs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApis` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApis` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Api]{@link google.cloud.apigeeregistry.v1.Api}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_apis.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApis_async + */ + listApisAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApis']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApis.asyncIterate( + this.innerApiCalls['listApis'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns matching versions. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of versions to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiVersions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiVersions` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiVersions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion[], + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse + ]>; + listApiVersions( + request: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiVersion>): void; + listApiVersions( + request: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiVersion>): void; + listApiVersions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiVersion>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiVersion>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion[], + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiVersions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of versions to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiVersions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiVersions` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiVersionsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiVersions.createStream( + this.innerApiCalls.listApiVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiVersions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of versions to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiVersions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiVersions` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_versions.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiVersions_async + */ + listApiVersionsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiVersions.asyncIterate( + this.innerApiCalls['listApiVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns matching specs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {number} request.pageSize + * The maximum number of specs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiSpecs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiSpecs` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiSpecsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiSpecs( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec[], + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse + ]>; + listApiSpecs( + request: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; + listApiSpecs( + request: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; + listApiSpecs( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec[], + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiSpecs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {number} request.pageSize + * The maximum number of specs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiSpecs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiSpecs` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiSpecsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiSpecsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiSpecs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiSpecs.createStream( + this.innerApiCalls.listApiSpecs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiSpecs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {number} request.pageSize + * The maximum number of specs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiSpecs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiSpecs` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_specs.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiSpecs_async + */ + listApiSpecsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiSpecs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiSpecs.asyncIterate( + this.innerApiCalls['listApiSpecs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all revisions of a spec. + * Revisions are returned in descending order of revision creation time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiSpecRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiSpecRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiSpecRevisions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec[], + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse + ]>; + listApiSpecRevisions( + request: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; + listApiSpecRevisions( + request: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; + listApiSpecRevisions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec[], + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiSpecRevisions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiSpecRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiSpecRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiSpecRevisionsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listApiSpecRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiSpecRevisions.createStream( + this.innerApiCalls.listApiSpecRevisions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiSpecRevisions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiSpecRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_spec_revisions.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async + */ + listApiSpecRevisionsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listApiSpecRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiSpecRevisions.asyncIterate( + this.innerApiCalls['listApiSpecRevisions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns matching deployments. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of deployments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiDeployments` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiDeploymentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiDeployments( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment[], + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse + ]>; + listApiDeployments( + request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; + listApiDeployments( + request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; + listApiDeployments( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment[], + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiDeployments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of deployments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiDeployments` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiDeploymentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiDeploymentsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiDeployments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiDeployments.createStream( + this.innerApiCalls.listApiDeployments as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiDeployments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of deployments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiDeployments` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_deployments.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiDeployments_async + */ + listApiDeploymentsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiDeployments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiDeployments.asyncIterate( + this.innerApiCalls['listApiDeployments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all revisions of a deployment. + * Revisions are returned in descending order of revision creation time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiDeploymentRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiDeploymentRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiDeploymentRevisions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment[], + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse + ]>; + listApiDeploymentRevisions( + request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; + listApiDeploymentRevisions( + request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; + listApiDeploymentRevisions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment[], + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiDeploymentRevisions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiDeploymentRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiDeploymentRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiDeploymentRevisionsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiDeploymentRevisions.createStream( + this.innerApiCalls.listApiDeploymentRevisions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiDeploymentRevisions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiDeploymentRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_deployment_revisions.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async + */ + listApiDeploymentRevisionsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiDeploymentRevisions.asyncIterate( + this.innerApiCalls['listApiDeploymentRevisions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns matching artifacts. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListArtifacts` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListArtifacts` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listArtifactsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listArtifacts( + request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact[], + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse + ]>; + listArtifacts( + request: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IArtifact>): void; + listArtifacts( + request: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IArtifact>): void; + listArtifacts( + request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IArtifact>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IArtifact>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact[], + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listArtifacts(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListArtifacts` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListArtifacts` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listArtifactsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listArtifactsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listArtifacts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listArtifacts.createStream( + this.innerApiCalls.listArtifacts as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listArtifacts`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListArtifacts` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListArtifacts` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_artifacts.js + * region_tag:apigeeregistry_v1_generated_Registry_ListArtifacts_async + */ + listArtifactsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listArtifacts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listArtifacts.asyncIterate( + this.innerApiCalls['listArtifacts'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified api resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @returns {string} Resource name string. + */ + apiPath(project:string,location:string,api:string) { + return this.pathTemplates.apiPathTemplate.render({ + project: project, + location: location, + api: api, + }); + } + + /** + * Parse the project from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).project; + } + + /** + * Parse the location from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).location; + } + + /** + * Parse the api from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).api; + } + + /** + * Return a fully-qualified apiDeployment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} deployment + * @returns {string} Resource name string. + */ + apiDeploymentPath(project:string,location:string,api:string,deployment:string) { + return this.pathTemplates.apiDeploymentPathTemplate.render({ + project: project, + location: location, + api: api, + deployment: deployment, + }); + } + + /** + * Parse the project from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).project; + } + + /** + * Parse the location from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).location; + } + + /** + * Parse the api from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).api; + } + + /** + * Parse the deployment from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).deployment; + } + + /** + * Return a fully-qualified apiSpec resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} spec + * @returns {string} Resource name string. + */ + apiSpecPath(project:string,location:string,api:string,version:string,spec:string) { + return this.pathTemplates.apiSpecPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + spec: spec, + }); + } + + /** + * Parse the project from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).project; + } + + /** + * Parse the location from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).location; + } + + /** + * Parse the api from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).api; + } + + /** + * Parse the version from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the version. + */ + matchVersionFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).version; + } + + /** + * Parse the spec from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the spec. + */ + matchSpecFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).spec; + } + + /** + * Return a fully-qualified apiVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @returns {string} Resource name string. + */ + apiVersionPath(project:string,location:string,api:string,version:string) { + return this.pathTemplates.apiVersionPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + }); + } + + /** + * Parse the project from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).project; + } + + /** + * Parse the location from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).location; + } + + /** + * Parse the api from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).api; + } + + /** + * Parse the version from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the version. + */ + matchVersionFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).version; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).location; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationApiArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiArtifactPath(project:string,location:string,api:string,artifact:string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).api; + } + + /** + * Parse the artifact from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiDeploymentArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} deployment + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiDeploymentArtifactPath(project:string,location:string,api:string,deployment:string,artifact:string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + deployment: deployment, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).api; + } + + /** + * Parse the deployment from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).deployment; + } + + /** + * Parse the artifact from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiVersionArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiVersionArtifactPath(project:string,location:string,api:string,version:string,artifact:string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).api; + } + + /** + * Parse the version from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).version; + } + + /** + * Parse the artifact from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiVersionSpecArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} spec + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiVersionSpecArtifactPath(project:string,location:string,api:string,version:string,spec:string,artifact:string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + spec: spec, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).api; + } + + /** + * Parse the version from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).version; + } + + /** + * Parse the spec from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the spec. + */ + matchSpecFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).spec; + } + + /** + * Parse the artifact from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationArtifactPath(project:string,location:string,artifact:string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.render({ + project: project, + location: location, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).project; + } + + /** + * Parse the location from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).location; + } + + /** + * Parse the artifact from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).artifact; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.registryStub && !this._terminated) { + return this.registryStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/registry_client_config.json b/owl-bot-staging/v1/src/v1/registry_client_config.json new file mode 100644 index 0000000..c26bf95 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/registry_client_config.json @@ -0,0 +1,216 @@ +{ + "interfaces": { + "google.cloud.apigeeregistry.v1.Registry": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "cancelled_deadline_exceeded_aborted_unavailable": [ + "CANCELLED", + "DEADLINE_EXCEEDED", + "ABORTED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "5763d5cb4f40f09b4de469b8a0f10443a7a49d00": { + "initial_retry_delay_millis": 200, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListApis": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApi": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateApi": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "UpdateApi": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteApi": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiVersions": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApiVersion": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateApiVersion": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "UpdateApiVersion": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteApiVersion": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiSpecs": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApiSpecContents": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "UpdateApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "TagApiSpecRevision": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiSpecRevisions": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "RollbackApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteApiSpecRevision": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiDeployments": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "UpdateApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "TagApiDeploymentRevision": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiDeploymentRevisions": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "RollbackApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteApiDeploymentRevision": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListArtifacts": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetArtifactContents": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ReplaceArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/registry_proto_list.json b/owl-bot-staging/v1/src/v1/registry_proto_list.json new file mode 100644 index 0000000..4fdc846 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/registry_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/apigeeregistry/v1/provisioning_service.proto", + "../../protos/google/cloud/apigeeregistry/v1/registry_models.proto", + "../../protos/google/cloud/apigeeregistry/v1/registry_service.proto" +] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..2bd97dc --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// 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 +// +// 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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const apigeeregistry = require('@google-cloud/apigee-registry'); + +function main() { + const provisioningClient = new apigeeregistry.ProvisioningClient(); + const registryClient = new apigeeregistry.RegistryClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..7c5f275 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// 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 +// +// 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. ** + +import {ProvisioningClient, RegistryClient} from '@google-cloud/apigee-registry'; + +// check that the client class type name can be used +function doStuffWithProvisioningClient(client: ProvisioningClient) { + client.close(); +} +function doStuffWithRegistryClient(client: RegistryClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const provisioningClient = new ProvisioningClient(); + doStuffWithProvisioningClient(provisioningClient); + // check that the client instance can be created + const registryClient = new RegistryClient(); + doStuffWithRegistryClient(registryClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..557a575 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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 +// +// 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. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_provisioning_v1.ts b/owl-bot-staging/v1/test/gapic_provisioning_v1.ts new file mode 100644 index 0000000..99ec132 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_provisioning_v1.ts @@ -0,0 +1,1896 @@ +// 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 +// +// 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as provisioningModule from '../src'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.ProvisioningClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = provisioningModule.v1.ProvisioningClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = provisioningModule.v1.ProvisioningClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = provisioningModule.v1.ProvisioningClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new provisioningModule.v1.ProvisioningClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new provisioningModule.v1.ProvisioningClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.provisioningStub, undefined); + await client.initialize(); + assert(client.provisioningStub); + }); + + it('has close method for the initialized client', done => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.provisioningStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.provisioningStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Instance() + ); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Instance() + ); + client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance with closed client', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('createInstance', () => { + it('invokes createInstance without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.createInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance with call error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance with LRO error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateInstanceProgress without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateInstanceProgress with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteInstance', () => { + it('invokes deleteInstance without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance with call error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance with LRO error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteInstanceProgress without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteInstanceProgress with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('api', () => { + const fakePath = "/rendered/path/api"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiPath', () => { + const result = client.apiPath("projectValue", "locationValue", "apiValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiName', () => { + const result = client.matchProjectFromApiName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiName', () => { + const result = client.matchLocationFromApiName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiName', () => { + const result = client.matchApiFromApiName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiDeployment', () => { + const fakePath = "/rendered/path/apiDeployment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + deployment: "deploymentValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiDeploymentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiDeploymentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiDeploymentPath', () => { + const result = client.apiDeploymentPath("projectValue", "locationValue", "apiValue", "deploymentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiDeploymentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiDeploymentName', () => { + const result = client.matchProjectFromApiDeploymentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiDeploymentName', () => { + const result = client.matchLocationFromApiDeploymentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiDeploymentName', () => { + const result = client.matchApiFromApiDeploymentName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromApiDeploymentName', () => { + const result = client.matchDeploymentFromApiDeploymentName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiSpec', () => { + const fakePath = "/rendered/path/apiSpec"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + spec: "specValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiSpecPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiSpecPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiSpecPath', () => { + const result = client.apiSpecPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiSpecPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiSpecName', () => { + const result = client.matchProjectFromApiSpecName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiSpecName', () => { + const result = client.matchLocationFromApiSpecName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiSpecName', () => { + const result = client.matchApiFromApiSpecName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromApiSpecName', () => { + const result = client.matchVersionFromApiSpecName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpecFromApiSpecName', () => { + const result = client.matchSpecFromApiSpecName(fakePath); + assert.strictEqual(result, "specValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiVersion', () => { + const fakePath = "/rendered/path/apiVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiVersionPath', () => { + const result = client.apiVersionPath("projectValue", "locationValue", "apiValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiVersionName', () => { + const result = client.matchProjectFromApiVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiVersionName', () => { + const result = client.matchLocationFromApiVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiVersionName', () => { + const result = client.matchApiFromApiVersionName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromApiVersionName', () => { + const result = client.matchVersionFromApiVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiArtifactPath', () => { + const result = client.projectLocationApiArtifactPath("projectValue", "locationValue", "apiValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiArtifactName', () => { + const result = client.matchApiFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiDeploymentArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiDeploymentArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + deployment: "deploymentValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiDeploymentArtifactPath', () => { + const result = client.projectLocationApiDeploymentArtifactPath("projectValue", "locationValue", "apiValue", "deploymentValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchApiFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchDeploymentFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiVersionArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiVersionArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiVersionArtifactPath', () => { + const result = client.projectLocationApiVersionArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchApiFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchVersionFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiVersionSpecArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiVersionSpecArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + spec: "specValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiVersionSpecArtifactPath', () => { + const result = client.projectLocationApiVersionSpecArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchApiFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchVersionFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpecFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchSpecFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "specValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationArtifact', () => { + const fakePath = "/rendered/path/projectLocationArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationArtifactPath', () => { + const result = client.projectLocationArtifactPath("projectValue", "locationValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationArtifactName', () => { + const result = client.matchProjectFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationArtifactName', () => { + const result = client.matchLocationFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationArtifactName', () => { + const result = client.matchArtifactFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/test/gapic_registry_v1.ts b/owl-bot-staging/v1/test/gapic_registry_v1.ts new file mode 100644 index 0000000..ac1ecc4 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_registry_v1.ts @@ -0,0 +1,6280 @@ +// 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 +// +// 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as registryModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.RegistryClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = registryModule.v1.RegistryClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = registryModule.v1.RegistryClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = registryModule.v1.RegistryClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new registryModule.v1.RegistryClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new registryModule.v1.RegistryClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.registryStub, undefined); + await client.initialize(); + assert(client.registryStub); + }); + + it('has close method for the initialized client', done => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.registryStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.registryStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getApi', () => { + it('invokes getApi without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.getApi = stubSimpleCall(expectedResponse); + const [response] = await client.getApi(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApi without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.getApi = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApi( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApi with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApi = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApi(request), expectedError); + const actualRequest = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApi with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApi(request), expectedError); + }); + }); + + describe('createApi', () => { + it('invokes createApi without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.createApi = stubSimpleCall(expectedResponse); + const [response] = await client.createApi(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApi without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.createApi = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApi( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApi with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApi = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApi(request), expectedError); + const actualRequest = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApi with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createApi(request), expectedError); + }); + }); + + describe('updateApi', () => { + it('invokes updateApi without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() + ); + request.api ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiRequest', ['api', 'name']); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.updateApi = stubSimpleCall(expectedResponse); + const [response] = await client.updateApi(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApi without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() + ); + request.api ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiRequest', ['api', 'name']); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.updateApi = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApi( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApi with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() + ); + request.api ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiRequest', ['api', 'name']); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApi = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApi(request), expectedError); + const actualRequest = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApi with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() + ); + request.api ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiRequest', ['api', 'name']); + request.api.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateApi(request), expectedError); + }); + }); + + describe('deleteApi', () => { + it('invokes deleteApi without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApi = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApi(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApi without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApi = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApi( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApi with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApi = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApi(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApi with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApi(request), expectedError); + }); + }); + + describe('getApiVersion', () => { + it('invokes getApiVersion without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.getApiVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getApiVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiVersion without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.getApiVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApiVersion( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiVersion with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApiVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApiVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiVersion with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApiVersion(request), expectedError); + }); + }); + + describe('createApiVersion', () => { + it('invokes createApiVersion without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.createApiVersion = stubSimpleCall(expectedResponse); + const [response] = await client.createApiVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiVersion without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.createApiVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApiVersion( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiVersion with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApiVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApiVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiVersion with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createApiVersion(request), expectedError); + }); + }); + + describe('updateApiVersion', () => { + it('invokes updateApiVersion without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() + ); + request.apiVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiVersionRequest', ['apiVersion', 'name']); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.updateApiVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateApiVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiVersion without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() + ); + request.apiVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiVersionRequest', ['apiVersion', 'name']); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.updateApiVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApiVersion( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiVersion with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() + ); + request.apiVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiVersionRequest', ['apiVersion', 'name']); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApiVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApiVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiVersion with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() + ); + request.apiVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiVersionRequest', ['apiVersion', 'name']); + request.apiVersion.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateApiVersion(request), expectedError); + }); + }); + + describe('deleteApiVersion', () => { + it('invokes deleteApiVersion without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiVersion without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiVersion( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiVersion with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiVersion with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiVersion(request), expectedError); + }); + }); + + describe('getApiSpec', () => { + it('invokes getApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.getApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.getApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.getApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApiSpec( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApiSpec(request), expectedError); + }); + }); + + describe('getApiSpecContents', () => { + it('invokes getApiSpecContents without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiSpecContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getApiSpecContents = stubSimpleCall(expectedResponse); + const [response] = await client.getApiSpecContents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpecContents without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiSpecContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getApiSpecContents = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApiSpecContents( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpecContents with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiSpecContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApiSpecContents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApiSpecContents(request), expectedError); + const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpecContents with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiSpecContentsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApiSpecContents(request), expectedError); + }); + }); + + describe('createApiSpec', () => { + it('invokes createApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiSpecRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.createApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.createApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiSpecRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.createApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApiSpec( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiSpecRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiSpecRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createApiSpec(request), expectedError); + }); + }); + + describe('updateApiSpec', () => { + it('invokes updateApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() + ); + request.apiSpec ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiSpecRequest', ['apiSpec', 'name']); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.updateApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.updateApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() + ); + request.apiSpec ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiSpecRequest', ['apiSpec', 'name']); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.updateApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApiSpec( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() + ); + request.apiSpec ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiSpecRequest', ['apiSpec', 'name']); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() + ); + request.apiSpec ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiSpecRequest', ['apiSpec', 'name']); + request.apiSpec.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateApiSpec(request), expectedError); + }); + }); + + describe('deleteApiSpec', () => { + it('invokes deleteApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiSpec( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiSpec(request), expectedError); + }); + }); + + describe('tagApiSpecRevision', () => { + it('invokes tagApiSpecRevision without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('TagApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.tagApiSpecRevision = stubSimpleCall(expectedResponse); + const [response] = await client.tagApiSpecRevision(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiSpecRevision without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('TagApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.tagApiSpecRevision = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.tagApiSpecRevision( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiSpecRevision with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('TagApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.tagApiSpecRevision = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.tagApiSpecRevision(request), expectedError); + const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiSpecRevision with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('TagApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.tagApiSpecRevision(request), expectedError); + }); + }); + + describe('rollbackApiSpec', () => { + it('invokes rollbackApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RollbackApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.rollbackApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.rollbackApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RollbackApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.rollbackApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollbackApiSpec( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RollbackApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollbackApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rollbackApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RollbackApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.rollbackApiSpec(request), expectedError); + }); + }); + + describe('deleteApiSpecRevision', () => { + it('invokes deleteApiSpecRevision without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiSpecRevision(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpecRevision without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.deleteApiSpecRevision = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiSpecRevision( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpecRevision with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiSpecRevision(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpecRevision with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiSpecRevision(request), expectedError); + }); + }); + + describe('getApiDeployment', () => { + it('invokes getApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.getApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.getApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.getApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApiDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApiDeployment(request), expectedError); + }); + }); + + describe('createApiDeployment', () => { + it('invokes createApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.createApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.createApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.createApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApiDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateApiDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createApiDeployment(request), expectedError); + }); + }); + + describe('updateApiDeployment', () => { + it('invokes updateApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() + ); + request.apiDeployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiDeploymentRequest', ['apiDeployment', 'name']); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.updateApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.updateApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() + ); + request.apiDeployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiDeploymentRequest', ['apiDeployment', 'name']); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.updateApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApiDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() + ); + request.apiDeployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiDeploymentRequest', ['apiDeployment', 'name']); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() + ); + request.apiDeployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateApiDeploymentRequest', ['apiDeployment', 'name']); + request.apiDeployment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateApiDeployment(request), expectedError); + }); + }); + + describe('deleteApiDeployment', () => { + it('invokes deleteApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiDeployment( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiDeployment(request), expectedError); + }); + }); + + describe('tagApiDeploymentRevision', () => { + it('invokes tagApiDeploymentRevision without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('TagApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall(expectedResponse); + const [response] = await client.tagApiDeploymentRevision(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiDeploymentRevision without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('TagApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.tagApiDeploymentRevision( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiDeploymentRevision with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('TagApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.tagApiDeploymentRevision(request), expectedError); + const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiDeploymentRevision with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('TagApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.tagApiDeploymentRevision(request), expectedError); + }); + }); + + describe('rollbackApiDeployment', () => { + it('invokes rollbackApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RollbackApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.rollbackApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.rollbackApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RollbackApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.rollbackApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollbackApiDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RollbackApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollbackApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rollbackApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('RollbackApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.rollbackApiDeployment(request), expectedError); + }); + }); + + describe('deleteApiDeploymentRevision', () => { + it('invokes deleteApiDeploymentRevision without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiDeploymentRevision(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeploymentRevision without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiDeploymentRevision( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeploymentRevision with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiDeploymentRevision(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeploymentRevision with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiDeploymentRevision(request), expectedError); + }); + }); + + describe('getArtifact', () => { + it('invokes getArtifact without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.getArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.getArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifact without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.getArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getArtifact( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifact with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifact with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getArtifact(request), expectedError); + }); + }); + + describe('getArtifactContents', () => { + it('invokes getArtifactContents without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetArtifactContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getArtifactContents = stubSimpleCall(expectedResponse); + const [response] = await client.getArtifactContents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifactContents without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetArtifactContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getArtifactContents = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getArtifactContents( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifactContents with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetArtifactContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getArtifactContents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getArtifactContents(request), expectedError); + const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifactContents with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetArtifactContentsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getArtifactContents(request), expectedError); + }); + }); + + describe('createArtifact', () => { + it('invokes createArtifact without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateArtifactRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.createArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.createArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createArtifact without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateArtifactRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.createArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createArtifact( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createArtifact with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateArtifactRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createArtifact with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateArtifactRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createArtifact(request), expectedError); + }); + }); + + describe('replaceArtifact', () => { + it('invokes replaceArtifact without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() + ); + request.artifact ??= {}; + const defaultValue1 = + getTypeDefaultValue('ReplaceArtifactRequest', ['artifact', 'name']); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.replaceArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.replaceArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceArtifact without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() + ); + request.artifact ??= {}; + const defaultValue1 = + getTypeDefaultValue('ReplaceArtifactRequest', ['artifact', 'name']); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.replaceArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.replaceArtifact( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceArtifact with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() + ); + request.artifact ??= {}; + const defaultValue1 = + getTypeDefaultValue('ReplaceArtifactRequest', ['artifact', 'name']); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.replaceArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceArtifact with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() + ); + request.artifact ??= {}; + const defaultValue1 = + getTypeDefaultValue('ReplaceArtifactRequest', ['artifact', 'name']); + request.artifact.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.replaceArtifact(request), expectedError); + }); + }); + + describe('deleteArtifact', () => { + it('invokes deleteArtifact without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.deleteArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteArtifact without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteArtifact( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteArtifact with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteArtifact with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteArtifact(request), expectedError); + }); + }); + + describe('listApis', () => { + it('invokes listApis without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + ]; + client.innerApiCalls.listApis = stubSimpleCall(expectedResponse); + const [response] = await client.listApis(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApis without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + ]; + client.innerApiCalls.listApis = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApis( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApis with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApis = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApis(request), expectedError); + const actualRequest = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApisStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + ]; + client.descriptors.page.listApis.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApisStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.Api[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Api) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApis, request)); + assert( + (client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApisStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApis.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApisStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.Api[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Api) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApis, request)); + assert( + (client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApis without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + ]; + client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApi[] = []; + const iterable = client.listApisAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApis with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApisAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApi[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiVersions', () => { + it('invokes listApiVersions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + ]; + client.innerApiCalls.listApiVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listApiVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiVersions without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + ]; + client.innerApiCalls.listApiVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiVersions( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiVersions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiVersionsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + ]; + client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiVersion[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiVersions, request)); + assert( + (client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiVersionsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiVersion[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiVersions, request)); + assert( + (client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiVersions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + ]; + client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiVersion[] = []; + const iterable = client.listApiVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiVersions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiSpecs', () => { + it('invokes listApiSpecs without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.innerApiCalls.listApiSpecs = stubSimpleCall(expectedResponse); + const [response] = await client.listApiSpecs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecs without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.innerApiCalls.listApiSpecs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiSpecs( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecs with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiSpecs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiSpecs(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiSpecsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiSpecs, request)); + assert( + (client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiSpecsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiSpecsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiSpecs, request)); + assert( + (client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiSpecs without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; + const iterable = client.listApiSpecsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiSpecs with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiSpecsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiSpecRevisions', () => { + it('invokes listApiSpecRevisions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.innerApiCalls.listApiSpecRevisions = stubSimpleCall(expectedResponse); + const [response] = await client.listApiSpecRevisions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecRevisions without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.innerApiCalls.listApiSpecRevisions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiSpecRevisions( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecRevisions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiSpecRevisions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiSpecRevisions(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecRevisionsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiSpecRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiSpecRevisions, request)); + assert( + (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiSpecRevisionsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiSpecRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiSpecRevisions, request)); + assert( + (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiSpecRevisions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; + const iterable = client.listApiSpecRevisionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiSpecRevisions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiSpecRevisionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiDeployments', () => { + it('invokes listApiDeployments without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.innerApiCalls.listApiDeployments = stubSimpleCall(expectedResponse); + const [response] = await client.listApiDeployments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeployments without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.innerApiCalls.listApiDeployments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiDeployments( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeployments with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiDeployments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiDeployments(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeploymentsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiDeployments, request)); + assert( + (client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiDeploymentsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiDeployments, request)); + assert( + (client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiDeployments without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; + const iterable = client.listApiDeploymentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiDeployments with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiDeploymentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiDeploymentRevisions', () => { + it('invokes listApiDeploymentRevisions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall(expectedResponse); + const [response] = await client.listApiDeploymentRevisions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeploymentRevisions without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiDeploymentRevisions( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeploymentRevisions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiDeploymentRevisions(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeploymentRevisionsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiDeploymentRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiDeploymentRevisions, request)); + assert( + (client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiDeploymentRevisionsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiDeploymentRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiDeploymentRevisions, request)); + assert( + (client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiDeploymentRevisions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; + const iterable = client.listApiDeploymentRevisionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiDeploymentRevisions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiDeploymentRevisionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listArtifacts', () => { + it('invokes listArtifacts without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + ]; + client.innerApiCalls.listArtifacts = stubSimpleCall(expectedResponse); + const [response] = await client.listArtifacts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listArtifacts without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + ]; + client.innerApiCalls.listArtifacts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listArtifacts( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listArtifacts with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listArtifacts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listArtifacts(request), expectedError); + const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listArtifactsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + ]; + client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listArtifactsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.Artifact[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Artifact) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listArtifacts, request)); + assert( + (client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listArtifactsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listArtifactsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.Artifact[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Artifact) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listArtifacts, request)); + assert( + (client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listArtifacts without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + ]; + client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IArtifact[] = []; + const iterable = client.listArtifactsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listArtifacts with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listArtifactsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IArtifact[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('api', () => { + const fakePath = "/rendered/path/api"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiPath', () => { + const result = client.apiPath("projectValue", "locationValue", "apiValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiName', () => { + const result = client.matchProjectFromApiName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiName', () => { + const result = client.matchLocationFromApiName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiName', () => { + const result = client.matchApiFromApiName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiDeployment', () => { + const fakePath = "/rendered/path/apiDeployment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + deployment: "deploymentValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiDeploymentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiDeploymentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiDeploymentPath', () => { + const result = client.apiDeploymentPath("projectValue", "locationValue", "apiValue", "deploymentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiDeploymentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiDeploymentName', () => { + const result = client.matchProjectFromApiDeploymentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiDeploymentName', () => { + const result = client.matchLocationFromApiDeploymentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiDeploymentName', () => { + const result = client.matchApiFromApiDeploymentName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromApiDeploymentName', () => { + const result = client.matchDeploymentFromApiDeploymentName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiSpec', () => { + const fakePath = "/rendered/path/apiSpec"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + spec: "specValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiSpecPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiSpecPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiSpecPath', () => { + const result = client.apiSpecPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiSpecPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiSpecName', () => { + const result = client.matchProjectFromApiSpecName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiSpecName', () => { + const result = client.matchLocationFromApiSpecName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiSpecName', () => { + const result = client.matchApiFromApiSpecName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromApiSpecName', () => { + const result = client.matchVersionFromApiSpecName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpecFromApiSpecName', () => { + const result = client.matchSpecFromApiSpecName(fakePath); + assert.strictEqual(result, "specValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiVersion', () => { + const fakePath = "/rendered/path/apiVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiVersionPath', () => { + const result = client.apiVersionPath("projectValue", "locationValue", "apiValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiVersionName', () => { + const result = client.matchProjectFromApiVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiVersionName', () => { + const result = client.matchLocationFromApiVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiVersionName', () => { + const result = client.matchApiFromApiVersionName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromApiVersionName', () => { + const result = client.matchVersionFromApiVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiArtifactPath', () => { + const result = client.projectLocationApiArtifactPath("projectValue", "locationValue", "apiValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiArtifactName', () => { + const result = client.matchApiFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiDeploymentArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiDeploymentArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + deployment: "deploymentValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiDeploymentArtifactPath', () => { + const result = client.projectLocationApiDeploymentArtifactPath("projectValue", "locationValue", "apiValue", "deploymentValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchApiFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchDeploymentFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiVersionArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiVersionArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiVersionArtifactPath', () => { + const result = client.projectLocationApiVersionArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchApiFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchVersionFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiVersionSpecArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiVersionSpecArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + spec: "specValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiVersionSpecArtifactPath', () => { + const result = client.projectLocationApiVersionSpecArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchApiFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchVersionFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpecFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchSpecFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "specValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationArtifact', () => { + const fakePath = "/rendered/path/projectLocationArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationArtifactPath', () => { + const result = client.projectLocationArtifactPath("projectValue", "locationValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationArtifactName', () => { + const result = client.matchProjectFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationArtifactName', () => { + const result = client.matchLocationFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationArtifactName', () => { + const result = client.matchArtifactFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..c94e0fd --- /dev/null +++ b/owl-bot-staging/v1/webpack.config.js @@ -0,0 +1,64 @@ +// 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 +// +// 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'Provisioning', + filename: './provisioning.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From e051679c75c3f57092c6b307bc4be1300ac4611a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 14 Sep 2022 21:17:15 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 65 - .../v1/provisioning_service.proto | 205 - .../apigeeregistry/v1/registry_models.proto | 364 - .../apigeeregistry/v1/registry_service.proto | 1133 --- .../v1/provisioning.create_instance.js | 73 - .../v1/provisioning.delete_instance.js | 63 - .../generated/v1/provisioning.get_instance.js | 62 - .../generated/v1/registry.create_api.js | 76 - .../v1/registry.create_api_deployment.js | 76 - .../generated/v1/registry.create_api_spec.js | 76 - .../v1/registry.create_api_version.js | 76 - .../generated/v1/registry.create_artifact.js | 76 - .../generated/v1/registry.delete_api.js | 67 - .../v1/registry.delete_api_deployment.js | 67 - ...registry.delete_api_deployment_revision.js | 64 - .../generated/v1/registry.delete_api_spec.js | 67 - .../v1/registry.delete_api_spec_revision.js | 64 - .../v1/registry.delete_api_version.js | 67 - .../generated/v1/registry.delete_artifact.js | 62 - .../samples/generated/v1/registry.get_api.js | 62 - .../v1/registry.get_api_deployment.js | 62 - .../generated/v1/registry.get_api_spec.js | 62 - .../v1/registry.get_api_spec_contents.js | 62 - .../generated/v1/registry.get_api_version.js | 62 - .../generated/v1/registry.get_artifact.js | 62 - .../v1/registry.get_artifact_contents.js | 62 - .../registry.list_api_deployment_revisions.js | 72 - .../v1/registry.list_api_deployments.js | 83 - .../v1/registry.list_api_spec_revisions.js | 72 - .../generated/v1/registry.list_api_specs.js | 83 - .../v1/registry.list_api_versions.js | 83 - .../generated/v1/registry.list_apis.js | 83 - .../generated/v1/registry.list_artifacts.js | 83 - .../generated/v1/registry.replace_artifact.js | 63 - .../v1/registry.rollback_api_deployment.js | 68 - .../v1/registry.rollback_api_spec.js | 68 - .../registry.tag_api_deployment_revision.js | 67 - .../v1/registry.tag_api_spec_revision.js | 67 - .../generated/v1/registry.update_api.js | 75 - .../v1/registry.update_api_deployment.js | 75 - .../generated/v1/registry.update_api_spec.js | 75 - .../v1/registry.update_api_version.js | 75 - ...tadata.google.cloud.apigeeregistry.v1.json | 1723 ----- owl-bot-staging/v1/src/index.ts | 27 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 445 -- owl-bot-staging/v1/src/v1/index.ts | 20 - .../v1/src/v1/provisioning_client.ts | 1737 ----- .../v1/src/v1/provisioning_client_config.json | 38 - .../v1/src/v1/provisioning_proto_list.json | 5 - owl-bot-staging/v1/src/v1/registry_client.ts | 5041 ------------- .../v1/src/v1/registry_client_config.json | 216 - .../v1/src/v1/registry_proto_list.json | 5 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - owl-bot-staging/v1/system-test/install.ts | 49 - .../v1/test/gapic_provisioning_v1.ts | 1896 ----- owl-bot-staging/v1/test/gapic_registry_v1.ts | 6280 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - src/v1/provisioning_client.ts | 6 +- src/v1/registry_client.ts | 98 +- test/gapic_provisioning_v1.ts | 327 +- test/gapic_registry_v1.ts | 3537 +++++----- 71 files changed, 2043 insertions(+), 24136 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/provisioning_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/provisioning_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/provisioning_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/registry_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/registry_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/registry_proto_list.json delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_provisioning_v1.ts delete mode 100644 owl-bot-staging/v1/test/gapic_registry_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index 2efe6c2..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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 -// -// 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'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/apigee-registry', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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 -// -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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 -// -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 1c7b46e..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Apigeeregistry: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index bfde712..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@google-cloud/apigee-registry", - "version": "0.1.0", - "description": "Apigeeregistry client for Node.js", - "repository": "googleapis/nodejs-apigeeregistry", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google apigeeregistry", - "apigeeregistry", - "provisioning", - "registry" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.59", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto deleted file mode 100644 index 9e7baee..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto +++ /dev/null @@ -1,205 +0,0 @@ -// 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.apigeeregistry.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; -option java_multiple_files = true; -option java_outer_classname = "ProvisioningServiceProto"; -option java_package = "com.google.cloud.apigeeregistry.v1"; -option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; -option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; - -// The service that is used for managing the data plane provisioning of the -// Registry. -service Provisioning { - option (google.api.default_host) = "apigeeregistry.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Provisions instance resources for the Registry. - rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/instances" - body: "instance" - }; - option (google.api.method_signature) = "parent,instance,instance_id"; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the Registry instance. - rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Gets details of a single Instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for CreateInstance. -message CreateInstanceRequest { - // Required. Parent resource of the Instance, of the form: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Identifier to assign to the Instance. Must be unique within scope of the - // parent resource. - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Instance. - Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for DeleteInstance. -message DeleteInstanceRequest { - // Required. The name of the Instance to delete. - // Format: `projects/*/locations/*/instances/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Instance" - } - ]; -} - -// Request message for GetInstance. -message GetInstanceRequest { - // Required. The name of the Instance to retrieve. - // Format: `projects/*/locations/*/instances/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Instance" - } - ]; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Server-defined resource path for the target of the operation. - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_message = 5; - - // Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool cancellation_requested = 6; - - // API version used to start the operation. - string api_version = 7; -} - -// An Instance represents the instance resources of the Registry. -// Currently, only one instance is allowed for each project. -message Instance { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/Instance" - pattern: "projects/{project}/locations/{location}/instances/{instance}" - }; - - // State of the Instance. - enum State { - // The default value. This value is used if the state is omitted. - STATE_UNSPECIFIED = 0; - - // The Instance has not been initialized or has been deleted. - INACTIVE = 1; - - // The Instance is being created. - CREATING = 2; - - // The Instance has been created and is ready for use. - ACTIVE = 3; - - // The Instance is being updated. - UPDATING = 4; - - // The Instance is being deleted. - DELETING = 5; - - // The Instance encountered an error during a state change. - FAILED = 6; - } - - // Available configurations to provision an Instance. - message Config { - // Output only. The GCP location where the Instance resides. - string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The Customer Managed Encryption Key (CMEK) used for data encryption. - // The CMEK name should follow the format of - // `projects/([^/]+)/locations/([^/]+)/keyRings/([^/]+)/cryptoKeys/([^/]+)`, - // where the `location` must match InstanceConfig.location. - string cmek_key_name = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Format: `projects/*/locations/*/instance`. - // Currently only `locations/global` is supported. - string name = 1; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the Instance. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Extra information of Instance.State if the state is `FAILED`. - string state_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Config of the Instance. - Config config = 6 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto deleted file mode 100644 index 8411f9e..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto +++ /dev/null @@ -1,364 +0,0 @@ -// 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.apigeeregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; -option java_multiple_files = true; -option java_outer_classname = "RegistryModelsProto"; -option java_package = "com.google.cloud.apigeeregistry.v1"; -option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; -option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; - -// A top-level description of an API. -// Produced by producers and are commitments to provide services. -message Api { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/Api" - pattern: "projects/{project}/locations/{location}/apis/{api}" - }; - - // Resource name. - string name = 1; - - // Human-meaningful name. - string display_name = 2; - - // A detailed description. - string description = 3; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A user-definable description of the availability of this service. - // Format: free-form, but we expect single words that describe availability, - // e.g., "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN". - string availability = 6; - - // The recommended version of the API. - // Format: `apis/{api}/versions/{version}` - string recommended_version = 7 [(google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiVersion" - }]; - - // The recommended deployment of the API. - // Format: `apis/{api}/deployments/{deployment}` - string recommended_deployment = 8 [(google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - }]; - - // Labels attach identifying metadata to resources. Identifying metadata can - // be used to filter list operations. - // - // Label keys and values can be no longer than 64 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores, and dashes. International characters are allowed. - // No more than 64 user labels can be associated with one resource (System - // labels are excluded). - // - // See https://goo.gl/xmQnxf for more information and examples of labels. - // System reserved label keys are prefixed with - // `apigeeregistry.googleapis.com/` and cannot be changed. - map labels = 9; - - // Annotations attach non-identifying metadata to resources. - // - // Annotation keys and values are less restricted than those of labels, but - // should be generally used for small values of broad interest. Larger, topic- - // specific metadata should be stored in Artifacts. - map annotations = 10; -} - -// Describes a particular version of an API. -// ApiVersions are what consumers actually use. -message ApiVersion { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/ApiVersion" - pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}" - }; - - // Resource name. - string name = 1; - - // Human-meaningful name. - string display_name = 2; - - // A detailed description. - string description = 3; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A user-definable description of the lifecycle phase of this API version. - // Format: free-form, but we expect single words that describe API maturity, - // e.g., "CONCEPT", "DESIGN", "DEVELOPMENT", "STAGING", "PRODUCTION", - // "DEPRECATED", "RETIRED". - string state = 6; - - // Labels attach identifying metadata to resources. Identifying metadata can - // be used to filter list operations. - // - // Label keys and values can be no longer than 64 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // No more than 64 user labels can be associated with one resource (System - // labels are excluded). - // - // See https://goo.gl/xmQnxf for more information and examples of labels. - // System reserved label keys are prefixed with - // `apigeeregistry.googleapis.com/` and cannot be changed. - map labels = 7; - - // Annotations attach non-identifying metadata to resources. - // - // Annotation keys and values are less restricted than those of labels, but - // should be generally used for small values of broad interest. Larger, topic- - // specific metadata should be stored in Artifacts. - map annotations = 8; -} - -// Describes a version of an API in a structured way. -// ApiSpecs provide formal descriptions that consumers can use to use a version. -// ApiSpec resources are intended to be fully-resolved descriptions of an -// ApiVersion. When specs consist of multiple files, these should be bundled -// together (e.g., in a zip archive) and stored as a unit. Multiple specs can -// exist to provide representations in different API description formats. -// Synchronization of these representations would be provided by tooling and -// background services. -message ApiSpec { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}" - }; - - // Resource name. - string name = 1; - - // A possibly-hierarchical name used to refer to the spec from other specs. - string filename = 2; - - // A detailed description. - string description = 3; - - // Output only. Immutable. The revision ID of the spec. - // A new revision is committed whenever the spec contents are changed. - // The format is an 8-character hexadecimal string. - string revision_id = 4 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Output only. Creation timestamp; when the spec resource was created. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Revision creation timestamp; when the represented revision was created. - google.protobuf.Timestamp revision_create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp: when the represented revision was last modified. - google.protobuf.Timestamp revision_update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A style (format) descriptor for this spec that is specified as a Media Type - // (https://en.wikipedia.org/wiki/Media_type). Possible values include - // `application/vnd.apigee.proto`, `application/vnd.apigee.openapi`, and - // `application/vnd.apigee.graphql`, with possible suffixes representing - // compression types. These hypothetical names are defined in the vendor tree - // defined in RFC6838 (https://tools.ietf.org/html/rfc6838) and are not final. - // Content types can specify compression. Currently only GZip compression is - // supported (indicated with "+gzip"). - string mime_type = 8; - - // Output only. The size of the spec file in bytes. If the spec is gzipped, this is the - // size of the uncompressed spec. - int32 size_bytes = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A SHA-256 hash of the spec's contents. If the spec is gzipped, this is - // the hash of the uncompressed spec. - string hash = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The original source URI of the spec (if one exists). - // This is an external location that can be used for reference purposes - // but which may not be authoritative since this external resource may - // change after the spec is retrieved. - string source_uri = 11; - - // Input only. The contents of the spec. - // Provided by API callers when specs are created or updated. - // To access the contents of a spec, use GetApiSpecContents. - bytes contents = 12 [(google.api.field_behavior) = INPUT_ONLY]; - - // Labels attach identifying metadata to resources. Identifying metadata can - // be used to filter list operations. - // - // Label keys and values can be no longer than 64 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // No more than 64 user labels can be associated with one resource (System - // labels are excluded). - // - // See https://goo.gl/xmQnxf for more information and examples of labels. - // System reserved label keys are prefixed with - // `apigeeregistry.googleapis.com/` and cannot be changed. - map labels = 14; - - // Annotations attach non-identifying metadata to resources. - // - // Annotation keys and values are less restricted than those of labels, but - // should be generally used for small values of broad interest. Larger, topic- - // specific metadata should be stored in Artifacts. - map annotations = 15; -} - -// Describes a service running at particular address that -// provides a particular version of an API. ApiDeployments have revisions which -// correspond to different configurations of a single deployment in time. -// Revision identifiers should be updated whenever the served API spec or -// endpoint address changes. -message ApiDeployment { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - pattern: "projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}" - }; - - // Resource name. - string name = 1; - - // Human-meaningful name. - string display_name = 2; - - // A detailed description. - string description = 3; - - // Output only. Immutable. The revision ID of the deployment. - // A new revision is committed whenever the deployment contents are changed. - // The format is an 8-character hexadecimal string. - string revision_id = 4 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Output only. Creation timestamp; when the deployment resource was created. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Revision creation timestamp; when the represented revision was created. - google.protobuf.Timestamp revision_create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp: when the represented revision was last modified. - google.protobuf.Timestamp revision_update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The full resource name (including revision ID) of the spec of the API being - // served by the deployment. Changes to this value will update the revision. - // Format: `apis/{api}/deployments/{deployment}` - string api_spec_revision = 8 [(google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - }]; - - // The address where the deployment is serving. Changes to this value will - // update the revision. - string endpoint_uri = 9; - - // The address of the external channel of the API (e.g., the Developer - // Portal). Changes to this value will not affect the revision. - string external_channel_uri = 10; - - // Text briefly identifying the intended audience of the API. Changes to this - // value will not affect the revision. - string intended_audience = 11; - - // Text briefly describing how to access the endpoint. Changes to this value - // will not affect the revision. - string access_guidance = 12; - - // Labels attach identifying metadata to resources. Identifying metadata can - // be used to filter list operations. - // - // Label keys and values can be no longer than 64 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // No more than 64 user labels can be associated with one resource (System - // labels are excluded). - // - // See https://goo.gl/xmQnxf for more information and examples of labels. - // System reserved label keys are prefixed with - // `apigeeregistry.googleapis.com/` and cannot be changed. - map labels = 14; - - // Annotations attach non-identifying metadata to resources. - // - // Annotation keys and values are less restricted than those of labels, but - // should be generally used for small values of broad interest. Larger, topic- - // specific metadata should be stored in Artifacts. - map annotations = 15; -} - -// Artifacts of resources. Artifacts are unique (single-value) per resource -// and are used to store metadata that is too large or numerous to be stored -// directly on the resource. Since artifacts are stored separately from parent -// resources, they should generally be used for metadata that is needed -// infrequently, i.e., not for display in primary views of the resource but -// perhaps displayed or downloaded upon request. The `ListArtifacts` method -// allows artifacts to be quickly enumerated and checked for presence without -// downloading their (potentially-large) contents. -message Artifact { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/Artifact" - pattern: "projects/{project}/locations/{location}/artifacts/{artifact}" - pattern: "projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}" - pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}" - pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}" - pattern: "projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}" - }; - - // Resource name. - string name = 1; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A content type specifier for the artifact. - // Content type specifiers are Media Types - // (https://en.wikipedia.org/wiki/Media_type) with a possible "schema" - // parameter that specifies a schema for the stored information. - // Content types can specify compression. Currently only GZip compression is - // supported (indicated with "+gzip"). - string mime_type = 4; - - // Output only. The size of the artifact in bytes. If the artifact is gzipped, this is - // the size of the uncompressed artifact. - int32 size_bytes = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A SHA-256 hash of the artifact's contents. If the artifact is gzipped, - // this is the hash of the uncompressed artifact. - string hash = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input only. The contents of the artifact. - // Provided by API callers when artifacts are created or replaced. - // To access the contents of an artifact, use GetArtifactContents. - bytes contents = 7 [(google.api.field_behavior) = INPUT_ONLY]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto deleted file mode 100644 index 1eec64e..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto +++ /dev/null @@ -1,1133 +0,0 @@ -// 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.apigeeregistry.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/httpbody.proto"; -import "google/api/resource.proto"; -import "google/cloud/apigeeregistry/v1/registry_models.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; -option java_multiple_files = true; -option java_outer_classname = "RegistryServiceProto"; -option java_package = "com.google.cloud.apigeeregistry.v1"; -option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; -option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; - -// The Registry service allows teams to manage descriptions of APIs. -service Registry { - option (google.api.default_host) = "apigeeregistry.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Returns matching APIs. - rpc ListApis(ListApisRequest) returns (ListApisResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/apis" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified API. - rpc GetApi(GetApiRequest) returns (Api) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified API. - rpc CreateApi(CreateApiRequest) returns (Api) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/apis" - body: "api" - }; - option (google.api.method_signature) = "parent,api,api_id"; - } - - // Used to modify a specified API. - rpc UpdateApi(UpdateApiRequest) returns (Api) { - option (google.api.http) = { - patch: "/v1/{api.name=projects/*/locations/*/apis/*}" - body: "api" - }; - option (google.api.method_signature) = "api,update_mask"; - } - - // Removes a specified API and all of the resources that it - // owns. - rpc DeleteApi(DeleteApiRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns matching versions. - rpc ListApiVersions(ListApiVersionsRequest) returns (ListApiVersionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/apis/*}/versions" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified version. - rpc GetApiVersion(GetApiVersionRequest) returns (ApiVersion) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified version. - rpc CreateApiVersion(CreateApiVersionRequest) returns (ApiVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/apis/*}/versions" - body: "api_version" - }; - option (google.api.method_signature) = "parent,api_version,api_version_id"; - } - - // Used to modify a specified version. - rpc UpdateApiVersion(UpdateApiVersionRequest) returns (ApiVersion) { - option (google.api.http) = { - patch: "/v1/{api_version.name=projects/*/locations/*/apis/*/versions/*}" - body: "api_version" - }; - option (google.api.method_signature) = "api_version,update_mask"; - } - - // Removes a specified version and all of the resources that - // it owns. - rpc DeleteApiVersion(DeleteApiVersionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns matching specs. - rpc ListApiSpecs(ListApiSpecsRequest) returns (ListApiSpecsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified spec. - rpc GetApiSpec(GetApiSpecRequest) returns (ApiSpec) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns the contents of a specified spec. - // If specs are stored with GZip compression, the default behavior - // is to return the spec uncompressed (the mime_type response field - // indicates the exact format returned). - rpc GetApiSpecContents(GetApiSpecContentsRequest) returns (google.api.HttpBody) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:getContents" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified spec. - rpc CreateApiSpec(CreateApiSpecRequest) returns (ApiSpec) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs" - body: "api_spec" - }; - option (google.api.method_signature) = "parent,api_spec,api_spec_id"; - } - - // Used to modify a specified spec. - rpc UpdateApiSpec(UpdateApiSpecRequest) returns (ApiSpec) { - option (google.api.http) = { - patch: "/v1/{api_spec.name=projects/*/locations/*/apis/*/versions/*/specs/*}" - body: "api_spec" - }; - option (google.api.method_signature) = "api_spec,update_mask"; - } - - // Removes a specified spec, all revisions, and all child - // resources (e.g., artifacts). - rpc DeleteApiSpec(DeleteApiSpecRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Adds a tag to a specified revision of a spec. - rpc TagApiSpecRevision(TagApiSpecRevisionRequest) returns (ApiSpec) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:tagRevision" - body: "*" - }; - } - - // Lists all revisions of a spec. - // Revisions are returned in descending order of revision creation time. - rpc ListApiSpecRevisions(ListApiSpecRevisionsRequest) returns (ListApiSpecRevisionsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:listRevisions" - }; - } - - // Sets the current revision to a specified prior revision. - // Note that this creates a new revision with a new revision ID. - rpc RollbackApiSpec(RollbackApiSpecRequest) returns (ApiSpec) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:rollback" - body: "*" - }; - } - - // Deletes a revision of a spec. - rpc DeleteApiSpecRevision(DeleteApiSpecRevisionRequest) returns (ApiSpec) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:deleteRevision" - }; - option (google.api.method_signature) = "name"; - } - - // Returns matching deployments. - rpc ListApiDeployments(ListApiDeploymentsRequest) returns (ListApiDeploymentsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/apis/*}/deployments" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified deployment. - rpc GetApiDeployment(GetApiDeploymentRequest) returns (ApiDeployment) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified deployment. - rpc CreateApiDeployment(CreateApiDeploymentRequest) returns (ApiDeployment) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/apis/*}/deployments" - body: "api_deployment" - }; - option (google.api.method_signature) = "parent,api_deployment,api_deployment_id"; - } - - // Used to modify a specified deployment. - rpc UpdateApiDeployment(UpdateApiDeploymentRequest) returns (ApiDeployment) { - option (google.api.http) = { - patch: "/v1/{api_deployment.name=projects/*/locations/*/apis/*/deployments/*}" - body: "api_deployment" - }; - option (google.api.method_signature) = "api_deployment,update_mask"; - } - - // Removes a specified deployment, all revisions, and all - // child resources (e.g., artifacts). - rpc DeleteApiDeployment(DeleteApiDeploymentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Adds a tag to a specified revision of a - // deployment. - rpc TagApiDeploymentRevision(TagApiDeploymentRevisionRequest) returns (ApiDeployment) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:tagRevision" - body: "*" - }; - } - - // Lists all revisions of a deployment. - // Revisions are returned in descending order of revision creation time. - rpc ListApiDeploymentRevisions(ListApiDeploymentRevisionsRequest) returns (ListApiDeploymentRevisionsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:listRevisions" - }; - } - - // Sets the current revision to a specified prior - // revision. Note that this creates a new revision with a new revision ID. - rpc RollbackApiDeployment(RollbackApiDeploymentRequest) returns (ApiDeployment) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:rollback" - body: "*" - }; - } - - // Deletes a revision of a deployment. - rpc DeleteApiDeploymentRevision(DeleteApiDeploymentRevisionRequest) returns (ApiDeployment) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:deleteRevision" - }; - option (google.api.method_signature) = "name"; - } - - // Returns matching artifacts. - rpc ListArtifacts(ListArtifactsRequest) returns (ListArtifactsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/artifacts" - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/apis/*}/artifacts" - } - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/artifacts" - } - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*/specs/*}/artifacts" - } - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/apis/*/deployments/*}/artifacts" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified artifact. - rpc GetArtifact(GetArtifactRequest) returns (Artifact) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/artifacts/*}" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Returns the contents of a specified artifact. - // If artifacts are stored with GZip compression, the default behavior - // is to return the artifact uncompressed (the mime_type response field - // indicates the exact format returned). - rpc GetArtifactContents(GetArtifactContentsRequest) returns (google.api.HttpBody) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/artifacts/*}:getContents" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}:getContents" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getContents" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getContents" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}:getContents" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified artifact. - rpc CreateArtifact(CreateArtifactRequest) returns (Artifact) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/artifacts" - body: "artifact" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/apis/*}/artifacts" - body: "artifact" - } - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/artifacts" - body: "artifact" - } - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*/specs/*}/artifacts" - body: "artifact" - } - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/apis/*/deployments/*}/artifacts" - body: "artifact" - } - }; - option (google.api.method_signature) = "parent,artifact,artifact_id"; - } - - // Used to replace a specified artifact. - rpc ReplaceArtifact(ReplaceArtifactRequest) returns (Artifact) { - option (google.api.http) = { - put: "/v1/{artifact.name=projects/*/locations/*/artifacts/*}" - body: "artifact" - additional_bindings { - put: "/v1/{artifact.name=projects/*/locations/*/apis/*/artifacts/*}" - body: "artifact" - } - additional_bindings { - put: "/v1/{artifact.name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" - body: "artifact" - } - additional_bindings { - put: "/v1/{artifact.name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" - body: "artifact" - } - additional_bindings { - put: "/v1/{artifact.name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" - body: "artifact" - } - }; - option (google.api.method_signature) = "artifact"; - } - - // Removes a specified artifact. - rpc DeleteArtifact(DeleteArtifactRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/artifacts/*}" - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}" - } - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" - } - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" - } - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for ListApis. -message ListApisRequest { - // Required. The parent, which owns this collection of APIs. - // Format: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/Api" - } - ]; - - // The maximum number of APIs to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListApis` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListApis` must match - // the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields. - string filter = 4; -} - -// Response message for ListApis. -message ListApisResponse { - // The APIs from the specified publisher. - repeated Api apis = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetApi. -message GetApiRequest { - // Required. The name of the API to retrieve. - // Format: `projects/*/locations/*/apis/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Api" - } - ]; -} - -// Request message for CreateApi. -message CreateApiRequest { - // Required. The parent, which owns this collection of APIs. - // Format: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/Api" - } - ]; - - // Required. The API to create. - Api api = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the API, which will become the final component of - // the API's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string api_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for UpdateApi. -message UpdateApiRequest { - // Required. The API to update. - // - // The `name` field is used to identify the API to update. - // Format: `projects/*/locations/*/apis/*` - Api api = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. If omitted, all fields are updated that - // are set in the request message (fields set to default values are ignored). - // If an asterisk "*" is specified, all fields are updated, including fields - // that are unspecified/default in the request. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the API is not found, a new API will be created. - // In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for DeleteApi. -message DeleteApiRequest { - // Required. The name of the API to delete. - // Format: `projects/*/locations/*/apis/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Api" - } - ]; - - // If set to true, any child resources will also be deleted. - // (Otherwise, the request will only work if there are no child resources.) - bool force = 2; -} - -// Request message for ListApiVersions. -message ListApiVersionsRequest { - // Required. The parent, which owns this collection of versions. - // Format: `projects/*/locations/*/apis/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiVersion" - } - ]; - - // The maximum number of versions to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListApiVersions` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListApiVersions` must - // match the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields. - string filter = 4; -} - -// Response message for ListApiVersions. -message ListApiVersionsResponse { - // The versions from the specified publisher. - repeated ApiVersion api_versions = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetApiVersion. -message GetApiVersionRequest { - // Required. The name of the version to retrieve. - // Format: `projects/*/locations/*/apis/*/versions/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiVersion" - } - ]; -} - -// Request message for CreateApiVersion. -message CreateApiVersionRequest { - // Required. The parent, which owns this collection of versions. - // Format: `projects/*/locations/*/apis/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiVersion" - } - ]; - - // Required. The version to create. - ApiVersion api_version = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the version, which will become the final component of - // the version's resource name. - // - // This value should be 1-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string api_version_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for UpdateApiVersion. -message UpdateApiVersionRequest { - // Required. The version to update. - // - // The `name` field is used to identify the version to update. - // Format: `projects/*/locations/*/apis/*/versions/*` - ApiVersion api_version = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. If omitted, all fields are updated that - // are set in the request message (fields set to default values are ignored). - // If an asterisk "*" is specified, all fields are updated, including fields - // that are unspecified/default in the request. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the version is not found, a new version will be - // created. In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for DeleteApiVersion. -message DeleteApiVersionRequest { - // Required. The name of the version to delete. - // Format: `projects/*/locations/*/apis/*/versions/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiVersion" - } - ]; - - // If set to true, any child resources will also be deleted. - // (Otherwise, the request will only work if there are no child resources.) - bool force = 2; -} - -// Request message for ListApiSpecs. -message ListApiSpecsRequest { - // Required. The parent, which owns this collection of specs. - // Format: `projects/*/locations/*/apis/*/versions/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // The maximum number of specs to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListApiSpecs` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListApiSpecs` must match - // the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields except contents. - string filter = 4; -} - -// Response message for ListApiSpecs. -message ListApiSpecsResponse { - // The specs from the specified publisher. - repeated ApiSpec api_specs = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetApiSpec. -message GetApiSpecRequest { - // Required. The name of the spec to retrieve. - // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; -} - -// Request message for GetApiSpecContents. -message GetApiSpecContentsRequest { - // Required. The name of the spec whose contents should be retrieved. - // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; -} - -// Request message for CreateApiSpec. -message CreateApiSpecRequest { - // Required. The parent, which owns this collection of specs. - // Format: `projects/*/locations/*/apis/*/versions/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // Required. The spec to create. - ApiSpec api_spec = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the spec, which will become the final component of - // the spec's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string api_spec_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for UpdateApiSpec. -message UpdateApiSpecRequest { - // Required. The spec to update. - // - // The `name` field is used to identify the spec to update. - // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` - ApiSpec api_spec = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. If omitted, all fields are updated that - // are set in the request message (fields set to default values are ignored). - // If an asterisk "*" is specified, all fields are updated, including fields - // that are unspecified/default in the request. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the spec is not found, a new spec will be created. - // In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for DeleteApiSpec. -message DeleteApiSpecRequest { - // Required. The name of the spec to delete. - // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // If set to true, any child resources will also be deleted. - // (Otherwise, the request will only work if there are no child resources.) - bool force = 2; -} - -// Request message for TagApiSpecRevision. -message TagApiSpecRevisionRequest { - // Required. The name of the spec to be tagged, including the revision ID. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // Required. The tag to apply. - // The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. - string tag = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ListApiSpecRevisions. -message ListApiSpecRevisionsRequest { - // Required. The name of the spec to list revisions for. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // The maximum number of revisions to return per page. - int32 page_size = 2; - - // The page token, received from a previous ListApiSpecRevisions call. - // Provide this to retrieve the subsequent page. - string page_token = 3; -} - -// Response message for ListApiSpecRevisionsResponse. -message ListApiSpecRevisionsResponse { - // The revisions of the spec. - repeated ApiSpec api_specs = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for RollbackApiSpec. -message RollbackApiSpecRequest { - // Required. The spec being rolled back. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // Required. The revision ID to roll back to. - // It must be a revision of the same spec. - // - // Example: `c7cfa2a8` - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for DeleteApiSpecRevision. -message DeleteApiSpecRevisionRequest { - // Required. The name of the spec revision to be deleted, - // with a revision ID explicitly included. - // - // Example: - // `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; -} - -// Request message for ListApiDeployments. -message ListApiDeploymentsRequest { - // Required. The parent, which owns this collection of deployments. - // Format: `projects/*/locations/*/apis/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // The maximum number of deployments to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListApiDeployments` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListApiDeployments` must - // match the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields. - string filter = 4; -} - -// Response message for ListApiDeployments. -message ListApiDeploymentsResponse { - // The deployments from the specified publisher. - repeated ApiDeployment api_deployments = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetApiDeployment. -message GetApiDeploymentRequest { - // Required. The name of the deployment to retrieve. - // Format: `projects/*/locations/*/apis/*/deployments/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; -} - -// Request message for CreateApiDeployment. -message CreateApiDeploymentRequest { - // Required. The parent, which owns this collection of deployments. - // Format: `projects/*/locations/*/apis/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // Required. The deployment to create. - ApiDeployment api_deployment = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the deployment, which will become the final component of - // the deployment's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string api_deployment_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for UpdateApiDeployment. -message UpdateApiDeploymentRequest { - // Required. The deployment to update. - // - // The `name` field is used to identify the deployment to update. - // Format: `projects/*/locations/*/apis/*/deployments/*` - ApiDeployment api_deployment = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. If omitted, all fields are updated that - // are set in the request message (fields set to default values are ignored). - // If an asterisk "*" is specified, all fields are updated, including fields - // that are unspecified/default in the request. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the deployment is not found, a new deployment will be - // created. In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for DeleteApiDeployment. -message DeleteApiDeploymentRequest { - // Required. The name of the deployment to delete. - // Format: `projects/*/locations/*/apis/*/deployments/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // If set to true, any child resources will also be deleted. - // (Otherwise, the request will only work if there are no child resources.) - bool force = 2; -} - -// Request message for TagApiDeploymentRevision. -message TagApiDeploymentRevisionRequest { - // Required. The name of the deployment to be tagged, including the revision ID. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // Required. The tag to apply. - // The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. - string tag = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ListApiDeploymentRevisions. -message ListApiDeploymentRevisionsRequest { - // Required. The name of the deployment to list revisions for. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // The maximum number of revisions to return per page. - int32 page_size = 2; - - // The page token, received from a previous ListApiDeploymentRevisions call. - // Provide this to retrieve the subsequent page. - string page_token = 3; -} - -// Response message for ListApiDeploymentRevisionsResponse. -message ListApiDeploymentRevisionsResponse { - // The revisions of the deployment. - repeated ApiDeployment api_deployments = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for RollbackApiDeployment. -message RollbackApiDeploymentRequest { - // Required. The deployment being rolled back. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // Required. The revision ID to roll back to. - // It must be a revision of the same deployment. - // - // Example: `c7cfa2a8` - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for DeleteApiDeploymentRevision. -message DeleteApiDeploymentRevisionRequest { - // Required. The name of the deployment revision to be deleted, - // with a revision ID explicitly included. - // - // Example: - // `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; -} - -// Request message for ListArtifacts. -message ListArtifactsRequest { - // Required. The parent, which owns this collection of artifacts. - // Format: `{parent}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/Artifact" - } - ]; - - // The maximum number of artifacts to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListArtifacts` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListArtifacts` must - // match the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields except contents. - string filter = 4; -} - -// Response message for ListArtifacts. -message ListArtifactsResponse { - // The artifacts from the specified publisher. - repeated Artifact artifacts = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetArtifact. -message GetArtifactRequest { - // Required. The name of the artifact to retrieve. - // Format: `{parent}/artifacts/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Artifact" - } - ]; -} - -// Request message for GetArtifactContents. -message GetArtifactContentsRequest { - // Required. The name of the artifact whose contents should be retrieved. - // Format: `{parent}/artifacts/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Artifact" - } - ]; -} - -// Request message for CreateArtifact. -message CreateArtifactRequest { - // Required. The parent, which owns this collection of artifacts. - // Format: `{parent}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/Artifact" - } - ]; - - // Required. The artifact to create. - Artifact artifact = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the artifact, which will become the final component of - // the artifact's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string artifact_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ReplaceArtifact. -message ReplaceArtifactRequest { - // Required. The artifact to replace. - // - // The `name` field is used to identify the artifact to replace. - // Format: `{parent}/artifacts/*` - Artifact artifact = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for DeleteArtifact. -message DeleteArtifactRequest { - // Required. The name of the artifact to delete. - // Format: `{parent}/artifacts/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Artifact" - } - ]; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js deleted file mode 100644 index 4f84cd1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js +++ /dev/null @@ -1,73 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, instanceId, instance) { - // [START apigeeregistry_v1_generated_Provisioning_CreateInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Parent resource of the Instance, of the form: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. Identifier to assign to the Instance. Must be unique within scope of the - * parent resource. - */ - // const instanceId = 'abc123' - /** - * Required. The Instance. - */ - // const instance = {} - - // Imports the Apigeeregistry library - const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new ProvisioningClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - }; - - // Run request - const [operation] = await apigeeregistryClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END apigeeregistry_v1_generated_Provisioning_CreateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js deleted file mode 100644 index 9e1d226..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js +++ /dev/null @@ -1,63 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Provisioning_DeleteInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Instance to delete. - * Format: `projects/* /locations/* /instances/*`. - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new ProvisioningClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await apigeeregistryClient.deleteInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteInstance(); - // [END apigeeregistry_v1_generated_Provisioning_DeleteInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js deleted file mode 100644 index 4a4355c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Provisioning_GetInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Instance to retrieve. - * Format: `projects/* /locations/* /instances/*`. - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new ProvisioningClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END apigeeregistry_v1_generated_Provisioning_GetInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js deleted file mode 100644 index ebce3b4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, api, apiId) { - // [START apigeeregistry_v1_generated_Registry_CreateApi_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. The API to create. - */ - // const api = {} - /** - * Required. The ID to use for the API, which will become the final component of - * the API's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const apiId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateApi() { - // Construct request - const request = { - parent, - api, - apiId, - }; - - // Run request - const response = await apigeeregistryClient.createApi(request); - console.log(response); - } - - callCreateApi(); - // [END apigeeregistry_v1_generated_Registry_CreateApi_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js deleted file mode 100644 index 1d0c276..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, apiDeployment, apiDeploymentId) { - // [START apigeeregistry_v1_generated_Registry_CreateApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - */ - // const parent = 'abc123' - /** - * Required. The deployment to create. - */ - // const apiDeployment = {} - /** - * Required. The ID to use for the deployment, which will become the final component of - * the deployment's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const apiDeploymentId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateApiDeployment() { - // Construct request - const request = { - parent, - apiDeployment, - apiDeploymentId, - }; - - // Run request - const response = await apigeeregistryClient.createApiDeployment(request); - console.log(response); - } - - callCreateApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_CreateApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js deleted file mode 100644 index 44c0e05..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, apiSpec, apiSpecId) { - // [START apigeeregistry_v1_generated_Registry_CreateApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const parent = 'abc123' - /** - * Required. The spec to create. - */ - // const apiSpec = {} - /** - * Required. The ID to use for the spec, which will become the final component of - * the spec's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const apiSpecId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateApiSpec() { - // Construct request - const request = { - parent, - apiSpec, - apiSpecId, - }; - - // Run request - const response = await apigeeregistryClient.createApiSpec(request); - console.log(response); - } - - callCreateApiSpec(); - // [END apigeeregistry_v1_generated_Registry_CreateApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js deleted file mode 100644 index dd7182a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, apiVersion, apiVersionId) { - // [START apigeeregistry_v1_generated_Registry_CreateApiVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - */ - // const parent = 'abc123' - /** - * Required. The version to create. - */ - // const apiVersion = {} - /** - * Required. The ID to use for the version, which will become the final component of - * the version's resource name. - * This value should be 1-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const apiVersionId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateApiVersion() { - // Construct request - const request = { - parent, - apiVersion, - apiVersionId, - }; - - // Run request - const response = await apigeeregistryClient.createApiVersion(request); - console.log(response); - } - - callCreateApiVersion(); - // [END apigeeregistry_v1_generated_Registry_CreateApiVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js deleted file mode 100644 index 565ba5f..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, artifact, artifactId) { - // [START apigeeregistry_v1_generated_Registry_CreateArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - */ - // const parent = 'abc123' - /** - * Required. The artifact to create. - */ - // const artifact = {} - /** - * Required. The ID to use for the artifact, which will become the final component of - * the artifact's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const artifactId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateArtifact() { - // Construct request - const request = { - parent, - artifact, - artifactId, - }; - - // Run request - const response = await apigeeregistryClient.createArtifact(request); - console.log(response); - } - - callCreateArtifact(); - // [END apigeeregistry_v1_generated_Registry_CreateArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js deleted file mode 100644 index 440f846..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApi_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the API to delete. - * Format: `projects/* /locations/* /apis/*` - */ - // const name = 'abc123' - /** - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - */ - // const force = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApi() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApi(request); - console.log(response); - } - - callDeleteApi(); - // [END apigeeregistry_v1_generated_Registry_DeleteApi_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js deleted file mode 100644 index 47100ad..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment to delete. - * Format: `projects/* /locations/* /apis/* /deployments/*` - */ - // const name = 'abc123' - /** - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - */ - // const force = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiDeployment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiDeployment(request); - console.log(response); - } - - callDeleteApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js deleted file mode 100644 index b46ffa3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment revision to be deleted, - * with a revision ID explicitly included. - * Example: - * `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiDeploymentRevision() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiDeploymentRevision(request); - console.log(response); - } - - callDeleteApiDeploymentRevision(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js deleted file mode 100644 index bf1dfe8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec to delete. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - */ - // const name = 'abc123' - /** - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - */ - // const force = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiSpec() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiSpec(request); - console.log(response); - } - - callDeleteApiSpec(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js deleted file mode 100644 index 21fb813..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec revision to be deleted, - * with a revision ID explicitly included. - * Example: - * `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiSpecRevision() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiSpecRevision(request); - console.log(response); - } - - callDeleteApiSpecRevision(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js deleted file mode 100644 index 9c59f0b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the version to delete. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const name = 'abc123' - /** - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - */ - // const force = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiVersion(request); - console.log(response); - } - - callDeleteApiVersion(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js deleted file mode 100644 index d3e2b7c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the artifact to delete. - * Format: `{parent}/artifacts/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteArtifact() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteArtifact(request); - console.log(response); - } - - callDeleteArtifact(); - // [END apigeeregistry_v1_generated_Registry_DeleteArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js deleted file mode 100644 index 79568c8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApi_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the API to retrieve. - * Format: `projects/* /locations/* /apis/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApi() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApi(request); - console.log(response); - } - - callGetApi(); - // [END apigeeregistry_v1_generated_Registry_GetApi_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js deleted file mode 100644 index 2c0d9d1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment to retrieve. - * Format: `projects/* /locations/* /apis/* /deployments/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApiDeployment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApiDeployment(request); - console.log(response); - } - - callGetApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_GetApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js deleted file mode 100644 index 364e0d1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec to retrieve. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApiSpec() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApiSpec(request); - console.log(response); - } - - callGetApiSpec(); - // [END apigeeregistry_v1_generated_Registry_GetApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js deleted file mode 100644 index 419e495..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApiSpecContents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec whose contents should be retrieved. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApiSpecContents() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApiSpecContents(request); - console.log(response); - } - - callGetApiSpecContents(); - // [END apigeeregistry_v1_generated_Registry_GetApiSpecContents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js deleted file mode 100644 index 384f458..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApiVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the version to retrieve. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApiVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApiVersion(request); - console.log(response); - } - - callGetApiVersion(); - // [END apigeeregistry_v1_generated_Registry_GetApiVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js deleted file mode 100644 index fd8cf04..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the artifact to retrieve. - * Format: `{parent}/artifacts/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetArtifact() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getArtifact(request); - console.log(response); - } - - callGetArtifact(); - // [END apigeeregistry_v1_generated_Registry_GetArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js deleted file mode 100644 index 983ab0f..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetArtifactContents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the artifact whose contents should be retrieved. - * Format: `{parent}/artifacts/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetArtifactContents() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getArtifactContents(request); - console.log(response); - } - - callGetArtifactContents(); - // [END apigeeregistry_v1_generated_Registry_GetArtifactContents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js deleted file mode 100644 index 0f9fa67..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js +++ /dev/null @@ -1,72 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment to list revisions for. - */ - // const name = 'abc123' - /** - * The maximum number of revisions to return per page. - */ - // const pageSize = 1234 - /** - * The page token, received from a previous ListApiDeploymentRevisions call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiDeploymentRevisions() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiDeploymentRevisionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiDeploymentRevisions(); - // [END apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js deleted file mode 100644 index 10a7f19..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListApiDeployments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - */ - // const parent = 'abc123' - /** - * The maximum number of deployments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListApiDeployments` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListApiDeployments` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiDeployments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiDeploymentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiDeployments(); - // [END apigeeregistry_v1_generated_Registry_ListApiDeployments_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js deleted file mode 100644 index 1ee59f0..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js +++ /dev/null @@ -1,72 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec to list revisions for. - */ - // const name = 'abc123' - /** - * The maximum number of revisions to return per page. - */ - // const pageSize = 1234 - /** - * The page token, received from a previous ListApiSpecRevisions call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiSpecRevisions() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiSpecRevisionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiSpecRevisions(); - // [END apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js deleted file mode 100644 index ed3c4e9..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListApiSpecs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const parent = 'abc123' - /** - * The maximum number of specs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListApiSpecs` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListApiSpecs` must match - * the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiSpecs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiSpecsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiSpecs(); - // [END apigeeregistry_v1_generated_Registry_ListApiSpecs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js deleted file mode 100644 index 01a6314..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListApiVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - */ - // const parent = 'abc123' - /** - * The maximum number of versions to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListApiVersions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListApiVersions` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiVersions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiVersions(); - // [END apigeeregistry_v1_generated_Registry_ListApiVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js deleted file mode 100644 index 9280a53..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListApis_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * The maximum number of APIs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListApis` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListApis` must match - * the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApis() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listApisAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApis(); - // [END apigeeregistry_v1_generated_Registry_ListApis_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js deleted file mode 100644 index c5d2c3e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListArtifacts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - */ - // const parent = 'abc123' - /** - * The maximum number of artifacts to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListArtifacts` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListArtifacts` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListArtifacts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listArtifactsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListArtifacts(); - // [END apigeeregistry_v1_generated_Registry_ListArtifacts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js deleted file mode 100644 index af41ce8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js +++ /dev/null @@ -1,63 +0,0 @@ -// 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 -// -// 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'; - -function main(artifact) { - // [START apigeeregistry_v1_generated_Registry_ReplaceArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The artifact to replace. - * The `name` field is used to identify the artifact to replace. - * Format: `{parent}/artifacts/*` - */ - // const artifact = {} - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callReplaceArtifact() { - // Construct request - const request = { - artifact, - }; - - // Run request - const response = await apigeeregistryClient.replaceArtifact(request); - console.log(response); - } - - callReplaceArtifact(); - // [END apigeeregistry_v1_generated_Registry_ReplaceArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js deleted file mode 100644 index 022b8dc..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js +++ /dev/null @@ -1,68 +0,0 @@ -// 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 -// -// 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'; - -function main(name, revisionId) { - // [START apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The deployment being rolled back. - */ - // const name = 'abc123' - /** - * Required. The revision ID to roll back to. - * It must be a revision of the same deployment. - * Example: `c7cfa2a8` - */ - // const revisionId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callRollbackApiDeployment() { - // Construct request - const request = { - name, - revisionId, - }; - - // Run request - const response = await apigeeregistryClient.rollbackApiDeployment(request); - console.log(response); - } - - callRollbackApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js deleted file mode 100644 index d8acd25..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js +++ /dev/null @@ -1,68 +0,0 @@ -// 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 -// -// 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'; - -function main(name, revisionId) { - // [START apigeeregistry_v1_generated_Registry_RollbackApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The spec being rolled back. - */ - // const name = 'abc123' - /** - * Required. The revision ID to roll back to. - * It must be a revision of the same spec. - * Example: `c7cfa2a8` - */ - // const revisionId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callRollbackApiSpec() { - // Construct request - const request = { - name, - revisionId, - }; - - // Run request - const response = await apigeeregistryClient.rollbackApiSpec(request); - console.log(response); - } - - callRollbackApiSpec(); - // [END apigeeregistry_v1_generated_Registry_RollbackApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js deleted file mode 100644 index 5c386cc..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name, tag) { - // [START apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment to be tagged, including the revision ID. - */ - // const name = 'abc123' - /** - * Required. The tag to apply. - * The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. - */ - // const tag = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callTagApiDeploymentRevision() { - // Construct request - const request = { - name, - tag, - }; - - // Run request - const response = await apigeeregistryClient.tagApiDeploymentRevision(request); - console.log(response); - } - - callTagApiDeploymentRevision(); - // [END apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js deleted file mode 100644 index 838836c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name, tag) { - // [START apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec to be tagged, including the revision ID. - */ - // const name = 'abc123' - /** - * Required. The tag to apply. - * The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. - */ - // const tag = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callTagApiSpecRevision() { - // Construct request - const request = { - name, - tag, - }; - - // Run request - const response = await apigeeregistryClient.tagApiSpecRevision(request); - console.log(response); - } - - callTagApiSpecRevision(); - // [END apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js deleted file mode 100644 index 8cb7e3d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js +++ /dev/null @@ -1,75 +0,0 @@ -// 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 -// -// 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'; - -function main(api) { - // [START apigeeregistry_v1_generated_Registry_UpdateApi_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The API to update. - * The `name` field is used to identify the API to update. - * Format: `projects/* /locations/* /apis/*` - */ - // const api = {} - /** - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - */ - // const updateMask = {} - /** - * If set to true, and the API is not found, a new API will be created. - * In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callUpdateApi() { - // Construct request - const request = { - api, - }; - - // Run request - const response = await apigeeregistryClient.updateApi(request); - console.log(response); - } - - callUpdateApi(); - // [END apigeeregistry_v1_generated_Registry_UpdateApi_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js deleted file mode 100644 index 2858dd4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js +++ /dev/null @@ -1,75 +0,0 @@ -// 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 -// -// 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'; - -function main(apiDeployment) { - // [START apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The deployment to update. - * The `name` field is used to identify the deployment to update. - * Format: `projects/* /locations/* /apis/* /deployments/*` - */ - // const apiDeployment = {} - /** - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - */ - // const updateMask = {} - /** - * If set to true, and the deployment is not found, a new deployment will be - * created. In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callUpdateApiDeployment() { - // Construct request - const request = { - apiDeployment, - }; - - // Run request - const response = await apigeeregistryClient.updateApiDeployment(request); - console.log(response); - } - - callUpdateApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js deleted file mode 100644 index 563ac37..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js +++ /dev/null @@ -1,75 +0,0 @@ -// 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 -// -// 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'; - -function main(apiSpec) { - // [START apigeeregistry_v1_generated_Registry_UpdateApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The spec to update. - * The `name` field is used to identify the spec to update. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - */ - // const apiSpec = {} - /** - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - */ - // const updateMask = {} - /** - * If set to true, and the spec is not found, a new spec will be created. - * In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callUpdateApiSpec() { - // Construct request - const request = { - apiSpec, - }; - - // Run request - const response = await apigeeregistryClient.updateApiSpec(request); - console.log(response); - } - - callUpdateApiSpec(); - // [END apigeeregistry_v1_generated_Registry_UpdateApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js deleted file mode 100644 index 59fb2f5..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js +++ /dev/null @@ -1,75 +0,0 @@ -// 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 -// -// 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'; - -function main(apiVersion) { - // [START apigeeregistry_v1_generated_Registry_UpdateApiVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The version to update. - * The `name` field is used to identify the version to update. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const apiVersion = {} - /** - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - */ - // const updateMask = {} - /** - * If set to true, and the version is not found, a new version will be - * created. In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callUpdateApiVersion() { - // Construct request - const request = { - apiVersion, - }; - - // Run request - const response = await apigeeregistryClient.updateApiVersion(request); - console.log(response); - } - - callUpdateApiVersion(); - // [END apigeeregistry_v1_generated_Registry_UpdateApiVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json deleted file mode 100644 index 56680c6..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json +++ /dev/null @@ -1,1723 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-apigeeregistry", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.apigeeregistry.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "apigeeregistry_v1_generated_Provisioning_CreateInstance_async", - "title": "Provisioning createInstance Sample", - "origin": "API_DEFINITION", - "description": " Provisions instance resources for the Registry.", - "canonical": true, - "file": "provisioning.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": ".google.cloud.apigeeregistry.v1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProvisioningClient", - "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.CreateInstance", - "service": { - "shortName": "Provisioning", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Provisioning_DeleteInstance_async", - "title": "Provisioning deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Deletes the Registry instance.", - "canonical": true, - "file": "provisioning.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProvisioningClient", - "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.DeleteInstance", - "service": { - "shortName": "Provisioning", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Provisioning_GetInstance_async", - "title": "Provisioning getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Instance.", - "canonical": true, - "file": "provisioning.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Instance", - "client": { - "shortName": "ProvisioningClient", - "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.GetInstance", - "service": { - "shortName": "Provisioning", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApis_async", - "title": "Provisioning listApis Sample", - "origin": "API_DEFINITION", - "description": " Returns matching APIs.", - "canonical": true, - "file": "registry.list_apis.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApis", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApis", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApisResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApis", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApis", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApi_async", - "title": "Provisioning getApi Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified API.", - "canonical": true, - "file": "registry.get_api.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApi", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Api", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApi", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateApi_async", - "title": "Provisioning createApi Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified API.", - "canonical": true, - "file": "registry.create_api.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApi", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "api", - "type": ".google.cloud.apigeeregistry.v1.Api" - }, - { - "name": "api_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Api", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApi", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApi_async", - "title": "Provisioning updateApi Sample", - "origin": "API_DEFINITION", - "description": " Used to modify a specified API.", - "canonical": true, - "file": "registry.update_api.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApi", - "async": true, - "parameters": [ - { - "name": "api", - "type": ".google.cloud.apigeeregistry.v1.Api" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Api", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "UpdateApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApi", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApi_async", - "title": "Provisioning deleteApi Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified API and all of the resources that it owns.", - "canonical": true, - "file": "registry.delete_api.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApi", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApi", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiVersions_async", - "title": "Provisioning listApiVersions Sample", - "origin": "API_DEFINITION", - "description": " Returns matching versions.", - "canonical": true, - "file": "registry.list_api_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiVersions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiVersions", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiVersionsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiVersions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiVersions", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApiVersion_async", - "title": "Provisioning getApiVersion Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified version.", - "canonical": true, - "file": "registry.get_api_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiVersion", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiVersion_async", - "title": "Provisioning createApiVersion Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified version.", - "canonical": true, - "file": "registry.create_api_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "api_version", - "type": ".google.cloud.apigeeregistry.v1.ApiVersion" - }, - { - "name": "api_version_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiVersion", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiVersion_async", - "title": "Provisioning updateApiVersion Sample", - "origin": "API_DEFINITION", - "description": " Used to modify a specified version.", - "canonical": true, - "file": "registry.update_api_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiVersion", - "async": true, - "parameters": [ - { - "name": "api_version", - "type": ".google.cloud.apigeeregistry.v1.ApiVersion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "UpdateApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiVersion", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiVersion_async", - "title": "Provisioning deleteApiVersion Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified version and all of the resources that it owns.", - "canonical": true, - "file": "registry.delete_api_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiVersion", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiSpecs_async", - "title": "Provisioning listApiSpecs Sample", - "origin": "API_DEFINITION", - "description": " Returns matching specs.", - "canonical": true, - "file": "registry.list_api_specs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiSpecs", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecs", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiSpecsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiSpecs", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecs", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApiSpec_async", - "title": "Provisioning getApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified spec.", - "canonical": true, - "file": "registry.get_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpec", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApiSpecContents_async", - "title": "Provisioning getApiSpecContents Sample", - "origin": "API_DEFINITION", - "description": " Returns the contents of a specified spec. If specs are stored with GZip compression, the default behavior is to return the spec uncompressed (the mime_type response field indicates the exact format returned).", - "canonical": true, - "file": "registry.get_api_spec_contents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApiSpecContents", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpecContents", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApiSpecContents", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpecContents", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiSpec_async", - "title": "Provisioning createApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified spec.", - "canonical": true, - "file": "registry.create_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiSpec", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "api_spec", - "type": ".google.cloud.apigeeregistry.v1.ApiSpec" - }, - { - "name": "api_spec_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiSpec_async", - "title": "Provisioning updateApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Used to modify a specified spec.", - "canonical": true, - "file": "registry.update_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiSpec", - "async": true, - "parameters": [ - { - "name": "api_spec", - "type": ".google.cloud.apigeeregistry.v1.ApiSpec" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "UpdateApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiSpec_async", - "title": "Provisioning deleteApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified spec, all revisions, and all child resources (e.g., artifacts).", - "canonical": true, - "file": "registry.delete_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpec", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async", - "title": "Provisioning tagApiSpecRevision Sample", - "origin": "API_DEFINITION", - "description": " Adds a tag to a specified revision of a spec.", - "canonical": true, - "file": "registry.tag_api_spec_revision.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TagApiSpecRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiSpecRevision", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "tag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "TagApiSpecRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiSpecRevision", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async", - "title": "Provisioning listApiSpecRevisions Sample", - "origin": "API_DEFINITION", - "description": " Lists all revisions of a spec. Revisions are returned in descending order of revision creation time.", - "canonical": true, - "file": "registry.list_api_spec_revisions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiSpecRevisions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecRevisions", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiSpecRevisionsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiSpecRevisions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecRevisions", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_RollbackApiSpec_async", - "title": "Provisioning rollbackApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID.", - "canonical": true, - "file": "registry.rollback_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RollbackApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiSpec", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "revision_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "RollbackApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async", - "title": "Provisioning deleteApiSpecRevision Sample", - "origin": "API_DEFINITION", - "description": " Deletes a revision of a spec.", - "canonical": true, - "file": "registry.delete_api_spec_revision.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiSpecRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpecRevision", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiSpecRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpecRevision", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiDeployments_async", - "title": "Provisioning listApiDeployments Sample", - "origin": "API_DEFINITION", - "description": " Returns matching deployments.", - "canonical": true, - "file": "registry.list_api_deployments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiDeployments", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeployments", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiDeploymentsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiDeployments", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeployments", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApiDeployment_async", - "title": "Provisioning getApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified deployment.", - "canonical": true, - "file": "registry.get_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiDeployment_async", - "title": "Provisioning createApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified deployment.", - "canonical": true, - "file": "registry.create_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiDeployment", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "api_deployment", - "type": ".google.cloud.apigeeregistry.v1.ApiDeployment" - }, - { - "name": "api_deployment_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async", - "title": "Provisioning updateApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Used to modify a specified deployment.", - "canonical": true, - "file": "registry.update_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiDeployment", - "async": true, - "parameters": [ - { - "name": "api_deployment", - "type": ".google.cloud.apigeeregistry.v1.ApiDeployment" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "UpdateApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async", - "title": "Provisioning deleteApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified deployment, all revisions, and all child resources (e.g., artifacts).", - "canonical": true, - "file": "registry.delete_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async", - "title": "Provisioning tagApiDeploymentRevision Sample", - "origin": "API_DEFINITION", - "description": " Adds a tag to a specified revision of a deployment.", - "canonical": true, - "file": "registry.tag_api_deployment_revision.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TagApiDeploymentRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiDeploymentRevision", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "tag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "TagApiDeploymentRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiDeploymentRevision", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async", - "title": "Provisioning listApiDeploymentRevisions Sample", - "origin": "API_DEFINITION", - "description": " Lists all revisions of a deployment. Revisions are returned in descending order of revision creation time.", - "canonical": true, - "file": "registry.list_api_deployment_revisions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiDeploymentRevisions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeploymentRevisions", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiDeploymentRevisions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeploymentRevisions", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async", - "title": "Provisioning rollbackApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID.", - "canonical": true, - "file": "registry.rollback_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RollbackApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "revision_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "RollbackApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async", - "title": "Provisioning deleteApiDeploymentRevision Sample", - "origin": "API_DEFINITION", - "description": " Deletes a revision of a deployment.", - "canonical": true, - "file": "registry.delete_api_deployment_revision.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiDeploymentRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeploymentRevision", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiDeploymentRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeploymentRevision", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListArtifacts_async", - "title": "Provisioning listArtifacts Sample", - "origin": "API_DEFINITION", - "description": " Returns matching artifacts.", - "canonical": true, - "file": "registry.list_artifacts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListArtifacts", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListArtifacts", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListArtifactsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListArtifacts", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListArtifacts", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetArtifact_async", - "title": "Provisioning getArtifact Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified artifact.", - "canonical": true, - "file": "registry.get_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifact", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Artifact", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifact", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetArtifactContents_async", - "title": "Provisioning getArtifactContents Sample", - "origin": "API_DEFINITION", - "description": " Returns the contents of a specified artifact. If artifacts are stored with GZip compression, the default behavior is to return the artifact uncompressed (the mime_type response field indicates the exact format returned).", - "canonical": true, - "file": "registry.get_artifact_contents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetArtifactContents", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifactContents", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetArtifactContents", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifactContents", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateArtifact_async", - "title": "Provisioning createArtifact Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified artifact.", - "canonical": true, - "file": "registry.create_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateArtifact", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "artifact", - "type": ".google.cloud.apigeeregistry.v1.Artifact" - }, - { - "name": "artifact_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Artifact", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateArtifact", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ReplaceArtifact_async", - "title": "Provisioning replaceArtifact Sample", - "origin": "API_DEFINITION", - "description": " Used to replace a specified artifact.", - "canonical": true, - "file": "registry.replace_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ReplaceArtifact", - "async": true, - "parameters": [ - { - "name": "artifact", - "type": ".google.cloud.apigeeregistry.v1.Artifact" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Artifact", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ReplaceArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ReplaceArtifact", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteArtifact_async", - "title": "Provisioning deleteArtifact Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified artifact.", - "canonical": true, - "file": "registry.delete_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteArtifact", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteArtifact", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 9fa6563..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -// 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 -// -// 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. ** - -import * as v1 from './v1'; -const ProvisioningClient = v1.ProvisioningClient; -type ProvisioningClient = v1.ProvisioningClient; -const RegistryClient = v1.RegistryClient; -type RegistryClient = v1.RegistryClient; -export {v1, ProvisioningClient, RegistryClient}; -export default {v1, ProvisioningClient, RegistryClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 783049f..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,445 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.apigeeregistry.v1", - "libraryPackage": "@google-cloud/apigee-registry", - "services": { - "Provisioning": { - "clients": { - "grpc": { - "libraryClient": "ProvisioningClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ProvisioningClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - } - } - } - } - }, - "Registry": { - "clients": { - "grpc": { - "libraryClient": "RegistryClient", - "rpcs": { - "GetApi": { - "methods": [ - "getApi" - ] - }, - "CreateApi": { - "methods": [ - "createApi" - ] - }, - "UpdateApi": { - "methods": [ - "updateApi" - ] - }, - "DeleteApi": { - "methods": [ - "deleteApi" - ] - }, - "GetApiVersion": { - "methods": [ - "getApiVersion" - ] - }, - "CreateApiVersion": { - "methods": [ - "createApiVersion" - ] - }, - "UpdateApiVersion": { - "methods": [ - "updateApiVersion" - ] - }, - "DeleteApiVersion": { - "methods": [ - "deleteApiVersion" - ] - }, - "GetApiSpec": { - "methods": [ - "getApiSpec" - ] - }, - "GetApiSpecContents": { - "methods": [ - "getApiSpecContents" - ] - }, - "CreateApiSpec": { - "methods": [ - "createApiSpec" - ] - }, - "UpdateApiSpec": { - "methods": [ - "updateApiSpec" - ] - }, - "DeleteApiSpec": { - "methods": [ - "deleteApiSpec" - ] - }, - "TagApiSpecRevision": { - "methods": [ - "tagApiSpecRevision" - ] - }, - "RollbackApiSpec": { - "methods": [ - "rollbackApiSpec" - ] - }, - "DeleteApiSpecRevision": { - "methods": [ - "deleteApiSpecRevision" - ] - }, - "GetApiDeployment": { - "methods": [ - "getApiDeployment" - ] - }, - "CreateApiDeployment": { - "methods": [ - "createApiDeployment" - ] - }, - "UpdateApiDeployment": { - "methods": [ - "updateApiDeployment" - ] - }, - "DeleteApiDeployment": { - "methods": [ - "deleteApiDeployment" - ] - }, - "TagApiDeploymentRevision": { - "methods": [ - "tagApiDeploymentRevision" - ] - }, - "RollbackApiDeployment": { - "methods": [ - "rollbackApiDeployment" - ] - }, - "DeleteApiDeploymentRevision": { - "methods": [ - "deleteApiDeploymentRevision" - ] - }, - "GetArtifact": { - "methods": [ - "getArtifact" - ] - }, - "GetArtifactContents": { - "methods": [ - "getArtifactContents" - ] - }, - "CreateArtifact": { - "methods": [ - "createArtifact" - ] - }, - "ReplaceArtifact": { - "methods": [ - "replaceArtifact" - ] - }, - "DeleteArtifact": { - "methods": [ - "deleteArtifact" - ] - }, - "ListApis": { - "methods": [ - "listApis", - "listApisStream", - "listApisAsync" - ] - }, - "ListApiVersions": { - "methods": [ - "listApiVersions", - "listApiVersionsStream", - "listApiVersionsAsync" - ] - }, - "ListApiSpecs": { - "methods": [ - "listApiSpecs", - "listApiSpecsStream", - "listApiSpecsAsync" - ] - }, - "ListApiSpecRevisions": { - "methods": [ - "listApiSpecRevisions", - "listApiSpecRevisionsStream", - "listApiSpecRevisionsAsync" - ] - }, - "ListApiDeployments": { - "methods": [ - "listApiDeployments", - "listApiDeploymentsStream", - "listApiDeploymentsAsync" - ] - }, - "ListApiDeploymentRevisions": { - "methods": [ - "listApiDeploymentRevisions", - "listApiDeploymentRevisionsStream", - "listApiDeploymentRevisionsAsync" - ] - }, - "ListArtifacts": { - "methods": [ - "listArtifacts", - "listArtifactsStream", - "listArtifactsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "RegistryClient", - "rpcs": { - "GetApi": { - "methods": [ - "getApi" - ] - }, - "CreateApi": { - "methods": [ - "createApi" - ] - }, - "UpdateApi": { - "methods": [ - "updateApi" - ] - }, - "DeleteApi": { - "methods": [ - "deleteApi" - ] - }, - "GetApiVersion": { - "methods": [ - "getApiVersion" - ] - }, - "CreateApiVersion": { - "methods": [ - "createApiVersion" - ] - }, - "UpdateApiVersion": { - "methods": [ - "updateApiVersion" - ] - }, - "DeleteApiVersion": { - "methods": [ - "deleteApiVersion" - ] - }, - "GetApiSpec": { - "methods": [ - "getApiSpec" - ] - }, - "GetApiSpecContents": { - "methods": [ - "getApiSpecContents" - ] - }, - "CreateApiSpec": { - "methods": [ - "createApiSpec" - ] - }, - "UpdateApiSpec": { - "methods": [ - "updateApiSpec" - ] - }, - "DeleteApiSpec": { - "methods": [ - "deleteApiSpec" - ] - }, - "TagApiSpecRevision": { - "methods": [ - "tagApiSpecRevision" - ] - }, - "RollbackApiSpec": { - "methods": [ - "rollbackApiSpec" - ] - }, - "DeleteApiSpecRevision": { - "methods": [ - "deleteApiSpecRevision" - ] - }, - "GetApiDeployment": { - "methods": [ - "getApiDeployment" - ] - }, - "CreateApiDeployment": { - "methods": [ - "createApiDeployment" - ] - }, - "UpdateApiDeployment": { - "methods": [ - "updateApiDeployment" - ] - }, - "DeleteApiDeployment": { - "methods": [ - "deleteApiDeployment" - ] - }, - "TagApiDeploymentRevision": { - "methods": [ - "tagApiDeploymentRevision" - ] - }, - "RollbackApiDeployment": { - "methods": [ - "rollbackApiDeployment" - ] - }, - "DeleteApiDeploymentRevision": { - "methods": [ - "deleteApiDeploymentRevision" - ] - }, - "GetArtifact": { - "methods": [ - "getArtifact" - ] - }, - "GetArtifactContents": { - "methods": [ - "getArtifactContents" - ] - }, - "CreateArtifact": { - "methods": [ - "createArtifact" - ] - }, - "ReplaceArtifact": { - "methods": [ - "replaceArtifact" - ] - }, - "DeleteArtifact": { - "methods": [ - "deleteArtifact" - ] - }, - "ListApis": { - "methods": [ - "listApis", - "listApisStream", - "listApisAsync" - ] - }, - "ListApiVersions": { - "methods": [ - "listApiVersions", - "listApiVersionsStream", - "listApiVersionsAsync" - ] - }, - "ListApiSpecs": { - "methods": [ - "listApiSpecs", - "listApiSpecsStream", - "listApiSpecsAsync" - ] - }, - "ListApiSpecRevisions": { - "methods": [ - "listApiSpecRevisions", - "listApiSpecRevisionsStream", - "listApiSpecRevisionsAsync" - ] - }, - "ListApiDeployments": { - "methods": [ - "listApiDeployments", - "listApiDeploymentsStream", - "listApiDeploymentsAsync" - ] - }, - "ListApiDeploymentRevisions": { - "methods": [ - "listApiDeploymentRevisions", - "listApiDeploymentRevisionsStream", - "listApiDeploymentRevisionsAsync" - ] - }, - "ListArtifacts": { - "methods": [ - "listArtifacts", - "listArtifactsStream", - "listArtifactsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index 03a07e1..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// 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 -// -// 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. ** - -export {ProvisioningClient} from './provisioning_client'; -export {RegistryClient} from './registry_client'; diff --git a/owl-bot-staging/v1/src/v1/provisioning_client.ts b/owl-bot-staging/v1/src/v1/provisioning_client.ts deleted file mode 100644 index 729abd9..0000000 --- a/owl-bot-staging/v1/src/v1/provisioning_client.ts +++ /dev/null @@ -1,1737 +0,0 @@ -// 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 -// -// 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/provisioning_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './provisioning_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The service that is used for managing the data plane provisioning of the - * Registry. - * @class - * @memberof v1 - */ -export class ProvisioningClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - provisioningStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProvisioningClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ProvisioningClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProvisioningClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - apiPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}' - ), - apiDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}' - ), - apiSpecPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}' - ), - apiVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectLocationApiArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}' - ), - projectLocationApiDeploymentArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}' - ), - projectLocationApiVersionArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}' - ), - projectLocationApiVersionSpecArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}' - ), - projectLocationArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/artifacts/{artifact}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/apis/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/instances/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/runtime}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/apis/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/apis/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.apigeeregistry.v1.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.apigeeregistry.v1.OperationMetadata') as gax.protobuf.Type; - const deleteInstanceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.apigeeregistry.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - deleteInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInstanceResponse.decode.bind(deleteInstanceResponse), - deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.apigeeregistry.v1.Provisioning', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.provisioningStub) { - return this.provisioningStub; - } - - // Put together the "service stub" for - // google.cloud.apigeeregistry.v1.Provisioning. - this.provisioningStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.apigeeregistry.v1.Provisioning') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.apigeeregistry.v1.Provisioning, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const provisioningStubMethods = - ['createInstance', 'deleteInstance', 'getInstance']; - for (const methodName of provisioningStubMethods) { - const callPromise = this.provisioningStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.provisioningStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'apigeeregistry.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'apigeeregistry.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets details of a single Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Instance to retrieve. - * Format: `projects/* /locations/* /instances/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Instance]{@link google.cloud.apigeeregistry.v1.Instance}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.get_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_GetInstance_async - */ - getInstance( - request?: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getInstance(request, options, callback); - } - -/** - * Provisions instance resources for the Registry. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource of the Instance, of the form: `projects/* /locations/*` - * @param {string} request.instanceId - * Required. Identifier to assign to the Instance. Must be unique within scope of the - * parent resource. - * @param {google.cloud.apigeeregistry.v1.Instance} request.instance - * Required. The Instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.create_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_CreateInstance_async - */ - createInstance( - request?: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.create_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the Registry instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Instance to delete. - * Format: `projects/* /locations/* /instances/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.delete_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.delete_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_DeleteInstance_async - */ - async checkDeleteInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified api resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @returns {string} Resource name string. - */ - apiPath(project:string,location:string,api:string) { - return this.pathTemplates.apiPathTemplate.render({ - project: project, - location: location, - api: api, - }); - } - - /** - * Parse the project from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).project; - } - - /** - * Parse the location from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).location; - } - - /** - * Parse the api from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).api; - } - - /** - * Return a fully-qualified apiDeployment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} deployment - * @returns {string} Resource name string. - */ - apiDeploymentPath(project:string,location:string,api:string,deployment:string) { - return this.pathTemplates.apiDeploymentPathTemplate.render({ - project: project, - location: location, - api: api, - deployment: deployment, - }); - } - - /** - * Parse the project from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).project; - } - - /** - * Parse the location from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).location; - } - - /** - * Parse the api from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).api; - } - - /** - * Parse the deployment from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).deployment; - } - - /** - * Return a fully-qualified apiSpec resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} spec - * @returns {string} Resource name string. - */ - apiSpecPath(project:string,location:string,api:string,version:string,spec:string) { - return this.pathTemplates.apiSpecPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - spec: spec, - }); - } - - /** - * Parse the project from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).project; - } - - /** - * Parse the location from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).location; - } - - /** - * Parse the api from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).api; - } - - /** - * Parse the version from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the version. - */ - matchVersionFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).version; - } - - /** - * Parse the spec from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the spec. - */ - matchSpecFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).spec; - } - - /** - * Return a fully-qualified apiVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @returns {string} Resource name string. - */ - apiVersionPath(project:string,location:string,api:string,version:string) { - return this.pathTemplates.apiVersionPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - }); - } - - /** - * Parse the project from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).project; - } - - /** - * Parse the location from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).location; - } - - /** - * Parse the api from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).api; - } - - /** - * Parse the version from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the version. - */ - matchVersionFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).version; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified projectLocationApiArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiArtifactPath(project:string,location:string,api:string,artifact:string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).api; - } - - /** - * Parse the artifact from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiDeploymentArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} deployment - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiDeploymentArtifactPath(project:string,location:string,api:string,deployment:string,artifact:string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - deployment: deployment, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).api; - } - - /** - * Parse the deployment from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).deployment; - } - - /** - * Parse the artifact from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiVersionArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiVersionArtifactPath(project:string,location:string,api:string,version:string,artifact:string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).api; - } - - /** - * Parse the version from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).version; - } - - /** - * Parse the artifact from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiVersionSpecArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} spec - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiVersionSpecArtifactPath(project:string,location:string,api:string,version:string,spec:string,artifact:string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - spec: spec, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).api; - } - - /** - * Parse the version from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).version; - } - - /** - * Parse the spec from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the spec. - */ - matchSpecFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).spec; - } - - /** - * Parse the artifact from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationArtifactPath(project:string,location:string,artifact:string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.render({ - project: project, - location: location, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).project; - } - - /** - * Parse the location from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).location; - } - - /** - * Parse the artifact from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).artifact; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.provisioningStub && !this._terminated) { - return this.provisioningStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/provisioning_client_config.json b/owl-bot-staging/v1/src/v1/provisioning_client_config.json deleted file mode 100644 index 2e37ea8..0000000 --- a/owl-bot-staging/v1/src/v1/provisioning_client_config.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.cloud.apigeeregistry.v1.Provisioning": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/provisioning_proto_list.json b/owl-bot-staging/v1/src/v1/provisioning_proto_list.json deleted file mode 100644 index 4fdc846..0000000 --- a/owl-bot-staging/v1/src/v1/provisioning_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/apigeeregistry/v1/provisioning_service.proto", - "../../protos/google/cloud/apigeeregistry/v1/registry_models.proto", - "../../protos/google/cloud/apigeeregistry/v1/registry_service.proto" -] diff --git a/owl-bot-staging/v1/src/v1/registry_client.ts b/owl-bot-staging/v1/src/v1/registry_client.ts deleted file mode 100644 index 825d8b1..0000000 --- a/owl-bot-staging/v1/src/v1/registry_client.ts +++ /dev/null @@ -1,5041 +0,0 @@ -// 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 -// -// 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/registry_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './registry_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Registry service allows teams to manage descriptions of APIs. - * @class - * @memberof v1 - */ -export class RegistryClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - registryStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RegistryClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new RegistryClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RegistryClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - apiPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}' - ), - apiDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}' - ), - apiSpecPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}' - ), - apiVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationApiArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}' - ), - projectLocationApiDeploymentArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}' - ), - projectLocationApiVersionArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}' - ), - projectLocationApiVersionSpecArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}' - ), - projectLocationArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/artifacts/{artifact}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listApis: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apis'), - listApiVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiVersions'), - listApiSpecs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiSpecs'), - listApiSpecRevisions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiSpecs'), - listApiDeployments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiDeployments'), - listApiDeploymentRevisions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiDeployments'), - listArtifacts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'artifacts') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/apis/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/instances/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/runtime}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/apis/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/apis/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - - this.descriptors.longrunning = { - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.apigeeregistry.v1.Registry', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.registryStub) { - return this.registryStub; - } - - // Put together the "service stub" for - // google.cloud.apigeeregistry.v1.Registry. - this.registryStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.apigeeregistry.v1.Registry') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.apigeeregistry.v1.Registry, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const registryStubMethods = - ['listApis', 'getApi', 'createApi', 'updateApi', 'deleteApi', 'listApiVersions', 'getApiVersion', 'createApiVersion', 'updateApiVersion', 'deleteApiVersion', 'listApiSpecs', 'getApiSpec', 'getApiSpecContents', 'createApiSpec', 'updateApiSpec', 'deleteApiSpec', 'tagApiSpecRevision', 'listApiSpecRevisions', 'rollbackApiSpec', 'deleteApiSpecRevision', 'listApiDeployments', 'getApiDeployment', 'createApiDeployment', 'updateApiDeployment', 'deleteApiDeployment', 'tagApiDeploymentRevision', 'listApiDeploymentRevisions', 'rollbackApiDeployment', 'deleteApiDeploymentRevision', 'listArtifacts', 'getArtifact', 'getArtifactContents', 'createArtifact', 'replaceArtifact', 'deleteArtifact']; - for (const methodName of registryStubMethods) { - const callPromise = this.registryStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.registryStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'apigeeregistry.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'apigeeregistry.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns a specified API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the API to retrieve. - * Format: `projects/* /locations/* /apis/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApi_async - */ - getApi( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|undefined, {}|undefined - ]>; - getApi( - request: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, - {}|null|undefined>): void; - getApi( - request: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, - {}|null|undefined>): void; - getApi( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApi(request, options, callback); - } -/** - * Creates a specified API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - * @param {google.cloud.apigeeregistry.v1.Api} request.api - * Required. The API to create. - * @param {string} request.apiId - * Required. The ID to use for the API, which will become the final component of - * the API's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_api.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateApi_async - */ - createApi( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|undefined, {}|undefined - ]>; - createApi( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, - {}|null|undefined>): void; - createApi( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, - {}|null|undefined>): void; - createApi( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createApi(request, options, callback); - } -/** - * Used to modify a specified API. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.Api} request.api - * Required. The API to update. - * - * The `name` field is used to identify the API to update. - * Format: `projects/* /locations/* /apis/*` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - * @param {boolean} request.allowMissing - * If set to true, and the API is not found, a new API will be created. - * In this situation, `update_mask` is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.update_api.js - * region_tag:apigeeregistry_v1_generated_Registry_UpdateApi_async - */ - updateApi( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|undefined, {}|undefined - ]>; - updateApi( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, - {}|null|undefined>): void; - updateApi( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, - {}|null|undefined>): void; - updateApi( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'api.name': request.api!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateApi(request, options, callback); - } -/** - * Removes a specified API and all of the resources that it - * owns. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the API to delete. - * Format: `projects/* /locations/* /apis/*` - * @param {boolean} request.force - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApi_async - */ - deleteApi( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|undefined, {}|undefined - ]>; - deleteApi( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, - {}|null|undefined>): void; - deleteApi( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, - {}|null|undefined>): void; - deleteApi( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApi(request, options, callback); - } -/** - * Returns a specified version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the version to retrieve. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api_version.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApiVersion_async - */ - getApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|undefined, {}|undefined - ]>; - getApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, - {}|null|undefined>): void; - getApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, - {}|null|undefined>): void; - getApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApiVersion(request, options, callback); - } -/** - * Creates a specified version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - * @param {google.cloud.apigeeregistry.v1.ApiVersion} request.apiVersion - * Required. The version to create. - * @param {string} request.apiVersionId - * Required. The ID to use for the version, which will become the final component of - * the version's resource name. - * - * This value should be 1-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_api_version.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateApiVersion_async - */ - createApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|undefined, {}|undefined - ]>; - createApiVersion( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, - {}|null|undefined>): void; - createApiVersion( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, - {}|null|undefined>): void; - createApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createApiVersion(request, options, callback); - } -/** - * Used to modify a specified version. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.ApiVersion} request.apiVersion - * Required. The version to update. - * - * The `name` field is used to identify the version to update. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - * @param {boolean} request.allowMissing - * If set to true, and the version is not found, a new version will be - * created. In this situation, `update_mask` is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.update_api_version.js - * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiVersion_async - */ - updateApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|undefined, {}|undefined - ]>; - updateApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, - {}|null|undefined>): void; - updateApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, - {}|null|undefined>): void; - updateApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'api_version.name': request.apiVersion!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateApiVersion(request, options, callback); - } -/** - * Removes a specified version and all of the resources that - * it owns. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the version to delete. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {boolean} request.force - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_version.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiVersion_async - */ - deleteApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|undefined, {}|undefined - ]>; - deleteApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiVersion(request, options, callback); - } -/** - * Returns a specified spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to retrieve. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApiSpec_async - */ - getApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|undefined, {}|undefined - ]>; - getApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, - {}|null|undefined>): void; - getApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, - {}|null|undefined>): void; - getApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApiSpec(request, options, callback); - } -/** - * Returns the contents of a specified spec. - * If specs are stored with GZip compression, the default behavior - * is to return the spec uncompressed (the mime_type response field - * indicates the exact format returned). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec whose contents should be retrieved. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api_spec_contents.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApiSpecContents_async - */ - getApiSpecContents( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|undefined, {}|undefined - ]>; - getApiSpecContents( - request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, - {}|null|undefined>): void; - getApiSpecContents( - request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, - {}|null|undefined>): void; - getApiSpecContents( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApiSpecContents(request, options, callback); - } -/** - * Creates a specified spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {google.cloud.apigeeregistry.v1.ApiSpec} request.apiSpec - * Required. The spec to create. - * @param {string} request.apiSpecId - * Required. The ID to use for the spec, which will become the final component of - * the spec's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateApiSpec_async - */ - createApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|undefined, {}|undefined - ]>; - createApiSpec( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, - {}|null|undefined>): void; - createApiSpec( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, - {}|null|undefined>): void; - createApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createApiSpec(request, options, callback); - } -/** - * Used to modify a specified spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.ApiSpec} request.apiSpec - * Required. The spec to update. - * - * The `name` field is used to identify the spec to update. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - * @param {boolean} request.allowMissing - * If set to true, and the spec is not found, a new spec will be created. - * In this situation, `update_mask` is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.update_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiSpec_async - */ - updateApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|undefined, {}|undefined - ]>; - updateApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, - {}|null|undefined>): void; - updateApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, - {}|null|undefined>): void; - updateApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'api_spec.name': request.apiSpec!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateApiSpec(request, options, callback); - } -/** - * Removes a specified spec, all revisions, and all child - * resources (e.g., artifacts). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to delete. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - * @param {boolean} request.force - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiSpec_async - */ - deleteApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|undefined, {}|undefined - ]>; - deleteApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, - {}|null|undefined>): void; - deleteApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, - {}|null|undefined>): void; - deleteApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiSpec(request, options, callback); - } -/** - * Adds a tag to a specified revision of a spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to be tagged, including the revision ID. - * @param {string} request.tag - * Required. The tag to apply. - * The tag should be at most 40 characters, and match `{@link a-z0-9-|a-z}{3,39}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.tag_api_spec_revision.js - * region_tag:apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async - */ - tagApiSpecRevision( - request?: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|undefined, {}|undefined - ]>; - tagApiSpecRevision( - request: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): void; - tagApiSpecRevision( - request: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): void; - tagApiSpecRevision( - request?: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.tagApiSpecRevision(request, options, callback); - } -/** - * Sets the current revision to a specified prior revision. - * Note that this creates a new revision with a new revision ID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The spec being rolled back. - * @param {string} request.revisionId - * Required. The revision ID to roll back to. - * It must be a revision of the same spec. - * - * Example: `c7cfa2a8` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.rollback_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_RollbackApiSpec_async - */ - rollbackApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|undefined, {}|undefined - ]>; - rollbackApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, - {}|null|undefined>): void; - rollbackApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, - {}|null|undefined>): void; - rollbackApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.rollbackApiSpec(request, options, callback); - } -/** - * Deletes a revision of a spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec revision to be deleted, - * with a revision ID explicitly included. - * - * Example: - * `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_spec_revision.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async - */ - deleteApiSpecRevision( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|undefined, {}|undefined - ]>; - deleteApiSpecRevision( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiSpecRevision( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiSpecRevision( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiSpecRevision(request, options, callback); - } -/** - * Returns a specified deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to retrieve. - * Format: `projects/* /locations/* /apis/* /deployments/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApiDeployment_async - */ - getApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|undefined, {}|undefined - ]>; - getApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - getApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - getApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApiDeployment(request, options, callback); - } -/** - * Creates a specified deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - * @param {google.cloud.apigeeregistry.v1.ApiDeployment} request.apiDeployment - * Required. The deployment to create. - * @param {string} request.apiDeploymentId - * Required. The ID to use for the deployment, which will become the final component of - * the deployment's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateApiDeployment_async - */ - createApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|undefined, {}|undefined - ]>; - createApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - createApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - createApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createApiDeployment(request, options, callback); - } -/** - * Used to modify a specified deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.ApiDeployment} request.apiDeployment - * Required. The deployment to update. - * - * The `name` field is used to identify the deployment to update. - * Format: `projects/* /locations/* /apis/* /deployments/*` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - * @param {boolean} request.allowMissing - * If set to true, and the deployment is not found, a new deployment will be - * created. In this situation, `update_mask` is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.update_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async - */ - updateApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|undefined, {}|undefined - ]>; - updateApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - updateApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - updateApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'api_deployment.name': request.apiDeployment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateApiDeployment(request, options, callback); - } -/** - * Removes a specified deployment, all revisions, and all - * child resources (e.g., artifacts). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to delete. - * Format: `projects/* /locations/* /apis/* /deployments/*` - * @param {boolean} request.force - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async - */ - deleteApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|undefined, {}|undefined - ]>; - deleteApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - deleteApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - deleteApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiDeployment(request, options, callback); - } -/** - * Adds a tag to a specified revision of a - * deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to be tagged, including the revision ID. - * @param {string} request.tag - * Required. The tag to apply. - * The tag should be at most 40 characters, and match `{@link a-z0-9-|a-z}{3,39}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.tag_api_deployment_revision.js - * region_tag:apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async - */ - tagApiDeploymentRevision( - request?: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|undefined, {}|undefined - ]>; - tagApiDeploymentRevision( - request: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): void; - tagApiDeploymentRevision( - request: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): void; - tagApiDeploymentRevision( - request?: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.tagApiDeploymentRevision(request, options, callback); - } -/** - * Sets the current revision to a specified prior - * revision. Note that this creates a new revision with a new revision ID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The deployment being rolled back. - * @param {string} request.revisionId - * Required. The revision ID to roll back to. - * It must be a revision of the same deployment. - * - * Example: `c7cfa2a8` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.rollback_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async - */ - rollbackApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|undefined, {}|undefined - ]>; - rollbackApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - rollbackApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - rollbackApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.rollbackApiDeployment(request, options, callback); - } -/** - * Deletes a revision of a deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment revision to be deleted, - * with a revision ID explicitly included. - * - * Example: - * `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_deployment_revision.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async - */ - deleteApiDeploymentRevision( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|undefined, {}|undefined - ]>; - deleteApiDeploymentRevision( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiDeploymentRevision( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiDeploymentRevision( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiDeploymentRevision(request, options, callback); - } -/** - * Returns a specified artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the artifact to retrieve. - * Format: `{parent}/artifacts/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_artifact.js - * region_tag:apigeeregistry_v1_generated_Registry_GetArtifact_async - */ - getArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|undefined, {}|undefined - ]>; - getArtifact( - request: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, - {}|null|undefined>): void; - getArtifact( - request: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, - {}|null|undefined>): void; - getArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getArtifact(request, options, callback); - } -/** - * Returns the contents of a specified artifact. - * If artifacts are stored with GZip compression, the default behavior - * is to return the artifact uncompressed (the mime_type response field - * indicates the exact format returned). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the artifact whose contents should be retrieved. - * Format: `{parent}/artifacts/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_artifact_contents.js - * region_tag:apigeeregistry_v1_generated_Registry_GetArtifactContents_async - */ - getArtifactContents( - request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|undefined, {}|undefined - ]>; - getArtifactContents( - request: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, - {}|null|undefined>): void; - getArtifactContents( - request: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, - {}|null|undefined>): void; - getArtifactContents( - request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getArtifactContents(request, options, callback); - } -/** - * Creates a specified artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - * @param {google.cloud.apigeeregistry.v1.Artifact} request.artifact - * Required. The artifact to create. - * @param {string} request.artifactId - * Required. The ID to use for the artifact, which will become the final component of - * the artifact's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_artifact.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateArtifact_async - */ - createArtifact( - request?: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|undefined, {}|undefined - ]>; - createArtifact( - request: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, - {}|null|undefined>): void; - createArtifact( - request: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, - {}|null|undefined>): void; - createArtifact( - request?: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createArtifact(request, options, callback); - } -/** - * Used to replace a specified artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.Artifact} request.artifact - * Required. The artifact to replace. - * - * The `name` field is used to identify the artifact to replace. - * Format: `{parent}/artifacts/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.replace_artifact.js - * region_tag:apigeeregistry_v1_generated_Registry_ReplaceArtifact_async - */ - replaceArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|undefined, {}|undefined - ]>; - replaceArtifact( - request: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, - {}|null|undefined>): void; - replaceArtifact( - request: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, - {}|null|undefined>): void; - replaceArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'artifact.name': request.artifact!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.replaceArtifact(request, options, callback); - } -/** - * Removes a specified artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the artifact to delete. - * Format: `{parent}/artifacts/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_artifact.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteArtifact_async - */ - deleteArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|undefined, {}|undefined - ]>; - deleteArtifact( - request: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, - {}|null|undefined>): void; - deleteArtifact( - request: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, - {}|null|undefined>): void; - deleteArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteArtifact(request, options, callback); - } - - /** - * Returns matching APIs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The maximum number of APIs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApis` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApis` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Api]{@link google.cloud.apigeeregistry.v1.Api}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApisAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApis( - request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi[], - protos.google.cloud.apigeeregistry.v1.IListApisRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApisResponse - ]>; - listApis( - request: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApisRequest, - protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApi>): void; - listApis( - request: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApisRequest, - protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApi>): void; - listApis( - request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApisRequest, - protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApi>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApisRequest, - protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApi>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi[], - protos.google.cloud.apigeeregistry.v1.IListApisRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApisResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApis(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The maximum number of APIs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApis` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApis` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApisAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApisStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApis']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApis.createStream( - this.innerApiCalls.listApis as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApis`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The maximum number of APIs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApis` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApis` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Api]{@link google.cloud.apigeeregistry.v1.Api}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_apis.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApis_async - */ - listApisAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApis']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApis.asyncIterate( - this.innerApiCalls['listApis'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns matching versions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of versions to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiVersions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiVersions` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiVersions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion[], - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse - ]>; - listApiVersions( - request: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiVersion>): void; - listApiVersions( - request: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiVersion>): void; - listApiVersions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiVersion>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiVersion>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion[], - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiVersions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of versions to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiVersions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiVersions` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiVersionsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiVersions.createStream( - this.innerApiCalls.listApiVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiVersions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of versions to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiVersions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiVersions` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_versions.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiVersions_async - */ - listApiVersionsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiVersions.asyncIterate( - this.innerApiCalls['listApiVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns matching specs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {number} request.pageSize - * The maximum number of specs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiSpecs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiSpecs` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiSpecsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiSpecs( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec[], - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse - ]>; - listApiSpecs( - request: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; - listApiSpecs( - request: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; - listApiSpecs( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec[], - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiSpecs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {number} request.pageSize - * The maximum number of specs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiSpecs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiSpecs` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiSpecsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiSpecsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiSpecs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiSpecs.createStream( - this.innerApiCalls.listApiSpecs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiSpecs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {number} request.pageSize - * The maximum number of specs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiSpecs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiSpecs` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_specs.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiSpecs_async - */ - listApiSpecsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiSpecs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiSpecs.asyncIterate( - this.innerApiCalls['listApiSpecs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all revisions of a spec. - * Revisions are returned in descending order of revision creation time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiSpecRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiSpecRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiSpecRevisions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec[], - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse - ]>; - listApiSpecRevisions( - request: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; - listApiSpecRevisions( - request: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; - listApiSpecRevisions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec[], - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiSpecRevisions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiSpecRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiSpecRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiSpecRevisionsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listApiSpecRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiSpecRevisions.createStream( - this.innerApiCalls.listApiSpecRevisions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiSpecRevisions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiSpecRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_spec_revisions.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async - */ - listApiSpecRevisionsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listApiSpecRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiSpecRevisions.asyncIterate( - this.innerApiCalls['listApiSpecRevisions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns matching deployments. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of deployments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiDeployments` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiDeploymentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiDeployments( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment[], - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse - ]>; - listApiDeployments( - request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; - listApiDeployments( - request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; - listApiDeployments( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment[], - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiDeployments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of deployments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiDeployments` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiDeploymentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiDeploymentsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiDeployments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiDeployments.createStream( - this.innerApiCalls.listApiDeployments as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiDeployments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of deployments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiDeployments` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_deployments.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiDeployments_async - */ - listApiDeploymentsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiDeployments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiDeployments.asyncIterate( - this.innerApiCalls['listApiDeployments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all revisions of a deployment. - * Revisions are returned in descending order of revision creation time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiDeploymentRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiDeploymentRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiDeploymentRevisions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment[], - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse - ]>; - listApiDeploymentRevisions( - request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; - listApiDeploymentRevisions( - request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; - listApiDeploymentRevisions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment[], - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiDeploymentRevisions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiDeploymentRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiDeploymentRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiDeploymentRevisionsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiDeploymentRevisions.createStream( - this.innerApiCalls.listApiDeploymentRevisions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiDeploymentRevisions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiDeploymentRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_deployment_revisions.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async - */ - listApiDeploymentRevisionsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiDeploymentRevisions.asyncIterate( - this.innerApiCalls['listApiDeploymentRevisions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns matching artifacts. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListArtifacts` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListArtifacts` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listArtifactsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listArtifacts( - request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact[], - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse - ]>; - listArtifacts( - request: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IArtifact>): void; - listArtifacts( - request: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IArtifact>): void; - listArtifacts( - request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IArtifact>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IArtifact>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact[], - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listArtifacts(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListArtifacts` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListArtifacts` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listArtifactsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listArtifactsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listArtifacts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listArtifacts.createStream( - this.innerApiCalls.listArtifacts as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listArtifacts`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListArtifacts` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListArtifacts` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_artifacts.js - * region_tag:apigeeregistry_v1_generated_Registry_ListArtifacts_async - */ - listArtifactsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listArtifacts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listArtifacts.asyncIterate( - this.innerApiCalls['listArtifacts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified api resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @returns {string} Resource name string. - */ - apiPath(project:string,location:string,api:string) { - return this.pathTemplates.apiPathTemplate.render({ - project: project, - location: location, - api: api, - }); - } - - /** - * Parse the project from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).project; - } - - /** - * Parse the location from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).location; - } - - /** - * Parse the api from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).api; - } - - /** - * Return a fully-qualified apiDeployment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} deployment - * @returns {string} Resource name string. - */ - apiDeploymentPath(project:string,location:string,api:string,deployment:string) { - return this.pathTemplates.apiDeploymentPathTemplate.render({ - project: project, - location: location, - api: api, - deployment: deployment, - }); - } - - /** - * Parse the project from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).project; - } - - /** - * Parse the location from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).location; - } - - /** - * Parse the api from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).api; - } - - /** - * Parse the deployment from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).deployment; - } - - /** - * Return a fully-qualified apiSpec resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} spec - * @returns {string} Resource name string. - */ - apiSpecPath(project:string,location:string,api:string,version:string,spec:string) { - return this.pathTemplates.apiSpecPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - spec: spec, - }); - } - - /** - * Parse the project from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).project; - } - - /** - * Parse the location from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).location; - } - - /** - * Parse the api from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).api; - } - - /** - * Parse the version from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the version. - */ - matchVersionFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).version; - } - - /** - * Parse the spec from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the spec. - */ - matchSpecFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).spec; - } - - /** - * Return a fully-qualified apiVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @returns {string} Resource name string. - */ - apiVersionPath(project:string,location:string,api:string,version:string) { - return this.pathTemplates.apiVersionPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - }); - } - - /** - * Parse the project from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).project; - } - - /** - * Parse the location from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).location; - } - - /** - * Parse the api from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).api; - } - - /** - * Parse the version from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the version. - */ - matchVersionFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).version; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectLocationApiArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiArtifactPath(project:string,location:string,api:string,artifact:string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).api; - } - - /** - * Parse the artifact from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiDeploymentArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} deployment - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiDeploymentArtifactPath(project:string,location:string,api:string,deployment:string,artifact:string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - deployment: deployment, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).api; - } - - /** - * Parse the deployment from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).deployment; - } - - /** - * Parse the artifact from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiVersionArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiVersionArtifactPath(project:string,location:string,api:string,version:string,artifact:string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).api; - } - - /** - * Parse the version from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).version; - } - - /** - * Parse the artifact from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiVersionSpecArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} spec - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiVersionSpecArtifactPath(project:string,location:string,api:string,version:string,spec:string,artifact:string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - spec: spec, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).api; - } - - /** - * Parse the version from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).version; - } - - /** - * Parse the spec from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the spec. - */ - matchSpecFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).spec; - } - - /** - * Parse the artifact from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationArtifactPath(project:string,location:string,artifact:string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.render({ - project: project, - location: location, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).project; - } - - /** - * Parse the location from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).location; - } - - /** - * Parse the artifact from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).artifact; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.registryStub && !this._terminated) { - return this.registryStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/registry_client_config.json b/owl-bot-staging/v1/src/v1/registry_client_config.json deleted file mode 100644 index c26bf95..0000000 --- a/owl-bot-staging/v1/src/v1/registry_client_config.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "interfaces": { - "google.cloud.apigeeregistry.v1.Registry": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "cancelled_deadline_exceeded_aborted_unavailable": [ - "CANCELLED", - "DEADLINE_EXCEEDED", - "ABORTED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "5763d5cb4f40f09b4de469b8a0f10443a7a49d00": { - "initial_retry_delay_millis": 200, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListApis": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApi": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateApi": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "UpdateApi": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteApi": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiVersions": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApiVersion": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateApiVersion": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "UpdateApiVersion": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteApiVersion": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiSpecs": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApiSpecContents": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "UpdateApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "TagApiSpecRevision": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiSpecRevisions": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "RollbackApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteApiSpecRevision": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiDeployments": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "UpdateApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "TagApiDeploymentRevision": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiDeploymentRevisions": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "RollbackApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteApiDeploymentRevision": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListArtifacts": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetArtifactContents": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ReplaceArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/registry_proto_list.json b/owl-bot-staging/v1/src/v1/registry_proto_list.json deleted file mode 100644 index 4fdc846..0000000 --- a/owl-bot-staging/v1/src/v1/registry_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/apigeeregistry/v1/provisioning_service.proto", - "../../protos/google/cloud/apigeeregistry/v1/registry_models.proto", - "../../protos/google/cloud/apigeeregistry/v1/registry_service.proto" -] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2bd97dc..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// 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 -// -// 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const apigeeregistry = require('@google-cloud/apigee-registry'); - -function main() { - const provisioningClient = new apigeeregistry.ProvisioningClient(); - const registryClient = new apigeeregistry.RegistryClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 7c5f275..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// 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 -// -// 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. ** - -import {ProvisioningClient, RegistryClient} from '@google-cloud/apigee-registry'; - -// check that the client class type name can be used -function doStuffWithProvisioningClient(client: ProvisioningClient) { - client.close(); -} -function doStuffWithRegistryClient(client: RegistryClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const provisioningClient = new ProvisioningClient(); - doStuffWithProvisioningClient(provisioningClient); - // check that the client instance can be created - const registryClient = new RegistryClient(); - doStuffWithRegistryClient(registryClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 557a575..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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 -// -// 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_provisioning_v1.ts b/owl-bot-staging/v1/test/gapic_provisioning_v1.ts deleted file mode 100644 index 99ec132..0000000 --- a/owl-bot-staging/v1/test/gapic_provisioning_v1.ts +++ /dev/null @@ -1,1896 +0,0 @@ -// 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 -// -// 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as provisioningModule from '../src'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.ProvisioningClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = provisioningModule.v1.ProvisioningClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = provisioningModule.v1.ProvisioningClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = provisioningModule.v1.ProvisioningClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new provisioningModule.v1.ProvisioningClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new provisioningModule.v1.ProvisioningClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.provisioningStub, undefined); - await client.initialize(); - assert(client.provisioningStub); - }); - - it('has close method for the initialized client', done => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.provisioningStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.provisioningStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with call error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with call error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with LRO error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteInstanceProgress without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteInstanceProgress with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('api', () => { - const fakePath = "/rendered/path/api"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiPath', () => { - const result = client.apiPath("projectValue", "locationValue", "apiValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiName', () => { - const result = client.matchProjectFromApiName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiName', () => { - const result = client.matchLocationFromApiName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiName', () => { - const result = client.matchApiFromApiName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiDeployment', () => { - const fakePath = "/rendered/path/apiDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - deployment: "deploymentValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiDeploymentPath', () => { - const result = client.apiDeploymentPath("projectValue", "locationValue", "apiValue", "deploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiDeploymentName', () => { - const result = client.matchProjectFromApiDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiDeploymentName', () => { - const result = client.matchLocationFromApiDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiDeploymentName', () => { - const result = client.matchApiFromApiDeploymentName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromApiDeploymentName', () => { - const result = client.matchDeploymentFromApiDeploymentName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiSpec', () => { - const fakePath = "/rendered/path/apiSpec"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - spec: "specValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiSpecPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiSpecPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiSpecPath', () => { - const result = client.apiSpecPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiSpecPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiSpecName', () => { - const result = client.matchProjectFromApiSpecName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiSpecName', () => { - const result = client.matchLocationFromApiSpecName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiSpecName', () => { - const result = client.matchApiFromApiSpecName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromApiSpecName', () => { - const result = client.matchVersionFromApiSpecName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpecFromApiSpecName', () => { - const result = client.matchSpecFromApiSpecName(fakePath); - assert.strictEqual(result, "specValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiVersion', () => { - const fakePath = "/rendered/path/apiVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiVersionPath', () => { - const result = client.apiVersionPath("projectValue", "locationValue", "apiValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiVersionName', () => { - const result = client.matchProjectFromApiVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiVersionName', () => { - const result = client.matchLocationFromApiVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiVersionName', () => { - const result = client.matchApiFromApiVersionName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromApiVersionName', () => { - const result = client.matchVersionFromApiVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiArtifactPath', () => { - const result = client.projectLocationApiArtifactPath("projectValue", "locationValue", "apiValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiArtifactName', () => { - const result = client.matchApiFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiDeploymentArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiDeploymentArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - deployment: "deploymentValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiDeploymentArtifactPath', () => { - const result = client.projectLocationApiDeploymentArtifactPath("projectValue", "locationValue", "apiValue", "deploymentValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchApiFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchDeploymentFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiVersionArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiVersionArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiVersionArtifactPath', () => { - const result = client.projectLocationApiVersionArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchApiFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchVersionFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiVersionSpecArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiVersionSpecArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - spec: "specValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiVersionSpecArtifactPath', () => { - const result = client.projectLocationApiVersionSpecArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchApiFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchVersionFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpecFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchSpecFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "specValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationArtifact', () => { - const fakePath = "/rendered/path/projectLocationArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationArtifactPath', () => { - const result = client.projectLocationArtifactPath("projectValue", "locationValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationArtifactName', () => { - const result = client.matchProjectFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationArtifactName', () => { - const result = client.matchLocationFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationArtifactName', () => { - const result = client.matchArtifactFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/test/gapic_registry_v1.ts b/owl-bot-staging/v1/test/gapic_registry_v1.ts deleted file mode 100644 index ac1ecc4..0000000 --- a/owl-bot-staging/v1/test/gapic_registry_v1.ts +++ /dev/null @@ -1,6280 +0,0 @@ -// 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 -// -// 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as registryModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.RegistryClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = registryModule.v1.RegistryClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = registryModule.v1.RegistryClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = registryModule.v1.RegistryClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new registryModule.v1.RegistryClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new registryModule.v1.RegistryClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.registryStub, undefined); - await client.initialize(); - assert(client.registryStub); - }); - - it('has close method for the initialized client', done => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.registryStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.registryStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getApi', () => { - it('invokes getApi without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.getApi = stubSimpleCall(expectedResponse); - const [response] = await client.getApi(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApi without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.getApi = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApi( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApi with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApi = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApi(request), expectedError); - const actualRequest = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApi with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApi(request), expectedError); - }); - }); - - describe('createApi', () => { - it('invokes createApi without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.createApi = stubSimpleCall(expectedResponse); - const [response] = await client.createApi(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApi without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.createApi = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApi( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApi with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApi = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createApi(request), expectedError); - const actualRequest = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApi with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createApi(request), expectedError); - }); - }); - - describe('updateApi', () => { - it('invokes updateApi without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() - ); - request.api ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiRequest', ['api', 'name']); - request.api.name = defaultValue1; - const expectedHeaderRequestParams = `api.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.updateApi = stubSimpleCall(expectedResponse); - const [response] = await client.updateApi(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApi without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() - ); - request.api ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiRequest', ['api', 'name']); - request.api.name = defaultValue1; - const expectedHeaderRequestParams = `api.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.updateApi = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApi( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApi with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() - ); - request.api ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiRequest', ['api', 'name']); - request.api.name = defaultValue1; - const expectedHeaderRequestParams = `api.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApi = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateApi(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApi with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() - ); - request.api ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiRequest', ['api', 'name']); - request.api.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateApi(request), expectedError); - }); - }); - - describe('deleteApi', () => { - it('invokes deleteApi without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApi = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApi(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApi without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApi = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApi( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApi with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApi = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApi(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApi with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApi(request), expectedError); - }); - }); - - describe('getApiVersion', () => { - it('invokes getApiVersion without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.getApiVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getApiVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiVersion without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.getApiVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApiVersion( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiVersion with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApiVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApiVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiVersion with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApiVersion(request), expectedError); - }); - }); - - describe('createApiVersion', () => { - it('invokes createApiVersion without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.createApiVersion = stubSimpleCall(expectedResponse); - const [response] = await client.createApiVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiVersion without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.createApiVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApiVersion( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiVersion with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApiVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createApiVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiVersion with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createApiVersion(request), expectedError); - }); - }); - - describe('updateApiVersion', () => { - it('invokes updateApiVersion without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() - ); - request.apiVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiVersionRequest', ['apiVersion', 'name']); - request.apiVersion.name = defaultValue1; - const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.updateApiVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateApiVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiVersion without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() - ); - request.apiVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiVersionRequest', ['apiVersion', 'name']); - request.apiVersion.name = defaultValue1; - const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.updateApiVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApiVersion( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiVersion with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() - ); - request.apiVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiVersionRequest', ['apiVersion', 'name']); - request.apiVersion.name = defaultValue1; - const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApiVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateApiVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiVersion with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() - ); - request.apiVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiVersionRequest', ['apiVersion', 'name']); - request.apiVersion.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateApiVersion(request), expectedError); - }); - }); - - describe('deleteApiVersion', () => { - it('invokes deleteApiVersion without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiVersion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiVersion without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiVersion( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiVersion with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiVersion with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiVersion(request), expectedError); - }); - }); - - describe('getApiSpec', () => { - it('invokes getApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.getApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.getApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.getApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApiSpec( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApiSpec(request), expectedError); - }); - }); - - describe('getApiSpecContents', () => { - it('invokes getApiSpecContents without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiSpecContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getApiSpecContents = stubSimpleCall(expectedResponse); - const [response] = await client.getApiSpecContents(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpecContents without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiSpecContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getApiSpecContents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApiSpecContents( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpecContents with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiSpecContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApiSpecContents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApiSpecContents(request), expectedError); - const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpecContents with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiSpecContentsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApiSpecContents(request), expectedError); - }); - }); - - describe('createApiSpec', () => { - it('invokes createApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiSpecRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.createApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.createApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiSpecRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.createApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApiSpec( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiSpecRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiSpecRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createApiSpec(request), expectedError); - }); - }); - - describe('updateApiSpec', () => { - it('invokes updateApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() - ); - request.apiSpec ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiSpecRequest', ['apiSpec', 'name']); - request.apiSpec.name = defaultValue1; - const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.updateApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.updateApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() - ); - request.apiSpec ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiSpecRequest', ['apiSpec', 'name']); - request.apiSpec.name = defaultValue1; - const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.updateApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApiSpec( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() - ); - request.apiSpec ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiSpecRequest', ['apiSpec', 'name']); - request.apiSpec.name = defaultValue1; - const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() - ); - request.apiSpec ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiSpecRequest', ['apiSpec', 'name']); - request.apiSpec.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateApiSpec(request), expectedError); - }); - }); - - describe('deleteApiSpec', () => { - it('invokes deleteApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiSpec( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiSpec(request), expectedError); - }); - }); - - describe('tagApiSpecRevision', () => { - it('invokes tagApiSpecRevision without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('TagApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.tagApiSpecRevision = stubSimpleCall(expectedResponse); - const [response] = await client.tagApiSpecRevision(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiSpecRevision without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('TagApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.tagApiSpecRevision = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.tagApiSpecRevision( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiSpecRevision with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('TagApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.tagApiSpecRevision = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.tagApiSpecRevision(request), expectedError); - const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiSpecRevision with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('TagApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.tagApiSpecRevision(request), expectedError); - }); - }); - - describe('rollbackApiSpec', () => { - it('invokes rollbackApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RollbackApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.rollbackApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.rollbackApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RollbackApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.rollbackApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rollbackApiSpec( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RollbackApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rollbackApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rollbackApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RollbackApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.rollbackApiSpec(request), expectedError); - }); - }); - - describe('deleteApiSpecRevision', () => { - it('invokes deleteApiSpecRevision without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiSpecRevision(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpecRevision without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.deleteApiSpecRevision = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiSpecRevision( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpecRevision with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiSpecRevision(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpecRevision with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiSpecRevision(request), expectedError); - }); - }); - - describe('getApiDeployment', () => { - it('invokes getApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.getApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.getApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.getApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApiDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApiDeployment(request), expectedError); - }); - }); - - describe('createApiDeployment', () => { - it('invokes createApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.createApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.createApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.createApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApiDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateApiDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createApiDeployment(request), expectedError); - }); - }); - - describe('updateApiDeployment', () => { - it('invokes updateApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() - ); - request.apiDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiDeploymentRequest', ['apiDeployment', 'name']); - request.apiDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.updateApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.updateApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() - ); - request.apiDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiDeploymentRequest', ['apiDeployment', 'name']); - request.apiDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.updateApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApiDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() - ); - request.apiDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiDeploymentRequest', ['apiDeployment', 'name']); - request.apiDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() - ); - request.apiDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateApiDeploymentRequest', ['apiDeployment', 'name']); - request.apiDeployment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateApiDeployment(request), expectedError); - }); - }); - - describe('deleteApiDeployment', () => { - it('invokes deleteApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiDeployment( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiDeployment(request), expectedError); - }); - }); - - describe('tagApiDeploymentRevision', () => { - it('invokes tagApiDeploymentRevision without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('TagApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall(expectedResponse); - const [response] = await client.tagApiDeploymentRevision(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiDeploymentRevision without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('TagApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.tagApiDeploymentRevision( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiDeploymentRevision with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('TagApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.tagApiDeploymentRevision(request), expectedError); - const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiDeploymentRevision with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('TagApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.tagApiDeploymentRevision(request), expectedError); - }); - }); - - describe('rollbackApiDeployment', () => { - it('invokes rollbackApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RollbackApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.rollbackApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.rollbackApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RollbackApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.rollbackApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rollbackApiDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RollbackApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rollbackApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rollbackApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('RollbackApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.rollbackApiDeployment(request), expectedError); - }); - }); - - describe('deleteApiDeploymentRevision', () => { - it('invokes deleteApiDeploymentRevision without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiDeploymentRevision(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeploymentRevision without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiDeploymentRevision( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeploymentRevision with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiDeploymentRevision(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeploymentRevision with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiDeploymentRevision(request), expectedError); - }); - }); - - describe('getArtifact', () => { - it('invokes getArtifact without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.getArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.getArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifact without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.getArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getArtifact( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifact with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifact with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getArtifact(request), expectedError); - }); - }); - - describe('getArtifactContents', () => { - it('invokes getArtifactContents without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetArtifactContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getArtifactContents = stubSimpleCall(expectedResponse); - const [response] = await client.getArtifactContents(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifactContents without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetArtifactContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getArtifactContents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getArtifactContents( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifactContents with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetArtifactContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getArtifactContents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getArtifactContents(request), expectedError); - const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifactContents with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetArtifactContentsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getArtifactContents(request), expectedError); - }); - }); - - describe('createArtifact', () => { - it('invokes createArtifact without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateArtifactRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.createArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.createArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createArtifact without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateArtifactRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.createArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createArtifact( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createArtifact with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateArtifactRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createArtifact with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateArtifactRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createArtifact(request), expectedError); - }); - }); - - describe('replaceArtifact', () => { - it('invokes replaceArtifact without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() - ); - request.artifact ??= {}; - const defaultValue1 = - getTypeDefaultValue('ReplaceArtifactRequest', ['artifact', 'name']); - request.artifact.name = defaultValue1; - const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.replaceArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.replaceArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceArtifact without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() - ); - request.artifact ??= {}; - const defaultValue1 = - getTypeDefaultValue('ReplaceArtifactRequest', ['artifact', 'name']); - request.artifact.name = defaultValue1; - const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.replaceArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.replaceArtifact( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceArtifact with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() - ); - request.artifact ??= {}; - const defaultValue1 = - getTypeDefaultValue('ReplaceArtifactRequest', ['artifact', 'name']); - request.artifact.name = defaultValue1; - const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.replaceArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceArtifact with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() - ); - request.artifact ??= {}; - const defaultValue1 = - getTypeDefaultValue('ReplaceArtifactRequest', ['artifact', 'name']); - request.artifact.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.replaceArtifact(request), expectedError); - }); - }); - - describe('deleteArtifact', () => { - it('invokes deleteArtifact without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.deleteArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteArtifact without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteArtifact( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteArtifact with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteArtifact with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteArtifact(request), expectedError); - }); - }); - - describe('listApis', () => { - it('invokes listApis without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - ]; - client.innerApiCalls.listApis = stubSimpleCall(expectedResponse); - const [response] = await client.listApis(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApis without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - ]; - client.innerApiCalls.listApis = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApis( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApis with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApis = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApis(request), expectedError); - const actualRequest = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApisStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - ]; - client.descriptors.page.listApis.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApisStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.Api[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Api) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApis.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApis, request)); - assert( - (client.descriptors.page.listApis.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApisStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApis.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApisStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.Api[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Api) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApis.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApis, request)); - assert( - (client.descriptors.page.listApis.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApis without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - ]; - client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApi[] = []; - const iterable = client.listApisAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApis.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApis.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApis with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApisAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApi[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApis.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApis.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiVersions', () => { - it('invokes listApiVersions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - ]; - client.innerApiCalls.listApiVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listApiVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiVersions without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - ]; - client.innerApiCalls.listApiVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiVersions( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiVersions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiVersionsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - ]; - client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiVersion[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiVersions, request)); - assert( - (client.descriptors.page.listApiVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiVersionsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiVersion[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiVersions, request)); - assert( - (client.descriptors.page.listApiVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiVersions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - ]; - client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiVersion[] = []; - const iterable = client.listApiVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiVersions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiSpecs', () => { - it('invokes listApiSpecs without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.innerApiCalls.listApiSpecs = stubSimpleCall(expectedResponse); - const [response] = await client.listApiSpecs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecs without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.innerApiCalls.listApiSpecs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiSpecs( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecs with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiSpecs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiSpecs(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiSpecsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiSpecs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiSpecs, request)); - assert( - (client.descriptors.page.listApiSpecs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiSpecsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiSpecsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiSpecs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiSpecs, request)); - assert( - (client.descriptors.page.listApiSpecs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiSpecs without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; - const iterable = client.listApiSpecsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiSpecs with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiSpecsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiSpecRevisions', () => { - it('invokes listApiSpecRevisions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.innerApiCalls.listApiSpecRevisions = stubSimpleCall(expectedResponse); - const [response] = await client.listApiSpecRevisions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecRevisions without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.innerApiCalls.listApiSpecRevisions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiSpecRevisions( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecRevisions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiSpecRevisions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiSpecRevisions(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecRevisionsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiSpecRevisionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiSpecRevisions, request)); - assert( - (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiSpecRevisionsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiSpecRevisionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiSpecRevisions, request)); - assert( - (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiSpecRevisions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; - const iterable = client.listApiSpecRevisionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiSpecRevisions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiSpecRevisionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiDeployments', () => { - it('invokes listApiDeployments without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.innerApiCalls.listApiDeployments = stubSimpleCall(expectedResponse); - const [response] = await client.listApiDeployments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeployments without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.innerApiCalls.listApiDeployments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiDeployments( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeployments with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiDeployments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiDeployments(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeploymentsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiDeployments, request)); - assert( - (client.descriptors.page.listApiDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiDeploymentsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiDeployments, request)); - assert( - (client.descriptors.page.listApiDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiDeployments without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; - const iterable = client.listApiDeploymentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiDeployments with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiDeploymentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiDeploymentRevisions', () => { - it('invokes listApiDeploymentRevisions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall(expectedResponse); - const [response] = await client.listApiDeploymentRevisions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeploymentRevisions without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiDeploymentRevisions( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeploymentRevisions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiDeploymentRevisions(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeploymentRevisionsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiDeploymentRevisionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiDeploymentRevisions, request)); - assert( - (client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiDeploymentRevisionsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiDeploymentRevisionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiDeploymentRevisions, request)); - assert( - (client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiDeploymentRevisions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; - const iterable = client.listApiDeploymentRevisionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiDeploymentRevisions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiDeploymentRevisionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listArtifacts', () => { - it('invokes listArtifacts without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - ]; - client.innerApiCalls.listArtifacts = stubSimpleCall(expectedResponse); - const [response] = await client.listArtifacts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listArtifacts without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - ]; - client.innerApiCalls.listArtifacts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listArtifacts( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listArtifacts with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listArtifacts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listArtifacts(request), expectedError); - const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listArtifactsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - ]; - client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listArtifactsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.Artifact[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Artifact) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listArtifacts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listArtifacts, request)); - assert( - (client.descriptors.page.listArtifacts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listArtifactsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listArtifactsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.Artifact[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Artifact) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listArtifacts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listArtifacts, request)); - assert( - (client.descriptors.page.listArtifacts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listArtifacts without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - ]; - client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IArtifact[] = []; - const iterable = client.listArtifactsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listArtifacts with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listArtifactsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IArtifact[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('api', () => { - const fakePath = "/rendered/path/api"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiPath', () => { - const result = client.apiPath("projectValue", "locationValue", "apiValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiName', () => { - const result = client.matchProjectFromApiName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiName', () => { - const result = client.matchLocationFromApiName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiName', () => { - const result = client.matchApiFromApiName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiDeployment', () => { - const fakePath = "/rendered/path/apiDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - deployment: "deploymentValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiDeploymentPath', () => { - const result = client.apiDeploymentPath("projectValue", "locationValue", "apiValue", "deploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiDeploymentName', () => { - const result = client.matchProjectFromApiDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiDeploymentName', () => { - const result = client.matchLocationFromApiDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiDeploymentName', () => { - const result = client.matchApiFromApiDeploymentName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromApiDeploymentName', () => { - const result = client.matchDeploymentFromApiDeploymentName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiSpec', () => { - const fakePath = "/rendered/path/apiSpec"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - spec: "specValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiSpecPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiSpecPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiSpecPath', () => { - const result = client.apiSpecPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiSpecPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiSpecName', () => { - const result = client.matchProjectFromApiSpecName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiSpecName', () => { - const result = client.matchLocationFromApiSpecName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiSpecName', () => { - const result = client.matchApiFromApiSpecName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromApiSpecName', () => { - const result = client.matchVersionFromApiSpecName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpecFromApiSpecName', () => { - const result = client.matchSpecFromApiSpecName(fakePath); - assert.strictEqual(result, "specValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiVersion', () => { - const fakePath = "/rendered/path/apiVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiVersionPath', () => { - const result = client.apiVersionPath("projectValue", "locationValue", "apiValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiVersionName', () => { - const result = client.matchProjectFromApiVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiVersionName', () => { - const result = client.matchLocationFromApiVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiVersionName', () => { - const result = client.matchApiFromApiVersionName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromApiVersionName', () => { - const result = client.matchVersionFromApiVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiArtifactPath', () => { - const result = client.projectLocationApiArtifactPath("projectValue", "locationValue", "apiValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiArtifactName', () => { - const result = client.matchApiFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiDeploymentArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiDeploymentArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - deployment: "deploymentValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiDeploymentArtifactPath', () => { - const result = client.projectLocationApiDeploymentArtifactPath("projectValue", "locationValue", "apiValue", "deploymentValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchApiFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchDeploymentFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiVersionArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiVersionArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiVersionArtifactPath', () => { - const result = client.projectLocationApiVersionArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchApiFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchVersionFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiVersionSpecArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiVersionSpecArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - spec: "specValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiVersionSpecArtifactPath', () => { - const result = client.projectLocationApiVersionSpecArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchApiFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchVersionFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpecFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchSpecFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "specValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationArtifact', () => { - const fakePath = "/rendered/path/projectLocationArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationArtifactPath', () => { - const result = client.projectLocationArtifactPath("projectValue", "locationValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationArtifactName', () => { - const result = client.matchProjectFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationArtifactName', () => { - const result = client.matchLocationFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationArtifactName', () => { - const result = client.matchArtifactFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index c94e0fd..0000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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 -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'Provisioning', - filename: './provisioning.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/src/v1/provisioning_client.ts b/src/v1/provisioning_client.ts index 122b3c9..ecfe3d3 100644 --- a/src/v1/provisioning_client.ts +++ b/src/v1/provisioning_client.ts @@ -634,7 +634,7 @@ export class ProvisioningClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getInstance(request, options, callback); @@ -743,7 +743,7 @@ export class ProvisioningClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createInstance(request, options, callback); @@ -882,7 +882,7 @@ export class ProvisioningClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteInstance(request, options, callback); diff --git a/src/v1/registry_client.ts b/src/v1/registry_client.ts index 3bcb8ba..a4aba42 100644 --- a/src/v1/registry_client.ts +++ b/src/v1/registry_client.ts @@ -681,7 +681,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getApi(request, options, callback); @@ -783,7 +783,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createApi(request, options, callback); @@ -885,7 +885,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'api.name': request.api!.name || '', + 'api.name': request.api!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateApi(request, options, callback); @@ -981,7 +981,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteApi(request, options, callback); @@ -1073,7 +1073,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getApiVersion(request, options, callback); @@ -1181,7 +1181,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createApiVersion(request, options, callback); @@ -1289,7 +1289,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'api_version.name': request.apiVersion!.name || '', + 'api_version.name': request.apiVersion!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateApiVersion(request, options, callback); @@ -1391,7 +1391,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteApiVersion(request, options, callback); @@ -1483,7 +1483,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getApiSpec(request, options, callback); @@ -1584,7 +1584,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getApiSpecContents(request, options, callback); @@ -1686,7 +1686,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createApiSpec(request, options, callback); @@ -1788,7 +1788,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'api_spec.name': request.apiSpec!.name || '', + 'api_spec.name': request.apiSpec!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateApiSpec(request, options, callback); @@ -1884,7 +1884,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteApiSpec(request, options, callback); @@ -1984,7 +1984,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.tagApiSpecRevision(request, options, callback); @@ -2081,7 +2081,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.rollbackApiSpec(request, options, callback); @@ -2182,7 +2182,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteApiSpecRevision(request, options, callback); @@ -2280,7 +2280,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getApiDeployment(request, options, callback); @@ -2388,7 +2388,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createApiDeployment(request, options, callback); @@ -2496,7 +2496,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'api_deployment.name': request.apiDeployment!.name || '', + 'api_deployment.name': request.apiDeployment!.name ?? '', }); this.initialize(); return this.innerApiCalls.updateApiDeployment(request, options, callback); @@ -2598,7 +2598,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteApiDeployment(request, options, callback); @@ -2699,7 +2699,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.tagApiDeploymentRevision( @@ -2806,7 +2806,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.rollbackApiDeployment(request, options, callback); @@ -2907,7 +2907,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteApiDeploymentRevision( @@ -3003,7 +3003,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getArtifact(request, options, callback); @@ -3104,7 +3104,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getArtifactContents(request, options, callback); @@ -3206,7 +3206,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.createArtifact(request, options, callback); @@ -3300,7 +3300,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - 'artifact.name': request.artifact!.name || '', + 'artifact.name': request.artifact!.name ?? '', }); this.initialize(); return this.innerApiCalls.replaceArtifact(request, options, callback); @@ -3392,7 +3392,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.deleteArtifact(request, options, callback); @@ -3502,7 +3502,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listApis(request, options, callback); @@ -3551,7 +3551,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listApis']; const callSettings = defaultCallSettings.merge(options); @@ -3609,7 +3609,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listApis']; const callSettings = defaultCallSettings.merge(options); @@ -3724,7 +3724,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listApiVersions(request, options, callback); @@ -3773,7 +3773,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listApiVersions']; const callSettings = defaultCallSettings.merge(options); @@ -3831,7 +3831,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listApiVersions']; const callSettings = defaultCallSettings.merge(options); @@ -3946,7 +3946,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listApiSpecs(request, options, callback); @@ -3995,7 +3995,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listApiSpecs']; const callSettings = defaultCallSettings.merge(options); @@ -4053,7 +4053,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listApiSpecs']; const callSettings = defaultCallSettings.merge(options); @@ -4159,7 +4159,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.listApiSpecRevisions(request, options, callback); @@ -4198,7 +4198,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); const defaultCallSettings = this._defaults['listApiSpecRevisions']; const callSettings = defaultCallSettings.merge(options); @@ -4246,7 +4246,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); const defaultCallSettings = this._defaults['listApiSpecRevisions']; const callSettings = defaultCallSettings.merge(options); @@ -4361,7 +4361,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listApiDeployments(request, options, callback); @@ -4410,7 +4410,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listApiDeployments']; const callSettings = defaultCallSettings.merge(options); @@ -4468,7 +4468,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listApiDeployments']; const callSettings = defaultCallSettings.merge(options); @@ -4574,7 +4574,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.listApiDeploymentRevisions( @@ -4617,7 +4617,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; const callSettings = defaultCallSettings.merge(options); @@ -4665,7 +4665,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; const callSettings = defaultCallSettings.merge(options); @@ -4780,7 +4780,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listArtifacts(request, options, callback); @@ -4829,7 +4829,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listArtifacts']; const callSettings = defaultCallSettings.merge(options); @@ -4887,7 +4887,7 @@ export class RegistryClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listArtifacts']; const callSettings = defaultCallSettings.merge(options); diff --git a/test/gapic_provisioning_v1.ts b/test/gapic_provisioning_v1.ts index 2928629..328ffe1 100644 --- a/test/gapic_provisioning_v1.ts +++ b/test/gapic_provisioning_v1.ts @@ -31,6 +31,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -218,26 +233,23 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Instance() ); client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); const [response] = await client.getInstance(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getInstance without error using callback', async () => { @@ -249,15 +261,9 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Instance() ); @@ -280,11 +286,14 @@ describe('v1.ProvisioningClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getInstance with error', async () => { @@ -296,26 +305,23 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getInstance = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getInstance(request), expectedError); - assert( - (client.innerApiCalls.getInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getInstance with closed client', async () => { @@ -327,7 +333,8 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetInstanceRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getInstance(request), expectedError); @@ -344,15 +351,11 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateInstanceRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -361,11 +364,14 @@ describe('v1.ProvisioningClient', () => { const [operation] = await client.createInstance(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createInstance without error using callback', async () => { @@ -377,15 +383,11 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateInstanceRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -415,11 +417,14 @@ describe('v1.ProvisioningClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createInstance with call error', async () => { @@ -431,26 +436,25 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateInstanceRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createInstance = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.createInstance(request), expectedError); - assert( - (client.innerApiCalls.createInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createInstance with LRO error', async () => { @@ -462,15 +466,11 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateInstanceRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createInstance = stubLongRunningCall( undefined, @@ -479,11 +479,14 @@ describe('v1.ProvisioningClient', () => { ); const [operation] = await client.createInstance(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.createInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkCreateInstanceProgress without error', async () => { @@ -538,15 +541,11 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteInstanceRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -555,11 +554,14 @@ describe('v1.ProvisioningClient', () => { const [operation] = await client.deleteInstance(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteInstance without error using callback', async () => { @@ -571,15 +573,11 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteInstanceRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); @@ -609,11 +607,14 @@ describe('v1.ProvisioningClient', () => { >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteInstance with call error', async () => { @@ -625,26 +626,25 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteInstanceRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteInstance = stubLongRunningCall( undefined, expectedError ); await assert.rejects(client.deleteInstance(request), expectedError); - assert( - (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteInstance with LRO error', async () => { @@ -656,15 +656,11 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteInstanceRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteInstance = stubLongRunningCall( undefined, @@ -673,11 +669,14 @@ describe('v1.ProvisioningClient', () => { ); const [operation] = await client.deleteInstance(request); await assert.rejects(operation.promise(), expectedError); - assert( - (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes checkDeleteInstanceProgress without error', async () => { @@ -1192,12 +1191,15 @@ describe('v1.ProvisioningClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -1228,12 +1230,15 @@ describe('v1.ProvisioningClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/test/gapic_registry_v1.ts b/test/gapic_registry_v1.ts index 5b982c4..9bbe2e9 100644 --- a/test/gapic_registry_v1.ts +++ b/test/gapic_registry_v1.ts @@ -32,6 +32,21 @@ import { LocationProtos, } from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -225,26 +240,23 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Api() ); client.innerApiCalls.getApi = stubSimpleCall(expectedResponse); const [response] = await client.getApi(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.getApi as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApi without error using callback', async () => { @@ -256,15 +268,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Api() ); @@ -287,11 +293,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = (client.innerApiCalls.getApi as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApi with error', async () => { @@ -303,23 +312,20 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getApi = stubSimpleCall(undefined, expectedError); await assert.rejects(client.getApi(request), expectedError); - assert( - (client.innerApiCalls.getApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = (client.innerApiCalls.getApi as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApi with closed client', async () => { @@ -331,7 +337,8 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetApiRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getApi(request), expectedError); @@ -348,26 +355,23 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Api() ); client.innerApiCalls.createApi = stubSimpleCall(expectedResponse); const [response] = await client.createApi(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApi without error using callback', async () => { @@ -379,15 +383,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Api() ); @@ -410,11 +408,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApi with error', async () => { @@ -426,23 +427,20 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createApi = stubSimpleCall(undefined, expectedError); await assert.rejects(client.createApi(request), expectedError); - assert( - (client.innerApiCalls.createApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApi with closed client', async () => { @@ -454,7 +452,8 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateApiRequest', ['parent']); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createApi(request), expectedError); @@ -471,27 +470,27 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() ); - request.api = {}; - request.api.name = ''; - const expectedHeaderRequestParams = 'api.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.api ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiRequest', [ + 'api', + 'name', + ]); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Api() ); client.innerApiCalls.updateApi = stubSimpleCall(expectedResponse); const [response] = await client.updateApi(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApi without error using callback', async () => { @@ -503,16 +502,13 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() ); - request.api = {}; - request.api.name = ''; - const expectedHeaderRequestParams = 'api.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.api ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiRequest', [ + 'api', + 'name', + ]); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Api() ); @@ -535,11 +531,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApi with error', async () => { @@ -551,24 +550,24 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() ); - request.api = {}; - request.api.name = ''; - const expectedHeaderRequestParams = 'api.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.api ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiRequest', [ + 'api', + 'name', + ]); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateApi = stubSimpleCall(undefined, expectedError); await assert.rejects(client.updateApi(request), expectedError); - assert( - (client.innerApiCalls.updateApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApi with closed client', async () => { @@ -580,8 +579,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() ); - request.api = {}; - request.api.name = ''; + request.api ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiRequest', [ + 'api', + 'name', + ]); + request.api.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateApi(request), expectedError); @@ -598,26 +601,23 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteApi = stubSimpleCall(expectedResponse); const [response] = await client.deleteApi(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApi without error using callback', async () => { @@ -629,15 +629,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -660,11 +654,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApi with error', async () => { @@ -676,23 +673,20 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteApi = stubSimpleCall(undefined, expectedError); await assert.rejects(client.deleteApi(request), expectedError); - assert( - (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApi as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApi as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApi with closed client', async () => { @@ -704,7 +698,8 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteApiRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteApi(request), expectedError); @@ -721,26 +716,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiVersionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() ); client.innerApiCalls.getApiVersion = stubSimpleCall(expectedResponse); const [response] = await client.getApiVersion(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiVersion without error using callback', async () => { @@ -752,15 +746,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiVersionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() ); @@ -783,11 +773,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiVersion with error', async () => { @@ -799,26 +792,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiVersionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getApiVersion = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getApiVersion(request), expectedError); - assert( - (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiVersion with closed client', async () => { @@ -830,7 +822,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetApiVersionRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getApiVersion(request), expectedError); @@ -847,26 +842,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiVersionRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() ); client.innerApiCalls.createApiVersion = stubSimpleCall(expectedResponse); const [response] = await client.createApiVersion(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiVersion without error using callback', async () => { @@ -878,15 +872,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiVersionRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() ); @@ -909,11 +899,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiVersion with error', async () => { @@ -925,26 +918,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiVersionRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createApiVersion = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createApiVersion(request), expectedError); - assert( - (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiVersion with closed client', async () => { @@ -956,7 +948,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateApiVersionRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createApiVersion(request), expectedError); @@ -973,27 +968,27 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() ); - request.apiVersion = {}; - request.apiVersion.name = ''; - const expectedHeaderRequestParams = 'api_version.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiVersion ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiVersionRequest', [ + 'apiVersion', + 'name', + ]); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() ); client.innerApiCalls.updateApiVersion = stubSimpleCall(expectedResponse); const [response] = await client.updateApiVersion(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiVersion without error using callback', async () => { @@ -1005,16 +1000,13 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() ); - request.apiVersion = {}; - request.apiVersion.name = ''; - const expectedHeaderRequestParams = 'api_version.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiVersion ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiVersionRequest', [ + 'apiVersion', + 'name', + ]); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() ); @@ -1037,11 +1029,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiVersion with error', async () => { @@ -1053,27 +1048,27 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() ); - request.apiVersion = {}; - request.apiVersion.name = ''; - const expectedHeaderRequestParams = 'api_version.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiVersion ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiVersionRequest', [ + 'apiVersion', + 'name', + ]); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateApiVersion = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateApiVersion(request), expectedError); - assert( - (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiVersion with closed client', async () => { @@ -1085,8 +1080,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() ); - request.apiVersion = {}; - request.apiVersion.name = ''; + request.apiVersion ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiVersionRequest', [ + 'apiVersion', + 'name', + ]); + request.apiVersion.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateApiVersion(request), expectedError); @@ -1103,26 +1102,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiVersionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteApiVersion = stubSimpleCall(expectedResponse); const [response] = await client.deleteApiVersion(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiVersion without error using callback', async () => { @@ -1134,15 +1132,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiVersionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -1165,11 +1159,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiVersion with error', async () => { @@ -1181,26 +1178,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiVersionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteApiVersion = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteApiVersion(request), expectedError); - assert( - (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiVersion with closed client', async () => { @@ -1212,7 +1208,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteApiVersionRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteApiVersion(request), expectedError); @@ -1229,26 +1228,23 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); client.innerApiCalls.getApiSpec = stubSimpleCall(expectedResponse); const [response] = await client.getApiSpec(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiSpec without error using callback', async () => { @@ -1260,15 +1256,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); @@ -1291,11 +1281,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiSpec with error', async () => { @@ -1307,26 +1300,23 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getApiSpec = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getApiSpec(request), expectedError); - assert( - (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiSpec with closed client', async () => { @@ -1338,7 +1328,8 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetApiSpecRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getApiSpec(request), expectedError); @@ -1355,15 +1346,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiSpecContentsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); @@ -1371,11 +1358,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getApiSpecContents(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getApiSpecContents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiSpecContents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiSpecContents without error using callback', async () => { @@ -1387,15 +1377,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiSpecContentsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); @@ -1415,11 +1401,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getApiSpecContents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiSpecContents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiSpecContents with error', async () => { @@ -1431,26 +1420,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiSpecContentsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getApiSpecContents = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getApiSpecContents(request), expectedError); - assert( - (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getApiSpecContents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiSpecContents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiSpecContents with closed client', async () => { @@ -1462,7 +1450,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetApiSpecContentsRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getApiSpecContents(request), expectedError); @@ -1479,26 +1470,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiSpecRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); client.innerApiCalls.createApiSpec = stubSimpleCall(expectedResponse); const [response] = await client.createApiSpec(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiSpec without error using callback', async () => { @@ -1510,15 +1500,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiSpecRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); @@ -1541,11 +1527,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiSpec with error', async () => { @@ -1557,26 +1546,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiSpecRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createApiSpec = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createApiSpec(request), expectedError); - assert( - (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiSpec with closed client', async () => { @@ -1588,7 +1576,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateApiSpecRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createApiSpec(request), expectedError); @@ -1605,27 +1596,27 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() ); - request.apiSpec = {}; - request.apiSpec.name = ''; - const expectedHeaderRequestParams = 'api_spec.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiSpec ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiSpecRequest', [ + 'apiSpec', + 'name', + ]); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); client.innerApiCalls.updateApiSpec = stubSimpleCall(expectedResponse); const [response] = await client.updateApiSpec(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiSpec without error using callback', async () => { @@ -1637,16 +1628,13 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() ); - request.apiSpec = {}; - request.apiSpec.name = ''; - const expectedHeaderRequestParams = 'api_spec.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiSpec ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiSpecRequest', [ + 'apiSpec', + 'name', + ]); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); @@ -1669,11 +1657,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiSpec with error', async () => { @@ -1685,27 +1676,27 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() ); - request.apiSpec = {}; - request.apiSpec.name = ''; - const expectedHeaderRequestParams = 'api_spec.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiSpec ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiSpecRequest', [ + 'apiSpec', + 'name', + ]); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateApiSpec = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateApiSpec(request), expectedError); - assert( - (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiSpec with closed client', async () => { @@ -1717,8 +1708,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() ); - request.apiSpec = {}; - request.apiSpec.name = ''; + request.apiSpec ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiSpecRequest', [ + 'apiSpec', + 'name', + ]); + request.apiSpec.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateApiSpec(request), expectedError); @@ -1735,26 +1730,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiSpecRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteApiSpec = stubSimpleCall(expectedResponse); const [response] = await client.deleteApiSpec(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiSpec without error using callback', async () => { @@ -1766,15 +1760,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiSpecRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -1797,11 +1787,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiSpec with error', async () => { @@ -1813,26 +1806,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiSpecRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteApiSpec = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteApiSpec(request), expectedError); - assert( - (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiSpec with closed client', async () => { @@ -1844,7 +1836,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteApiSpecRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteApiSpec(request), expectedError); @@ -1861,15 +1856,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TagApiSpecRevisionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); @@ -1877,11 +1868,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.tagApiSpecRevision(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.tagApiSpecRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tagApiSpecRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tagApiSpecRevision without error using callback', async () => { @@ -1893,15 +1887,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TagApiSpecRevisionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); @@ -1924,11 +1914,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.tagApiSpecRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tagApiSpecRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tagApiSpecRevision with error', async () => { @@ -1940,26 +1933,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TagApiSpecRevisionRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.tagApiSpecRevision = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.tagApiSpecRevision(request), expectedError); - assert( - (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.tagApiSpecRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tagApiSpecRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tagApiSpecRevision with closed client', async () => { @@ -1971,7 +1963,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('TagApiSpecRevisionRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.tagApiSpecRevision(request), expectedError); @@ -1988,26 +1983,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RollbackApiSpecRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); client.innerApiCalls.rollbackApiSpec = stubSimpleCall(expectedResponse); const [response] = await client.rollbackApiSpec(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rollbackApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollbackApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rollbackApiSpec without error using callback', async () => { @@ -2019,15 +2013,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RollbackApiSpecRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); @@ -2050,11 +2040,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.rollbackApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollbackApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rollbackApiSpec with error', async () => { @@ -2066,26 +2059,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('RollbackApiSpecRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.rollbackApiSpec = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.rollbackApiSpec(request), expectedError); - assert( - (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rollbackApiSpec as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollbackApiSpec as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rollbackApiSpec with closed client', async () => { @@ -2097,7 +2089,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('RollbackApiSpecRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.rollbackApiSpec(request), expectedError); @@ -2114,15 +2109,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'DeleteApiSpecRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); @@ -2130,11 +2122,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.deleteApiSpecRevision(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiSpecRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiSpecRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiSpecRevision without error using callback', async () => { @@ -2146,15 +2141,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'DeleteApiSpecRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() ); @@ -2177,11 +2169,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiSpecRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiSpecRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiSpecRevision with error', async () => { @@ -2193,15 +2188,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'DeleteApiSpecRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall( undefined, @@ -2211,11 +2203,14 @@ describe('v1.RegistryClient', () => { client.deleteApiSpecRevision(request), expectedError ); - assert( - (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiSpecRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiSpecRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiSpecRevision with closed client', async () => { @@ -2227,7 +2222,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + 'DeleteApiSpecRevisionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -2247,26 +2246,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiDeploymentRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); client.innerApiCalls.getApiDeployment = stubSimpleCall(expectedResponse); const [response] = await client.getApiDeployment(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiDeployment without error using callback', async () => { @@ -2278,15 +2276,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiDeploymentRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2309,11 +2303,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiDeployment with error', async () => { @@ -2325,26 +2322,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetApiDeploymentRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getApiDeployment = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getApiDeployment(request), expectedError); - assert( - (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getApiDeployment with closed client', async () => { @@ -2356,7 +2352,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetApiDeploymentRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getApiDeployment(request), expectedError); @@ -2373,15 +2372,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiDeploymentRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2389,11 +2384,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.createApiDeployment(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiDeployment without error using callback', async () => { @@ -2405,15 +2403,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiDeploymentRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2436,11 +2430,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiDeployment with error', async () => { @@ -2452,26 +2449,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateApiDeploymentRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createApiDeployment = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createApiDeployment(request), expectedError); - assert( - (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createApiDeployment with closed client', async () => { @@ -2483,7 +2479,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateApiDeploymentRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createApiDeployment(request), expectedError); @@ -2500,16 +2499,13 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() ); - request.apiDeployment = {}; - request.apiDeployment.name = ''; - const expectedHeaderRequestParams = 'api_deployment.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiDeploymentRequest', [ + 'apiDeployment', + 'name', + ]); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2517,11 +2513,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateApiDeployment(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiDeployment without error using callback', async () => { @@ -2533,16 +2532,13 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() ); - request.apiDeployment = {}; - request.apiDeployment.name = ''; - const expectedHeaderRequestParams = 'api_deployment.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiDeploymentRequest', [ + 'apiDeployment', + 'name', + ]); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2565,11 +2561,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiDeployment with error', async () => { @@ -2581,27 +2580,27 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() ); - request.apiDeployment = {}; - request.apiDeployment.name = ''; - const expectedHeaderRequestParams = 'api_deployment.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.apiDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiDeploymentRequest', [ + 'apiDeployment', + 'name', + ]); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateApiDeployment = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateApiDeployment(request), expectedError); - assert( - (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateApiDeployment with closed client', async () => { @@ -2613,8 +2612,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() ); - request.apiDeployment = {}; - request.apiDeployment.name = ''; + request.apiDeployment ??= {}; + const defaultValue1 = getTypeDefaultValue('UpdateApiDeploymentRequest', [ + 'apiDeployment', + 'name', + ]); + request.apiDeployment.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateApiDeployment(request), expectedError); @@ -2631,15 +2634,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiDeploymentRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -2647,11 +2646,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.deleteApiDeployment(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiDeployment without error using callback', async () => { @@ -2663,15 +2665,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiDeploymentRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -2694,11 +2692,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiDeployment with error', async () => { @@ -2710,26 +2711,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteApiDeploymentRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteApiDeployment = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteApiDeployment(request), expectedError); - assert( - (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiDeployment with closed client', async () => { @@ -2741,7 +2741,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteApiDeploymentRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteApiDeployment(request), expectedError); @@ -2758,15 +2761,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'TagApiDeploymentRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2774,11 +2774,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.tagApiDeploymentRevision(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.tagApiDeploymentRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tagApiDeploymentRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tagApiDeploymentRevision without error using callback', async () => { @@ -2790,15 +2793,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'TagApiDeploymentRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2821,11 +2821,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.tagApiDeploymentRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tagApiDeploymentRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tagApiDeploymentRevision with error', async () => { @@ -2837,15 +2840,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'TagApiDeploymentRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall( undefined, @@ -2855,11 +2855,14 @@ describe('v1.RegistryClient', () => { client.tagApiDeploymentRevision(request), expectedError ); - assert( - (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.tagApiDeploymentRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.tagApiDeploymentRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes tagApiDeploymentRevision with closed client', async () => { @@ -2871,7 +2874,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + 'TagApiDeploymentRevisionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -2891,15 +2898,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RollbackApiDeploymentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2907,11 +2911,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.rollbackApiDeployment(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rollbackApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollbackApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rollbackApiDeployment without error using callback', async () => { @@ -2923,15 +2930,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RollbackApiDeploymentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -2954,11 +2958,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.rollbackApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollbackApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rollbackApiDeployment with error', async () => { @@ -2970,15 +2977,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'RollbackApiDeploymentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.rollbackApiDeployment = stubSimpleCall( undefined, @@ -2988,11 +2992,14 @@ describe('v1.RegistryClient', () => { client.rollbackApiDeployment(request), expectedError ); - assert( - (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.rollbackApiDeployment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollbackApiDeployment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes rollbackApiDeployment with closed client', async () => { @@ -3004,7 +3011,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + 'RollbackApiDeploymentRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -3024,15 +3035,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'DeleteApiDeploymentRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -3040,11 +3048,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.deleteApiDeploymentRevision(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiDeploymentRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiDeploymentRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiDeploymentRevision without error using callback', async () => { @@ -3056,15 +3067,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'DeleteApiDeploymentRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() ); @@ -3087,11 +3095,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiDeploymentRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiDeploymentRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiDeploymentRevision with error', async () => { @@ -3103,15 +3114,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'DeleteApiDeploymentRevisionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall( undefined, @@ -3121,11 +3129,14 @@ describe('v1.RegistryClient', () => { client.deleteApiDeploymentRevision(request), expectedError ); - assert( - (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteApiDeploymentRevision as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApiDeploymentRevision as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteApiDeploymentRevision with closed client', async () => { @@ -3137,7 +3148,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + 'DeleteApiDeploymentRevisionRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -3157,26 +3172,23 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() ); client.innerApiCalls.getArtifact = stubSimpleCall(expectedResponse); const [response] = await client.getArtifact(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getArtifact without error using callback', async () => { @@ -3188,15 +3200,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() ); @@ -3219,11 +3225,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getArtifact with error', async () => { @@ -3235,26 +3244,23 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getArtifact = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getArtifact(request), expectedError); - assert( - (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getArtifact with closed client', async () => { @@ -3266,7 +3272,8 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetArtifactRequest', ['name']); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getArtifact(request), expectedError); @@ -3283,15 +3290,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetArtifactContentsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); @@ -3299,11 +3302,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getArtifactContents(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getArtifactContents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getArtifactContents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getArtifactContents without error using callback', async () => { @@ -3315,15 +3321,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetArtifactContentsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.api.HttpBody() ); @@ -3343,11 +3345,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getArtifactContents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getArtifactContents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getArtifactContents with error', async () => { @@ -3356,29 +3361,28 @@ describe('v1.RegistryClient', () => { projectId: 'bogus', }); client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = getTypeDefaultValue('GetArtifactContentsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getArtifactContents = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getArtifactContents(request), expectedError); - assert( - (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getArtifactContents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getArtifactContents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getArtifactContents with closed client', async () => { @@ -3390,7 +3394,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetArtifactContentsRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getArtifactContents(request), expectedError); @@ -3407,26 +3414,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateArtifactRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() ); client.innerApiCalls.createArtifact = stubSimpleCall(expectedResponse); const [response] = await client.createArtifact(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createArtifact without error using callback', async () => { @@ -3438,15 +3444,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateArtifactRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() ); @@ -3469,11 +3471,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.createArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createArtifact with error', async () => { @@ -3485,26 +3490,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('CreateArtifactRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.createArtifact = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createArtifact(request), expectedError); - assert( - (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.createArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes createArtifact with closed client', async () => { @@ -3516,7 +3520,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() ); - request.parent = ''; + const defaultValue1 = getTypeDefaultValue('CreateArtifactRequest', [ + 'parent', + ]); + request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.createArtifact(request), expectedError); @@ -3533,27 +3540,27 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() ); - request.artifact = {}; - request.artifact.name = ''; - const expectedHeaderRequestParams = 'artifact.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.artifact ??= {}; + const defaultValue1 = getTypeDefaultValue('ReplaceArtifactRequest', [ + 'artifact', + 'name', + ]); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() ); client.innerApiCalls.replaceArtifact = stubSimpleCall(expectedResponse); const [response] = await client.replaceArtifact(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.replaceArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceArtifact without error using callback', async () => { @@ -3565,16 +3572,13 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() ); - request.artifact = {}; - request.artifact.name = ''; - const expectedHeaderRequestParams = 'artifact.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.artifact ??= {}; + const defaultValue1 = getTypeDefaultValue('ReplaceArtifactRequest', [ + 'artifact', + 'name', + ]); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() ); @@ -3597,11 +3601,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.replaceArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceArtifact with error', async () => { @@ -3613,27 +3620,27 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() ); - request.artifact = {}; - request.artifact.name = ''; - const expectedHeaderRequestParams = 'artifact.name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + request.artifact ??= {}; + const defaultValue1 = getTypeDefaultValue('ReplaceArtifactRequest', [ + 'artifact', + 'name', + ]); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.replaceArtifact = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.replaceArtifact(request), expectedError); - assert( - (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.replaceArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.replaceArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes replaceArtifact with closed client', async () => { @@ -3645,8 +3652,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() ); - request.artifact = {}; - request.artifact.name = ''; + request.artifact ??= {}; + const defaultValue1 = getTypeDefaultValue('ReplaceArtifactRequest', [ + 'artifact', + 'name', + ]); + request.artifact.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.replaceArtifact(request), expectedError); @@ -3663,26 +3674,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteArtifactRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); client.innerApiCalls.deleteArtifact = stubSimpleCall(expectedResponse); const [response] = await client.deleteArtifact(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteArtifact without error using callback', async () => { @@ -3694,15 +3704,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteArtifactRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); @@ -3725,11 +3731,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.deleteArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteArtifact with error', async () => { @@ -3741,26 +3750,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('DeleteArtifactRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.deleteArtifact = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.deleteArtifact(request), expectedError); - assert( - (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.deleteArtifact as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteArtifact as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes deleteArtifact with closed client', async () => { @@ -3772,7 +3780,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('DeleteArtifactRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.deleteArtifact(request), expectedError); @@ -3789,15 +3800,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), @@ -3806,11 +3811,14 @@ describe('v1.RegistryClient', () => { client.innerApiCalls.listApis = stubSimpleCall(expectedResponse); const [response] = await client.listApis(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApis as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApis without error using callback', async () => { @@ -3822,15 +3830,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), @@ -3855,11 +3857,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApis as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listApis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApis with error', async () => { @@ -3871,23 +3876,20 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listApis = stubSimpleCall(undefined, expectedError); await assert.rejects(client.listApis(request), expectedError); - assert( - (client.innerApiCalls.listApis as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApisStream without error', async () => { @@ -3899,8 +3901,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), @@ -3931,10 +3934,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApis, request) ); - assert.strictEqual( - (client.descriptors.page.listApis.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3947,8 +3952,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApis.createStream = stubPageStreamingCall( undefined, @@ -3976,10 +3982,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApis, request) ); - assert.strictEqual( - (client.descriptors.page.listApis.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -3992,8 +4000,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), @@ -4012,10 +4021,12 @@ describe('v1.RegistryClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.listApis.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4028,8 +4039,9 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall( undefined, @@ -4047,10 +4059,12 @@ describe('v1.RegistryClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.listApis.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -4065,15 +4079,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() @@ -4088,11 +4098,14 @@ describe('v1.RegistryClient', () => { client.innerApiCalls.listApiVersions = stubSimpleCall(expectedResponse); const [response] = await client.listApiVersions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiVersions without error using callback', async () => { @@ -4104,15 +4117,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() @@ -4143,11 +4152,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listApiVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiVersions with error', async () => { @@ -4159,26 +4171,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listApiVersions = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listApiVersions(request), expectedError); - assert( - (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiVersionsStream without error', async () => { @@ -4190,8 +4201,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() @@ -4229,11 +4243,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiVersions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listApiVersions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4246,8 +4261,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -4274,11 +4292,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiVersions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listApiVersions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4291,8 +4310,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiVersion() @@ -4318,11 +4340,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listApiVersions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4335,8 +4358,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -4354,11 +4380,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listApiVersions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -4373,15 +4400,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() @@ -4396,11 +4419,14 @@ describe('v1.RegistryClient', () => { client.innerApiCalls.listApiSpecs = stubSimpleCall(expectedResponse); const [response] = await client.listApiSpecs(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiSpecs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiSpecs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiSpecs without error using callback', async () => { @@ -4412,15 +4438,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() @@ -4451,11 +4473,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listApiSpecs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiSpecs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiSpecs with error', async () => { @@ -4467,26 +4492,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listApiSpecs = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listApiSpecs(request), expectedError); - assert( - (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiSpecs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiSpecs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiSpecsStream without error', async () => { @@ -4498,8 +4522,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() @@ -4536,11 +4563,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiSpecs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listApiSpecs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4553,8 +4581,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall( undefined, @@ -4582,11 +4613,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiSpecs, request) ); - assert.strictEqual( - ( - client.descriptors.page.listApiSpecs.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4599,8 +4631,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() @@ -4626,12 +4661,13 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listApiSpecs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + assert( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); }); it('uses async iteration with listApiSpecs with error', async () => { @@ -4643,8 +4679,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -4661,11 +4700,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listApiSpecs.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -4680,15 +4720,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() @@ -4704,11 +4740,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listApiSpecRevisions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiSpecRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiSpecRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiSpecRevisions without error using callback', async () => { @@ -4720,15 +4759,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() @@ -4759,11 +4794,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listApiSpecRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiSpecRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiSpecRevisions with error', async () => { @@ -4775,26 +4813,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listApiSpecRevisions = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listApiSpecRevisions(request), expectedError); - assert( - (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiSpecRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiSpecRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiSpecRevisionsStream without error', async () => { @@ -4806,8 +4843,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() @@ -4844,11 +4884,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiSpecRevisions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listApiSpecRevisions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4861,8 +4902,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -4888,11 +4932,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiSpecRevisions, request) ); - assert.strictEqual( - ( - client.descriptors.page.listApiSpecRevisions.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4905,8 +4950,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiSpec() @@ -4932,11 +4980,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -4949,8 +4998,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -4967,11 +5019,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -4986,15 +5039,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() @@ -5010,11 +5059,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listApiDeployments(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiDeployments without error using callback', async () => { @@ -5026,15 +5078,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() @@ -5067,11 +5115,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listApiDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiDeployments with error', async () => { @@ -5083,26 +5134,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listApiDeployments = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listApiDeployments(request), expectedError); - assert( - (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiDeployments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiDeployments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiDeploymentsStream without error', async () => { @@ -5114,8 +5164,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() @@ -5153,11 +5206,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiDeployments, request) ); - assert.strictEqual( - ( - client.descriptors.page.listApiDeployments.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5170,8 +5224,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(undefined, expectedError); @@ -5198,11 +5255,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiDeployments, request) ); - assert.strictEqual( - ( - client.descriptors.page.listApiDeployments.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5215,8 +5273,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() @@ -5243,11 +5304,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listApiDeployments.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5260,8 +5322,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -5279,11 +5344,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listApiDeployments.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -5298,15 +5364,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ListApiDeploymentRevisionsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() @@ -5322,11 +5385,14 @@ describe('v1.RegistryClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listApiDeploymentRevisions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiDeploymentRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiDeploymentRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiDeploymentRevisions without error using callback', async () => { @@ -5338,15 +5404,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ListApiDeploymentRevisionsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() @@ -5379,11 +5442,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listApiDeploymentRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiDeploymentRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiDeploymentRevisions with error', async () => { @@ -5395,15 +5461,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ListApiDeploymentRevisionsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall( undefined, @@ -5413,11 +5476,14 @@ describe('v1.RegistryClient', () => { client.listApiDeploymentRevisions(request), expectedError ); - assert( - (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listApiDeploymentRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApiDeploymentRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listApiDeploymentRevisionsStream without error', async () => { @@ -5429,8 +5495,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue( + 'ListApiDeploymentRevisionsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() @@ -5471,12 +5541,15 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiDeploymentRevisions, request) ); - assert.strictEqual( + assert( ( client.descriptors.page.listApiDeploymentRevisions .createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5489,8 +5562,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue( + 'ListApiDeploymentRevisionsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(undefined, expectedError); @@ -5520,12 +5597,15 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listApiDeploymentRevisions, request) ); - assert.strictEqual( + assert( ( client.descriptors.page.listApiDeploymentRevisions .createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5538,8 +5618,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue( + 'ListApiDeploymentRevisionsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ApiDeployment() @@ -5567,12 +5651,15 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.descriptors.page.listApiDeploymentRevisions .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5585,8 +5672,12 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue( + 'ListApiDeploymentRevisionsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -5605,12 +5696,15 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.descriptors.page.listApiDeploymentRevisions .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -5625,15 +5719,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() @@ -5648,11 +5738,14 @@ describe('v1.RegistryClient', () => { client.innerApiCalls.listArtifacts = stubSimpleCall(expectedResponse); const [response] = await client.listArtifacts(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listArtifacts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listArtifacts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listArtifacts without error using callback', async () => { @@ -5664,15 +5757,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() @@ -5703,11 +5792,14 @@ describe('v1.RegistryClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listArtifacts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listArtifacts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listArtifacts with error', async () => { @@ -5719,26 +5811,25 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listArtifacts = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listArtifacts(request), expectedError); - assert( - (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listArtifacts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listArtifacts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listArtifactsStream without error', async () => { @@ -5750,8 +5841,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() @@ -5788,11 +5882,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listArtifacts, request) ); - assert.strictEqual( - ( - client.descriptors.page.listArtifacts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5805,8 +5900,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(undefined, expectedError); @@ -5832,11 +5930,12 @@ describe('v1.RegistryClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listArtifacts, request) ); - assert.strictEqual( - ( - client.descriptors.page.listArtifacts.createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5849,8 +5948,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.Artifact() @@ -5876,11 +5978,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listArtifacts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -5893,8 +5996,11 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ + 'parent', + ]); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -5911,11 +6017,12 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( - ( - client.descriptors.page.listArtifacts.asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); @@ -6390,12 +6497,15 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); it('uses async iteration with listLocations with error', async () => { @@ -6426,12 +6536,15 @@ describe('v1.RegistryClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.locationsClient.descriptors.page.listLocations .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); From 49329004a2cf077a9411ff64f7923ac24b8fa90d Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 21 Sep 2022 03:15:28 +0000 Subject: [PATCH 3/6] test: use fully qualified request type name in tests PiperOrigin-RevId: 475685359 Source-Link: https://github.com/googleapis/googleapis/commit/7a129736313ceb1f277c3b7f7e16d2e04cc901dd Source-Link: https://github.com/googleapis/googleapis-gen/commit/370c729e2ba062a167449c27882ba5f379c5c34d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 65 + .../v1/provisioning_service.proto | 205 + .../apigeeregistry/v1/registry_models.proto | 364 + .../apigeeregistry/v1/registry_service.proto | 1133 ++++ .../v1/provisioning.create_instance.js | 73 + .../v1/provisioning.delete_instance.js | 63 + .../generated/v1/provisioning.get_instance.js | 62 + .../generated/v1/registry.create_api.js | 76 + .../v1/registry.create_api_deployment.js | 76 + .../generated/v1/registry.create_api_spec.js | 76 + .../v1/registry.create_api_version.js | 76 + .../generated/v1/registry.create_artifact.js | 76 + .../generated/v1/registry.delete_api.js | 67 + .../v1/registry.delete_api_deployment.js | 67 + ...registry.delete_api_deployment_revision.js | 64 + .../generated/v1/registry.delete_api_spec.js | 67 + .../v1/registry.delete_api_spec_revision.js | 64 + .../v1/registry.delete_api_version.js | 67 + .../generated/v1/registry.delete_artifact.js | 62 + .../samples/generated/v1/registry.get_api.js | 62 + .../v1/registry.get_api_deployment.js | 62 + .../generated/v1/registry.get_api_spec.js | 62 + .../v1/registry.get_api_spec_contents.js | 62 + .../generated/v1/registry.get_api_version.js | 62 + .../generated/v1/registry.get_artifact.js | 62 + .../v1/registry.get_artifact_contents.js | 62 + .../registry.list_api_deployment_revisions.js | 72 + .../v1/registry.list_api_deployments.js | 83 + .../v1/registry.list_api_spec_revisions.js | 72 + .../generated/v1/registry.list_api_specs.js | 83 + .../v1/registry.list_api_versions.js | 83 + .../generated/v1/registry.list_apis.js | 83 + .../generated/v1/registry.list_artifacts.js | 83 + .../generated/v1/registry.replace_artifact.js | 63 + .../v1/registry.rollback_api_deployment.js | 68 + .../v1/registry.rollback_api_spec.js | 68 + .../registry.tag_api_deployment_revision.js | 67 + .../v1/registry.tag_api_spec_revision.js | 67 + .../generated/v1/registry.update_api.js | 75 + .../v1/registry.update_api_deployment.js | 75 + .../generated/v1/registry.update_api_spec.js | 75 + .../v1/registry.update_api_version.js | 75 + ...tadata.google.cloud.apigeeregistry.v1.json | 1723 +++++ owl-bot-staging/v1/src/index.ts | 27 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 445 ++ owl-bot-staging/v1/src/v1/index.ts | 20 + .../v1/src/v1/provisioning_client.ts | 1737 +++++ .../v1/src/v1/provisioning_client_config.json | 38 + .../v1/src/v1/provisioning_proto_list.json | 5 + owl-bot-staging/v1/src/v1/registry_client.ts | 4842 +++++++++++++ .../v1/src/v1/registry_client_config.json | 216 + .../v1/src/v1/registry_proto_list.json | 5 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 38 + owl-bot-staging/v1/system-test/install.ts | 49 + .../v1/test/gapic_provisioning_v1.ts | 1896 ++++++ owl-bot-staging/v1/test/gapic_registry_v1.ts | 6025 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 67 files changed, 21757 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/src/v1/provisioning_client.ts create mode 100644 owl-bot-staging/v1/src/v1/provisioning_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/provisioning_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/registry_client.ts create mode 100644 owl-bot-staging/v1/src/v1/registry_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/registry_proto_list.json create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_provisioning_v1.ts create mode 100644 owl-bot-staging/v1/test/gapic_registry_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..2efe6c2 --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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 +// +// 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/apigee-registry', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// 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 +// +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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 +// +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..1c7b46e --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Apigeeregistry: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..bfde712 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,65 @@ +{ + "name": "@google-cloud/apigee-registry", + "version": "0.1.0", + "description": "Apigeeregistry client for Node.js", + "repository": "googleapis/nodejs-apigeeregistry", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google apigeeregistry", + "apigeeregistry", + "provisioning", + "registry" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.59", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto new file mode 100644 index 0000000..9e7baee --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto @@ -0,0 +1,205 @@ +// 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.apigeeregistry.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; +option java_multiple_files = true; +option java_outer_classname = "ProvisioningServiceProto"; +option java_package = "com.google.cloud.apigeeregistry.v1"; +option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; +option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; + +// The service that is used for managing the data plane provisioning of the +// Registry. +service Provisioning { + option (google.api.default_host) = "apigeeregistry.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Provisions instance resources for the Registry. + rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/instances" + body: "instance" + }; + option (google.api.method_signature) = "parent,instance,instance_id"; + option (google.longrunning.operation_info) = { + response_type: "Instance" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the Registry instance. + rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Gets details of a single Instance. + rpc GetInstance(GetInstanceRequest) returns (Instance) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/instances/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for CreateInstance. +message CreateInstanceRequest { + // Required. Parent resource of the Instance, of the form: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Identifier to assign to the Instance. Must be unique within scope of the + // parent resource. + string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Instance. + Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteInstance. +message DeleteInstanceRequest { + // Required. The name of the Instance to delete. + // Format: `projects/*/locations/*/instances/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Instance" + } + ]; +} + +// Request message for GetInstance. +message GetInstanceRequest { + // Required. The name of the Instance to retrieve. + // Format: `projects/*/locations/*/instances/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Instance" + } + ]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // The time the operation was created. + google.protobuf.Timestamp create_time = 1; + + // The time the operation finished running. + google.protobuf.Timestamp end_time = 2; + + // Server-defined resource path for the target of the operation. + string target = 3; + + // Name of the verb executed by the operation. + string verb = 4; + + // Human-readable status of the operation, if any. + string status_message = 5; + + // Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool cancellation_requested = 6; + + // API version used to start the operation. + string api_version = 7; +} + +// An Instance represents the instance resources of the Registry. +// Currently, only one instance is allowed for each project. +message Instance { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/Instance" + pattern: "projects/{project}/locations/{location}/instances/{instance}" + }; + + // State of the Instance. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // The Instance has not been initialized or has been deleted. + INACTIVE = 1; + + // The Instance is being created. + CREATING = 2; + + // The Instance has been created and is ready for use. + ACTIVE = 3; + + // The Instance is being updated. + UPDATING = 4; + + // The Instance is being deleted. + DELETING = 5; + + // The Instance encountered an error during a state change. + FAILED = 6; + } + + // Available configurations to provision an Instance. + message Config { + // Output only. The GCP location where the Instance resides. + string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The Customer Managed Encryption Key (CMEK) used for data encryption. + // The CMEK name should follow the format of + // `projects/([^/]+)/locations/([^/]+)/keyRings/([^/]+)/cryptoKeys/([^/]+)`, + // where the `location` must match InstanceConfig.location. + string cmek_key_name = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Format: `projects/*/locations/*/instance`. + // Currently only `locations/global` is supported. + string name = 1; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the Instance. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Extra information of Instance.State if the state is `FAILED`. + string state_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Config of the Instance. + Config config = 6 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto new file mode 100644 index 0000000..8411f9e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto @@ -0,0 +1,364 @@ +// 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.apigeeregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; +option java_multiple_files = true; +option java_outer_classname = "RegistryModelsProto"; +option java_package = "com.google.cloud.apigeeregistry.v1"; +option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; +option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; + +// A top-level description of an API. +// Produced by producers and are commitments to provide services. +message Api { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/Api" + pattern: "projects/{project}/locations/{location}/apis/{api}" + }; + + // Resource name. + string name = 1; + + // Human-meaningful name. + string display_name = 2; + + // A detailed description. + string description = 3; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-definable description of the availability of this service. + // Format: free-form, but we expect single words that describe availability, + // e.g., "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN". + string availability = 6; + + // The recommended version of the API. + // Format: `apis/{api}/versions/{version}` + string recommended_version = 7 [(google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiVersion" + }]; + + // The recommended deployment of the API. + // Format: `apis/{api}/deployments/{deployment}` + string recommended_deployment = 8 [(google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + }]; + + // Labels attach identifying metadata to resources. Identifying metadata can + // be used to filter list operations. + // + // Label keys and values can be no longer than 64 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores, and dashes. International characters are allowed. + // No more than 64 user labels can be associated with one resource (System + // labels are excluded). + // + // See https://goo.gl/xmQnxf for more information and examples of labels. + // System reserved label keys are prefixed with + // `apigeeregistry.googleapis.com/` and cannot be changed. + map labels = 9; + + // Annotations attach non-identifying metadata to resources. + // + // Annotation keys and values are less restricted than those of labels, but + // should be generally used for small values of broad interest. Larger, topic- + // specific metadata should be stored in Artifacts. + map annotations = 10; +} + +// Describes a particular version of an API. +// ApiVersions are what consumers actually use. +message ApiVersion { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/ApiVersion" + pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}" + }; + + // Resource name. + string name = 1; + + // Human-meaningful name. + string display_name = 2; + + // A detailed description. + string description = 3; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A user-definable description of the lifecycle phase of this API version. + // Format: free-form, but we expect single words that describe API maturity, + // e.g., "CONCEPT", "DESIGN", "DEVELOPMENT", "STAGING", "PRODUCTION", + // "DEPRECATED", "RETIRED". + string state = 6; + + // Labels attach identifying metadata to resources. Identifying metadata can + // be used to filter list operations. + // + // Label keys and values can be no longer than 64 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // No more than 64 user labels can be associated with one resource (System + // labels are excluded). + // + // See https://goo.gl/xmQnxf for more information and examples of labels. + // System reserved label keys are prefixed with + // `apigeeregistry.googleapis.com/` and cannot be changed. + map labels = 7; + + // Annotations attach non-identifying metadata to resources. + // + // Annotation keys and values are less restricted than those of labels, but + // should be generally used for small values of broad interest. Larger, topic- + // specific metadata should be stored in Artifacts. + map annotations = 8; +} + +// Describes a version of an API in a structured way. +// ApiSpecs provide formal descriptions that consumers can use to use a version. +// ApiSpec resources are intended to be fully-resolved descriptions of an +// ApiVersion. When specs consist of multiple files, these should be bundled +// together (e.g., in a zip archive) and stored as a unit. Multiple specs can +// exist to provide representations in different API description formats. +// Synchronization of these representations would be provided by tooling and +// background services. +message ApiSpec { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}" + }; + + // Resource name. + string name = 1; + + // A possibly-hierarchical name used to refer to the spec from other specs. + string filename = 2; + + // A detailed description. + string description = 3; + + // Output only. Immutable. The revision ID of the spec. + // A new revision is committed whenever the spec contents are changed. + // The format is an 8-character hexadecimal string. + string revision_id = 4 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. Creation timestamp; when the spec resource was created. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision creation timestamp; when the represented revision was created. + google.protobuf.Timestamp revision_create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp: when the represented revision was last modified. + google.protobuf.Timestamp revision_update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A style (format) descriptor for this spec that is specified as a Media Type + // (https://en.wikipedia.org/wiki/Media_type). Possible values include + // `application/vnd.apigee.proto`, `application/vnd.apigee.openapi`, and + // `application/vnd.apigee.graphql`, with possible suffixes representing + // compression types. These hypothetical names are defined in the vendor tree + // defined in RFC6838 (https://tools.ietf.org/html/rfc6838) and are not final. + // Content types can specify compression. Currently only GZip compression is + // supported (indicated with "+gzip"). + string mime_type = 8; + + // Output only. The size of the spec file in bytes. If the spec is gzipped, this is the + // size of the uncompressed spec. + int32 size_bytes = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A SHA-256 hash of the spec's contents. If the spec is gzipped, this is + // the hash of the uncompressed spec. + string hash = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The original source URI of the spec (if one exists). + // This is an external location that can be used for reference purposes + // but which may not be authoritative since this external resource may + // change after the spec is retrieved. + string source_uri = 11; + + // Input only. The contents of the spec. + // Provided by API callers when specs are created or updated. + // To access the contents of a spec, use GetApiSpecContents. + bytes contents = 12 [(google.api.field_behavior) = INPUT_ONLY]; + + // Labels attach identifying metadata to resources. Identifying metadata can + // be used to filter list operations. + // + // Label keys and values can be no longer than 64 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // No more than 64 user labels can be associated with one resource (System + // labels are excluded). + // + // See https://goo.gl/xmQnxf for more information and examples of labels. + // System reserved label keys are prefixed with + // `apigeeregistry.googleapis.com/` and cannot be changed. + map labels = 14; + + // Annotations attach non-identifying metadata to resources. + // + // Annotation keys and values are less restricted than those of labels, but + // should be generally used for small values of broad interest. Larger, topic- + // specific metadata should be stored in Artifacts. + map annotations = 15; +} + +// Describes a service running at particular address that +// provides a particular version of an API. ApiDeployments have revisions which +// correspond to different configurations of a single deployment in time. +// Revision identifiers should be updated whenever the served API spec or +// endpoint address changes. +message ApiDeployment { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + pattern: "projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}" + }; + + // Resource name. + string name = 1; + + // Human-meaningful name. + string display_name = 2; + + // A detailed description. + string description = 3; + + // Output only. Immutable. The revision ID of the deployment. + // A new revision is committed whenever the deployment contents are changed. + // The format is an 8-character hexadecimal string. + string revision_id = 4 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. Creation timestamp; when the deployment resource was created. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Revision creation timestamp; when the represented revision was created. + google.protobuf.Timestamp revision_create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp: when the represented revision was last modified. + google.protobuf.Timestamp revision_update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The full resource name (including revision ID) of the spec of the API being + // served by the deployment. Changes to this value will update the revision. + // Format: `apis/{api}/deployments/{deployment}` + string api_spec_revision = 8 [(google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + }]; + + // The address where the deployment is serving. Changes to this value will + // update the revision. + string endpoint_uri = 9; + + // The address of the external channel of the API (e.g., the Developer + // Portal). Changes to this value will not affect the revision. + string external_channel_uri = 10; + + // Text briefly identifying the intended audience of the API. Changes to this + // value will not affect the revision. + string intended_audience = 11; + + // Text briefly describing how to access the endpoint. Changes to this value + // will not affect the revision. + string access_guidance = 12; + + // Labels attach identifying metadata to resources. Identifying metadata can + // be used to filter list operations. + // + // Label keys and values can be no longer than 64 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // No more than 64 user labels can be associated with one resource (System + // labels are excluded). + // + // See https://goo.gl/xmQnxf for more information and examples of labels. + // System reserved label keys are prefixed with + // `apigeeregistry.googleapis.com/` and cannot be changed. + map labels = 14; + + // Annotations attach non-identifying metadata to resources. + // + // Annotation keys and values are less restricted than those of labels, but + // should be generally used for small values of broad interest. Larger, topic- + // specific metadata should be stored in Artifacts. + map annotations = 15; +} + +// Artifacts of resources. Artifacts are unique (single-value) per resource +// and are used to store metadata that is too large or numerous to be stored +// directly on the resource. Since artifacts are stored separately from parent +// resources, they should generally be used for metadata that is needed +// infrequently, i.e., not for display in primary views of the resource but +// perhaps displayed or downloaded upon request. The `ListArtifacts` method +// allows artifacts to be quickly enumerated and checked for presence without +// downloading their (potentially-large) contents. +message Artifact { + option (google.api.resource) = { + type: "apigeeregistry.googleapis.com/Artifact" + pattern: "projects/{project}/locations/{location}/artifacts/{artifact}" + pattern: "projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}" + pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}" + pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}" + pattern: "projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}" + }; + + // Resource name. + string name = 1; + + // Output only. Creation timestamp. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Last update timestamp. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A content type specifier for the artifact. + // Content type specifiers are Media Types + // (https://en.wikipedia.org/wiki/Media_type) with a possible "schema" + // parameter that specifies a schema for the stored information. + // Content types can specify compression. Currently only GZip compression is + // supported (indicated with "+gzip"). + string mime_type = 4; + + // Output only. The size of the artifact in bytes. If the artifact is gzipped, this is + // the size of the uncompressed artifact. + int32 size_bytes = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A SHA-256 hash of the artifact's contents. If the artifact is gzipped, + // this is the hash of the uncompressed artifact. + string hash = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. The contents of the artifact. + // Provided by API callers when artifacts are created or replaced. + // To access the contents of an artifact, use GetArtifactContents. + bytes contents = 7 [(google.api.field_behavior) = INPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto new file mode 100644 index 0000000..1eec64e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto @@ -0,0 +1,1133 @@ +// 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.apigeeregistry.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/httpbody.proto"; +import "google/api/resource.proto"; +import "google/cloud/apigeeregistry/v1/registry_models.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; +option java_multiple_files = true; +option java_outer_classname = "RegistryServiceProto"; +option java_package = "com.google.cloud.apigeeregistry.v1"; +option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; +option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; + +// The Registry service allows teams to manage descriptions of APIs. +service Registry { + option (google.api.default_host) = "apigeeregistry.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Returns matching APIs. + rpc ListApis(ListApisRequest) returns (ListApisResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/apis" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified API. + rpc GetApi(GetApiRequest) returns (Api) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified API. + rpc CreateApi(CreateApiRequest) returns (Api) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/apis" + body: "api" + }; + option (google.api.method_signature) = "parent,api,api_id"; + } + + // Used to modify a specified API. + rpc UpdateApi(UpdateApiRequest) returns (Api) { + option (google.api.http) = { + patch: "/v1/{api.name=projects/*/locations/*/apis/*}" + body: "api" + }; + option (google.api.method_signature) = "api,update_mask"; + } + + // Removes a specified API and all of the resources that it + // owns. + rpc DeleteApi(DeleteApiRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns matching versions. + rpc ListApiVersions(ListApiVersionsRequest) returns (ListApiVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/apis/*}/versions" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified version. + rpc GetApiVersion(GetApiVersionRequest) returns (ApiVersion) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified version. + rpc CreateApiVersion(CreateApiVersionRequest) returns (ApiVersion) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/apis/*}/versions" + body: "api_version" + }; + option (google.api.method_signature) = "parent,api_version,api_version_id"; + } + + // Used to modify a specified version. + rpc UpdateApiVersion(UpdateApiVersionRequest) returns (ApiVersion) { + option (google.api.http) = { + patch: "/v1/{api_version.name=projects/*/locations/*/apis/*/versions/*}" + body: "api_version" + }; + option (google.api.method_signature) = "api_version,update_mask"; + } + + // Removes a specified version and all of the resources that + // it owns. + rpc DeleteApiVersion(DeleteApiVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns matching specs. + rpc ListApiSpecs(ListApiSpecsRequest) returns (ListApiSpecsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified spec. + rpc GetApiSpec(GetApiSpecRequest) returns (ApiSpec) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns the contents of a specified spec. + // If specs are stored with GZip compression, the default behavior + // is to return the spec uncompressed (the mime_type response field + // indicates the exact format returned). + rpc GetApiSpecContents(GetApiSpecContentsRequest) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:getContents" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified spec. + rpc CreateApiSpec(CreateApiSpecRequest) returns (ApiSpec) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs" + body: "api_spec" + }; + option (google.api.method_signature) = "parent,api_spec,api_spec_id"; + } + + // Used to modify a specified spec. + rpc UpdateApiSpec(UpdateApiSpecRequest) returns (ApiSpec) { + option (google.api.http) = { + patch: "/v1/{api_spec.name=projects/*/locations/*/apis/*/versions/*/specs/*}" + body: "api_spec" + }; + option (google.api.method_signature) = "api_spec,update_mask"; + } + + // Removes a specified spec, all revisions, and all child + // resources (e.g., artifacts). + rpc DeleteApiSpec(DeleteApiSpecRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds a tag to a specified revision of a spec. + rpc TagApiSpecRevision(TagApiSpecRevisionRequest) returns (ApiSpec) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:tagRevision" + body: "*" + }; + } + + // Lists all revisions of a spec. + // Revisions are returned in descending order of revision creation time. + rpc ListApiSpecRevisions(ListApiSpecRevisionsRequest) returns (ListApiSpecRevisionsResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:listRevisions" + }; + } + + // Sets the current revision to a specified prior revision. + // Note that this creates a new revision with a new revision ID. + rpc RollbackApiSpec(RollbackApiSpecRequest) returns (ApiSpec) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:rollback" + body: "*" + }; + } + + // Deletes a revision of a spec. + rpc DeleteApiSpecRevision(DeleteApiSpecRevisionRequest) returns (ApiSpec) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:deleteRevision" + }; + option (google.api.method_signature) = "name"; + } + + // Returns matching deployments. + rpc ListApiDeployments(ListApiDeploymentsRequest) returns (ListApiDeploymentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/apis/*}/deployments" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified deployment. + rpc GetApiDeployment(GetApiDeploymentRequest) returns (ApiDeployment) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified deployment. + rpc CreateApiDeployment(CreateApiDeploymentRequest) returns (ApiDeployment) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/apis/*}/deployments" + body: "api_deployment" + }; + option (google.api.method_signature) = "parent,api_deployment,api_deployment_id"; + } + + // Used to modify a specified deployment. + rpc UpdateApiDeployment(UpdateApiDeploymentRequest) returns (ApiDeployment) { + option (google.api.http) = { + patch: "/v1/{api_deployment.name=projects/*/locations/*/apis/*/deployments/*}" + body: "api_deployment" + }; + option (google.api.method_signature) = "api_deployment,update_mask"; + } + + // Removes a specified deployment, all revisions, and all + // child resources (e.g., artifacts). + rpc DeleteApiDeployment(DeleteApiDeploymentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Adds a tag to a specified revision of a + // deployment. + rpc TagApiDeploymentRevision(TagApiDeploymentRevisionRequest) returns (ApiDeployment) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:tagRevision" + body: "*" + }; + } + + // Lists all revisions of a deployment. + // Revisions are returned in descending order of revision creation time. + rpc ListApiDeploymentRevisions(ListApiDeploymentRevisionsRequest) returns (ListApiDeploymentRevisionsResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:listRevisions" + }; + } + + // Sets the current revision to a specified prior + // revision. Note that this creates a new revision with a new revision ID. + rpc RollbackApiDeployment(RollbackApiDeploymentRequest) returns (ApiDeployment) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:rollback" + body: "*" + }; + } + + // Deletes a revision of a deployment. + rpc DeleteApiDeploymentRevision(DeleteApiDeploymentRevisionRequest) returns (ApiDeployment) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:deleteRevision" + }; + option (google.api.method_signature) = "name"; + } + + // Returns matching artifacts. + rpc ListArtifacts(ListArtifactsRequest) returns (ListArtifactsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/artifacts" + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/apis/*}/artifacts" + } + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/artifacts" + } + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*/specs/*}/artifacts" + } + additional_bindings { + get: "/v1/{parent=projects/*/locations/*/apis/*/deployments/*}/artifacts" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Returns a specified artifact. + rpc GetArtifact(GetArtifactRequest) returns (Artifact) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/artifacts/*}" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Returns the contents of a specified artifact. + // If artifacts are stored with GZip compression, the default behavior + // is to return the artifact uncompressed (the mime_type response field + // indicates the exact format returned). + rpc GetArtifactContents(GetArtifactContentsRequest) returns (google.api.HttpBody) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/artifacts/*}:getContents" + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}:getContents" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getContents" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getContents" + } + additional_bindings { + get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}:getContents" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a specified artifact. + rpc CreateArtifact(CreateArtifactRequest) returns (Artifact) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/artifacts" + body: "artifact" + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/apis/*}/artifacts" + body: "artifact" + } + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/artifacts" + body: "artifact" + } + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*/specs/*}/artifacts" + body: "artifact" + } + additional_bindings { + post: "/v1/{parent=projects/*/locations/*/apis/*/deployments/*}/artifacts" + body: "artifact" + } + }; + option (google.api.method_signature) = "parent,artifact,artifact_id"; + } + + // Used to replace a specified artifact. + rpc ReplaceArtifact(ReplaceArtifactRequest) returns (Artifact) { + option (google.api.http) = { + put: "/v1/{artifact.name=projects/*/locations/*/artifacts/*}" + body: "artifact" + additional_bindings { + put: "/v1/{artifact.name=projects/*/locations/*/apis/*/artifacts/*}" + body: "artifact" + } + additional_bindings { + put: "/v1/{artifact.name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" + body: "artifact" + } + additional_bindings { + put: "/v1/{artifact.name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" + body: "artifact" + } + additional_bindings { + put: "/v1/{artifact.name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" + body: "artifact" + } + }; + option (google.api.method_signature) = "artifact"; + } + + // Removes a specified artifact. + rpc DeleteArtifact(DeleteArtifactRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/artifacts/*}" + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}" + } + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" + } + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" + } + additional_bindings { + delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for ListApis. +message ListApisRequest { + // Required. The parent, which owns this collection of APIs. + // Format: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/Api" + } + ]; + + // The maximum number of APIs to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListApis` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListApis` must match + // the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields. + string filter = 4; +} + +// Response message for ListApis. +message ListApisResponse { + // The APIs from the specified publisher. + repeated Api apis = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetApi. +message GetApiRequest { + // Required. The name of the API to retrieve. + // Format: `projects/*/locations/*/apis/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Api" + } + ]; +} + +// Request message for CreateApi. +message CreateApiRequest { + // Required. The parent, which owns this collection of APIs. + // Format: `projects/*/locations/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/Api" + } + ]; + + // Required. The API to create. + Api api = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the API, which will become the final component of + // the API's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string api_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateApi. +message UpdateApiRequest { + // Required. The API to update. + // + // The `name` field is used to identify the API to update. + // Format: `projects/*/locations/*/apis/*` + Api api = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If omitted, all fields are updated that + // are set in the request message (fields set to default values are ignored). + // If an asterisk "*" is specified, all fields are updated, including fields + // that are unspecified/default in the request. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the API is not found, a new API will be created. + // In this situation, `update_mask` is ignored. + bool allow_missing = 3; +} + +// Request message for DeleteApi. +message DeleteApiRequest { + // Required. The name of the API to delete. + // Format: `projects/*/locations/*/apis/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Api" + } + ]; + + // If set to true, any child resources will also be deleted. + // (Otherwise, the request will only work if there are no child resources.) + bool force = 2; +} + +// Request message for ListApiVersions. +message ListApiVersionsRequest { + // Required. The parent, which owns this collection of versions. + // Format: `projects/*/locations/*/apis/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiVersion" + } + ]; + + // The maximum number of versions to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListApiVersions` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListApiVersions` must + // match the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields. + string filter = 4; +} + +// Response message for ListApiVersions. +message ListApiVersionsResponse { + // The versions from the specified publisher. + repeated ApiVersion api_versions = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetApiVersion. +message GetApiVersionRequest { + // Required. The name of the version to retrieve. + // Format: `projects/*/locations/*/apis/*/versions/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiVersion" + } + ]; +} + +// Request message for CreateApiVersion. +message CreateApiVersionRequest { + // Required. The parent, which owns this collection of versions. + // Format: `projects/*/locations/*/apis/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiVersion" + } + ]; + + // Required. The version to create. + ApiVersion api_version = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the version, which will become the final component of + // the version's resource name. + // + // This value should be 1-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string api_version_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateApiVersion. +message UpdateApiVersionRequest { + // Required. The version to update. + // + // The `name` field is used to identify the version to update. + // Format: `projects/*/locations/*/apis/*/versions/*` + ApiVersion api_version = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If omitted, all fields are updated that + // are set in the request message (fields set to default values are ignored). + // If an asterisk "*" is specified, all fields are updated, including fields + // that are unspecified/default in the request. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the version is not found, a new version will be + // created. In this situation, `update_mask` is ignored. + bool allow_missing = 3; +} + +// Request message for DeleteApiVersion. +message DeleteApiVersionRequest { + // Required. The name of the version to delete. + // Format: `projects/*/locations/*/apis/*/versions/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiVersion" + } + ]; + + // If set to true, any child resources will also be deleted. + // (Otherwise, the request will only work if there are no child resources.) + bool force = 2; +} + +// Request message for ListApiSpecs. +message ListApiSpecsRequest { + // Required. The parent, which owns this collection of specs. + // Format: `projects/*/locations/*/apis/*/versions/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // The maximum number of specs to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListApiSpecs` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListApiSpecs` must match + // the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields except contents. + string filter = 4; +} + +// Response message for ListApiSpecs. +message ListApiSpecsResponse { + // The specs from the specified publisher. + repeated ApiSpec api_specs = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetApiSpec. +message GetApiSpecRequest { + // Required. The name of the spec to retrieve. + // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; +} + +// Request message for GetApiSpecContents. +message GetApiSpecContentsRequest { + // Required. The name of the spec whose contents should be retrieved. + // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; +} + +// Request message for CreateApiSpec. +message CreateApiSpecRequest { + // Required. The parent, which owns this collection of specs. + // Format: `projects/*/locations/*/apis/*/versions/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // Required. The spec to create. + ApiSpec api_spec = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the spec, which will become the final component of + // the spec's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string api_spec_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateApiSpec. +message UpdateApiSpecRequest { + // Required. The spec to update. + // + // The `name` field is used to identify the spec to update. + // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` + ApiSpec api_spec = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If omitted, all fields are updated that + // are set in the request message (fields set to default values are ignored). + // If an asterisk "*" is specified, all fields are updated, including fields + // that are unspecified/default in the request. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the spec is not found, a new spec will be created. + // In this situation, `update_mask` is ignored. + bool allow_missing = 3; +} + +// Request message for DeleteApiSpec. +message DeleteApiSpecRequest { + // Required. The name of the spec to delete. + // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // If set to true, any child resources will also be deleted. + // (Otherwise, the request will only work if there are no child resources.) + bool force = 2; +} + +// Request message for TagApiSpecRevision. +message TagApiSpecRevisionRequest { + // Required. The name of the spec to be tagged, including the revision ID. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // Required. The tag to apply. + // The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. + string tag = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ListApiSpecRevisions. +message ListApiSpecRevisionsRequest { + // Required. The name of the spec to list revisions for. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // The maximum number of revisions to return per page. + int32 page_size = 2; + + // The page token, received from a previous ListApiSpecRevisions call. + // Provide this to retrieve the subsequent page. + string page_token = 3; +} + +// Response message for ListApiSpecRevisionsResponse. +message ListApiSpecRevisionsResponse { + // The revisions of the spec. + repeated ApiSpec api_specs = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for RollbackApiSpec. +message RollbackApiSpecRequest { + // Required. The spec being rolled back. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; + + // Required. The revision ID to roll back to. + // It must be a revision of the same spec. + // + // Example: `c7cfa2a8` + string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteApiSpecRevision. +message DeleteApiSpecRevisionRequest { + // Required. The name of the spec revision to be deleted, + // with a revision ID explicitly included. + // + // Example: + // `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiSpec" + } + ]; +} + +// Request message for ListApiDeployments. +message ListApiDeploymentsRequest { + // Required. The parent, which owns this collection of deployments. + // Format: `projects/*/locations/*/apis/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // The maximum number of deployments to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListApiDeployments` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListApiDeployments` must + // match the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields. + string filter = 4; +} + +// Response message for ListApiDeployments. +message ListApiDeploymentsResponse { + // The deployments from the specified publisher. + repeated ApiDeployment api_deployments = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetApiDeployment. +message GetApiDeploymentRequest { + // Required. The name of the deployment to retrieve. + // Format: `projects/*/locations/*/apis/*/deployments/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; +} + +// Request message for CreateApiDeployment. +message CreateApiDeploymentRequest { + // Required. The parent, which owns this collection of deployments. + // Format: `projects/*/locations/*/apis/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // Required. The deployment to create. + ApiDeployment api_deployment = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the deployment, which will become the final component of + // the deployment's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string api_deployment_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for UpdateApiDeployment. +message UpdateApiDeploymentRequest { + // Required. The deployment to update. + // + // The `name` field is used to identify the deployment to update. + // Format: `projects/*/locations/*/apis/*/deployments/*` + ApiDeployment api_deployment = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. If omitted, all fields are updated that + // are set in the request message (fields set to default values are ignored). + // If an asterisk "*" is specified, all fields are updated, including fields + // that are unspecified/default in the request. + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the deployment is not found, a new deployment will be + // created. In this situation, `update_mask` is ignored. + bool allow_missing = 3; +} + +// Request message for DeleteApiDeployment. +message DeleteApiDeploymentRequest { + // Required. The name of the deployment to delete. + // Format: `projects/*/locations/*/apis/*/deployments/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // If set to true, any child resources will also be deleted. + // (Otherwise, the request will only work if there are no child resources.) + bool force = 2; +} + +// Request message for TagApiDeploymentRevision. +message TagApiDeploymentRevisionRequest { + // Required. The name of the deployment to be tagged, including the revision ID. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // Required. The tag to apply. + // The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. + string tag = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ListApiDeploymentRevisions. +message ListApiDeploymentRevisionsRequest { + // Required. The name of the deployment to list revisions for. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // The maximum number of revisions to return per page. + int32 page_size = 2; + + // The page token, received from a previous ListApiDeploymentRevisions call. + // Provide this to retrieve the subsequent page. + string page_token = 3; +} + +// Response message for ListApiDeploymentRevisionsResponse. +message ListApiDeploymentRevisionsResponse { + // The revisions of the deployment. + repeated ApiDeployment api_deployments = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for RollbackApiDeployment. +message RollbackApiDeploymentRequest { + // Required. The deployment being rolled back. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; + + // Required. The revision ID to roll back to. + // It must be a revision of the same deployment. + // + // Example: `c7cfa2a8` + string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteApiDeploymentRevision. +message DeleteApiDeploymentRevisionRequest { + // Required. The name of the deployment revision to be deleted, + // with a revision ID explicitly included. + // + // Example: + // `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/ApiDeployment" + } + ]; +} + +// Request message for ListArtifacts. +message ListArtifactsRequest { + // Required. The parent, which owns this collection of artifacts. + // Format: `{parent}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/Artifact" + } + ]; + + // The maximum number of artifacts to return. + // The service may return fewer than this value. + // If unspecified, at most 50 values will be returned. + // The maximum is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListArtifacts` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListArtifacts` must + // match the call that provided the page token. + string page_token = 3; + + // An expression that can be used to filter the list. Filters use the Common + // Expression Language and can refer to all message fields except contents. + string filter = 4; +} + +// Response message for ListArtifacts. +message ListArtifactsResponse { + // The artifacts from the specified publisher. + repeated Artifact artifacts = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for GetArtifact. +message GetArtifactRequest { + // Required. The name of the artifact to retrieve. + // Format: `{parent}/artifacts/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Artifact" + } + ]; +} + +// Request message for GetArtifactContents. +message GetArtifactContentsRequest { + // Required. The name of the artifact whose contents should be retrieved. + // Format: `{parent}/artifacts/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Artifact" + } + ]; +} + +// Request message for CreateArtifact. +message CreateArtifactRequest { + // Required. The parent, which owns this collection of artifacts. + // Format: `{parent}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apigeeregistry.googleapis.com/Artifact" + } + ]; + + // Required. The artifact to create. + Artifact artifact = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the artifact, which will become the final component of + // the artifact's resource name. + // + // This value should be 4-63 characters, and valid characters + // are /[a-z][0-9]-/. + // + // Following AIP-162, IDs must not have the form of a UUID. + string artifact_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for ReplaceArtifact. +message ReplaceArtifactRequest { + // Required. The artifact to replace. + // + // The `name` field is used to identify the artifact to replace. + // Format: `{parent}/artifacts/*` + Artifact artifact = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for DeleteArtifact. +message DeleteArtifactRequest { + // Required. The name of the artifact to delete. + // Format: `{parent}/artifacts/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "apigeeregistry.googleapis.com/Artifact" + } + ]; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js new file mode 100644 index 0000000..4f84cd1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js @@ -0,0 +1,73 @@ +// 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 +// +// 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'; + +function main(parent, instanceId, instance) { + // [START apigeeregistry_v1_generated_Provisioning_CreateInstance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent resource of the Instance, of the form: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. Identifier to assign to the Instance. Must be unique within scope of the + * parent resource. + */ + // const instanceId = 'abc123' + /** + * Required. The Instance. + */ + // const instance = {} + + // Imports the Apigeeregistry library + const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new ProvisioningClient(); + + async function callCreateInstance() { + // Construct request + const request = { + parent, + instanceId, + instance, + }; + + // Run request + const [operation] = await apigeeregistryClient.createInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateInstance(); + // [END apigeeregistry_v1_generated_Provisioning_CreateInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js new file mode 100644 index 0000000..9e1d226 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js @@ -0,0 +1,63 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Provisioning_DeleteInstance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Instance to delete. + * Format: `projects/* /locations/* /instances/*`. + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new ProvisioningClient(); + + async function callDeleteInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await apigeeregistryClient.deleteInstance(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteInstance(); + // [END apigeeregistry_v1_generated_Provisioning_DeleteInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js new file mode 100644 index 0000000..4a4355c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Provisioning_GetInstance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Instance to retrieve. + * Format: `projects/* /locations/* /instances/*`. + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new ProvisioningClient(); + + async function callGetInstance() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getInstance(request); + console.log(response); + } + + callGetInstance(); + // [END apigeeregistry_v1_generated_Provisioning_GetInstance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js new file mode 100644 index 0000000..ebce3b4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, api, apiId) { + // [START apigeeregistry_v1_generated_Registry_CreateApi_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * Required. The API to create. + */ + // const api = {} + /** + * Required. The ID to use for the API, which will become the final component of + * the API's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const apiId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateApi() { + // Construct request + const request = { + parent, + api, + apiId, + }; + + // Run request + const response = await apigeeregistryClient.createApi(request); + console.log(response); + } + + callCreateApi(); + // [END apigeeregistry_v1_generated_Registry_CreateApi_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js new file mode 100644 index 0000000..1d0c276 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, apiDeployment, apiDeploymentId) { + // [START apigeeregistry_v1_generated_Registry_CreateApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + */ + // const parent = 'abc123' + /** + * Required. The deployment to create. + */ + // const apiDeployment = {} + /** + * Required. The ID to use for the deployment, which will become the final component of + * the deployment's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const apiDeploymentId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateApiDeployment() { + // Construct request + const request = { + parent, + apiDeployment, + apiDeploymentId, + }; + + // Run request + const response = await apigeeregistryClient.createApiDeployment(request); + console.log(response); + } + + callCreateApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_CreateApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js new file mode 100644 index 0000000..44c0e05 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, apiSpec, apiSpecId) { + // [START apigeeregistry_v1_generated_Registry_CreateApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const parent = 'abc123' + /** + * Required. The spec to create. + */ + // const apiSpec = {} + /** + * Required. The ID to use for the spec, which will become the final component of + * the spec's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const apiSpecId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateApiSpec() { + // Construct request + const request = { + parent, + apiSpec, + apiSpecId, + }; + + // Run request + const response = await apigeeregistryClient.createApiSpec(request); + console.log(response); + } + + callCreateApiSpec(); + // [END apigeeregistry_v1_generated_Registry_CreateApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js new file mode 100644 index 0000000..dd7182a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, apiVersion, apiVersionId) { + // [START apigeeregistry_v1_generated_Registry_CreateApiVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + */ + // const parent = 'abc123' + /** + * Required. The version to create. + */ + // const apiVersion = {} + /** + * Required. The ID to use for the version, which will become the final component of + * the version's resource name. + * This value should be 1-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const apiVersionId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateApiVersion() { + // Construct request + const request = { + parent, + apiVersion, + apiVersionId, + }; + + // Run request + const response = await apigeeregistryClient.createApiVersion(request); + console.log(response); + } + + callCreateApiVersion(); + // [END apigeeregistry_v1_generated_Registry_CreateApiVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js new file mode 100644 index 0000000..565ba5f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js @@ -0,0 +1,76 @@ +// 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 +// +// 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'; + +function main(parent, artifact, artifactId) { + // [START apigeeregistry_v1_generated_Registry_CreateArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + */ + // const parent = 'abc123' + /** + * Required. The artifact to create. + */ + // const artifact = {} + /** + * Required. The ID to use for the artifact, which will become the final component of + * the artifact's resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Following AIP-162, IDs must not have the form of a UUID. + */ + // const artifactId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callCreateArtifact() { + // Construct request + const request = { + parent, + artifact, + artifactId, + }; + + // Run request + const response = await apigeeregistryClient.createArtifact(request); + console.log(response); + } + + callCreateArtifact(); + // [END apigeeregistry_v1_generated_Registry_CreateArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js new file mode 100644 index 0000000..440f846 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApi_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the API to delete. + * Format: `projects/* /locations/* /apis/*` + */ + // const name = 'abc123' + /** + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + */ + // const force = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApi() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApi(request); + console.log(response); + } + + callDeleteApi(); + // [END apigeeregistry_v1_generated_Registry_DeleteApi_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js new file mode 100644 index 0000000..47100ad --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment to delete. + * Format: `projects/* /locations/* /apis/* /deployments/*` + */ + // const name = 'abc123' + /** + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + */ + // const force = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiDeployment(request); + console.log(response); + } + + callDeleteApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js new file mode 100644 index 0000000..b46ffa3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js @@ -0,0 +1,64 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment revision to be deleted, + * with a revision ID explicitly included. + * Example: + * `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiDeploymentRevision() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiDeploymentRevision(request); + console.log(response); + } + + callDeleteApiDeploymentRevision(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js new file mode 100644 index 0000000..bf1dfe8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec to delete. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + */ + // const name = 'abc123' + /** + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + */ + // const force = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiSpec() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiSpec(request); + console.log(response); + } + + callDeleteApiSpec(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js new file mode 100644 index 0000000..21fb813 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js @@ -0,0 +1,64 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec revision to be deleted, + * with a revision ID explicitly included. + * Example: + * `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiSpecRevision() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiSpecRevision(request); + console.log(response); + } + + callDeleteApiSpecRevision(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js new file mode 100644 index 0000000..9c59f0b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteApiVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version to delete. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const name = 'abc123' + /** + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + */ + // const force = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteApiVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteApiVersion(request); + console.log(response); + } + + callDeleteApiVersion(); + // [END apigeeregistry_v1_generated_Registry_DeleteApiVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js new file mode 100644 index 0000000..d3e2b7c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_DeleteArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the artifact to delete. + * Format: `{parent}/artifacts/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callDeleteArtifact() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.deleteArtifact(request); + console.log(response); + } + + callDeleteArtifact(); + // [END apigeeregistry_v1_generated_Registry_DeleteArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js new file mode 100644 index 0000000..79568c8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApi_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the API to retrieve. + * Format: `projects/* /locations/* /apis/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApi() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApi(request); + console.log(response); + } + + callGetApi(); + // [END apigeeregistry_v1_generated_Registry_GetApi_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js new file mode 100644 index 0000000..2c0d9d1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment to retrieve. + * Format: `projects/* /locations/* /apis/* /deployments/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApiDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApiDeployment(request); + console.log(response); + } + + callGetApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_GetApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js new file mode 100644 index 0000000..364e0d1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec to retrieve. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApiSpec() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApiSpec(request); + console.log(response); + } + + callGetApiSpec(); + // [END apigeeregistry_v1_generated_Registry_GetApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js new file mode 100644 index 0000000..419e495 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApiSpecContents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec whose contents should be retrieved. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApiSpecContents() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApiSpecContents(request); + console.log(response); + } + + callGetApiSpecContents(); + // [END apigeeregistry_v1_generated_Registry_GetApiSpecContents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js new file mode 100644 index 0000000..384f458 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetApiVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version to retrieve. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetApiVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getApiVersion(request); + console.log(response); + } + + callGetApiVersion(); + // [END apigeeregistry_v1_generated_Registry_GetApiVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js new file mode 100644 index 0000000..fd8cf04 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the artifact to retrieve. + * Format: `{parent}/artifacts/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetArtifact() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getArtifact(request); + console.log(response); + } + + callGetArtifact(); + // [END apigeeregistry_v1_generated_Registry_GetArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js new file mode 100644 index 0000000..983ab0f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js @@ -0,0 +1,62 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_GetArtifactContents_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the artifact whose contents should be retrieved. + * Format: `{parent}/artifacts/*` + */ + // const name = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callGetArtifactContents() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apigeeregistryClient.getArtifactContents(request); + console.log(response); + } + + callGetArtifactContents(); + // [END apigeeregistry_v1_generated_Registry_GetArtifactContents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js new file mode 100644 index 0000000..0f9fa67 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js @@ -0,0 +1,72 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment to list revisions for. + */ + // const name = 'abc123' + /** + * The maximum number of revisions to return per page. + */ + // const pageSize = 1234 + /** + * The page token, received from a previous ListApiDeploymentRevisions call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiDeploymentRevisions() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiDeploymentRevisionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiDeploymentRevisions(); + // [END apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js new file mode 100644 index 0000000..10a7f19 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListApiDeployments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + */ + // const parent = 'abc123' + /** + * The maximum number of deployments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListApiDeployments` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListApiDeployments` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiDeployments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiDeploymentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiDeployments(); + // [END apigeeregistry_v1_generated_Registry_ListApiDeployments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js new file mode 100644 index 0000000..1ee59f0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js @@ -0,0 +1,72 @@ +// 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 +// +// 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'; + +function main(name) { + // [START apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec to list revisions for. + */ + // const name = 'abc123' + /** + * The maximum number of revisions to return per page. + */ + // const pageSize = 1234 + /** + * The page token, received from a previous ListApiSpecRevisions call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiSpecRevisions() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiSpecRevisionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiSpecRevisions(); + // [END apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js new file mode 100644 index 0000000..ed3c4e9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListApiSpecs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const parent = 'abc123' + /** + * The maximum number of specs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListApiSpecs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListApiSpecs` must match + * the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiSpecs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiSpecsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiSpecs(); + // [END apigeeregistry_v1_generated_Registry_ListApiSpecs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js new file mode 100644 index 0000000..01a6314 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListApiVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + */ + // const parent = 'abc123' + /** + * The maximum number of versions to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListApiVersions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListApiVersions` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApiVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listApiVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApiVersions(); + // [END apigeeregistry_v1_generated_Registry_ListApiVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js new file mode 100644 index 0000000..9280a53 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListApis_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + */ + // const parent = 'abc123' + /** + * The maximum number of APIs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListApis` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListApis` must match + * the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListApis() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listApisAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListApis(); + // [END apigeeregistry_v1_generated_Registry_ListApis_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js new file mode 100644 index 0000000..c5d2c3e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js @@ -0,0 +1,83 @@ +// 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 +// +// 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'; + +function main(parent) { + // [START apigeeregistry_v1_generated_Registry_ListArtifacts_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + */ + // const parent = 'abc123' + /** + * The maximum number of artifacts to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListArtifacts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListArtifacts` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + */ + // const filter = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callListArtifacts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await apigeeregistryClient.listArtifactsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListArtifacts(); + // [END apigeeregistry_v1_generated_Registry_ListArtifacts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js new file mode 100644 index 0000000..af41ce8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js @@ -0,0 +1,63 @@ +// 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 +// +// 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'; + +function main(artifact) { + // [START apigeeregistry_v1_generated_Registry_ReplaceArtifact_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The artifact to replace. + * The `name` field is used to identify the artifact to replace. + * Format: `{parent}/artifacts/*` + */ + // const artifact = {} + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callReplaceArtifact() { + // Construct request + const request = { + artifact, + }; + + // Run request + const response = await apigeeregistryClient.replaceArtifact(request); + console.log(response); + } + + callReplaceArtifact(); + // [END apigeeregistry_v1_generated_Registry_ReplaceArtifact_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js new file mode 100644 index 0000000..022b8dc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js @@ -0,0 +1,68 @@ +// 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 +// +// 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'; + +function main(name, revisionId) { + // [START apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The deployment being rolled back. + */ + // const name = 'abc123' + /** + * Required. The revision ID to roll back to. + * It must be a revision of the same deployment. + * Example: `c7cfa2a8` + */ + // const revisionId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callRollbackApiDeployment() { + // Construct request + const request = { + name, + revisionId, + }; + + // Run request + const response = await apigeeregistryClient.rollbackApiDeployment(request); + console.log(response); + } + + callRollbackApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js new file mode 100644 index 0000000..d8acd25 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js @@ -0,0 +1,68 @@ +// 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 +// +// 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'; + +function main(name, revisionId) { + // [START apigeeregistry_v1_generated_Registry_RollbackApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The spec being rolled back. + */ + // const name = 'abc123' + /** + * Required. The revision ID to roll back to. + * It must be a revision of the same spec. + * Example: `c7cfa2a8` + */ + // const revisionId = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callRollbackApiSpec() { + // Construct request + const request = { + name, + revisionId, + }; + + // Run request + const response = await apigeeregistryClient.rollbackApiSpec(request); + console.log(response); + } + + callRollbackApiSpec(); + // [END apigeeregistry_v1_generated_Registry_RollbackApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js new file mode 100644 index 0000000..5c386cc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name, tag) { + // [START apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the deployment to be tagged, including the revision ID. + */ + // const name = 'abc123' + /** + * Required. The tag to apply. + * The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. + */ + // const tag = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callTagApiDeploymentRevision() { + // Construct request + const request = { + name, + tag, + }; + + // Run request + const response = await apigeeregistryClient.tagApiDeploymentRevision(request); + console.log(response); + } + + callTagApiDeploymentRevision(); + // [END apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js new file mode 100644 index 0000000..838836c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js @@ -0,0 +1,67 @@ +// 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 +// +// 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'; + +function main(name, tag) { + // [START apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spec to be tagged, including the revision ID. + */ + // const name = 'abc123' + /** + * Required. The tag to apply. + * The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. + */ + // const tag = 'abc123' + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callTagApiSpecRevision() { + // Construct request + const request = { + name, + tag, + }; + + // Run request + const response = await apigeeregistryClient.tagApiSpecRevision(request); + console.log(response); + } + + callTagApiSpecRevision(); + // [END apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js new file mode 100644 index 0000000..8cb7e3d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js @@ -0,0 +1,75 @@ +// 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 +// +// 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'; + +function main(api) { + // [START apigeeregistry_v1_generated_Registry_UpdateApi_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The API to update. + * The `name` field is used to identify the API to update. + * Format: `projects/* /locations/* /apis/*` + */ + // const api = {} + /** + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + */ + // const updateMask = {} + /** + * If set to true, and the API is not found, a new API will be created. + * In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callUpdateApi() { + // Construct request + const request = { + api, + }; + + // Run request + const response = await apigeeregistryClient.updateApi(request); + console.log(response); + } + + callUpdateApi(); + // [END apigeeregistry_v1_generated_Registry_UpdateApi_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js new file mode 100644 index 0000000..2858dd4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js @@ -0,0 +1,75 @@ +// 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 +// +// 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'; + +function main(apiDeployment) { + // [START apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The deployment to update. + * The `name` field is used to identify the deployment to update. + * Format: `projects/* /locations/* /apis/* /deployments/*` + */ + // const apiDeployment = {} + /** + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + */ + // const updateMask = {} + /** + * If set to true, and the deployment is not found, a new deployment will be + * created. In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callUpdateApiDeployment() { + // Construct request + const request = { + apiDeployment, + }; + + // Run request + const response = await apigeeregistryClient.updateApiDeployment(request); + console.log(response); + } + + callUpdateApiDeployment(); + // [END apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js new file mode 100644 index 0000000..563ac37 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js @@ -0,0 +1,75 @@ +// 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 +// +// 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'; + +function main(apiSpec) { + // [START apigeeregistry_v1_generated_Registry_UpdateApiSpec_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The spec to update. + * The `name` field is used to identify the spec to update. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + */ + // const apiSpec = {} + /** + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + */ + // const updateMask = {} + /** + * If set to true, and the spec is not found, a new spec will be created. + * In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callUpdateApiSpec() { + // Construct request + const request = { + apiSpec, + }; + + // Run request + const response = await apigeeregistryClient.updateApiSpec(request); + console.log(response); + } + + callUpdateApiSpec(); + // [END apigeeregistry_v1_generated_Registry_UpdateApiSpec_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js new file mode 100644 index 0000000..59fb2f5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js @@ -0,0 +1,75 @@ +// 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 +// +// 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'; + +function main(apiVersion) { + // [START apigeeregistry_v1_generated_Registry_UpdateApiVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The version to update. + * The `name` field is used to identify the version to update. + * Format: `projects/* /locations/* /apis/* /versions/*` + */ + // const apiVersion = {} + /** + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + */ + // const updateMask = {} + /** + * If set to true, and the version is not found, a new version will be + * created. In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + + // Imports the Apigeeregistry library + const {RegistryClient} = require('@google-cloud/apigee-registry').v1; + + // Instantiates a client + const apigeeregistryClient = new RegistryClient(); + + async function callUpdateApiVersion() { + // Construct request + const request = { + apiVersion, + }; + + // Run request + const response = await apigeeregistryClient.updateApiVersion(request); + console.log(response); + } + + callUpdateApiVersion(); + // [END apigeeregistry_v1_generated_Registry_UpdateApiVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json new file mode 100644 index 0000000..56680c6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json @@ -0,0 +1,1723 @@ +{ + "clientLibrary": { + "name": "nodejs-apigeeregistry", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.apigeeregistry.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "apigeeregistry_v1_generated_Provisioning_CreateInstance_async", + "title": "Provisioning createInstance Sample", + "origin": "API_DEFINITION", + "description": " Provisions instance resources for the Registry.", + "canonical": true, + "file": "provisioning.create_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.CreateInstance", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "instance_id", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": ".google.cloud.apigeeregistry.v1.Instance" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProvisioningClient", + "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" + }, + "method": { + "shortName": "CreateInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.CreateInstance", + "service": { + "shortName": "Provisioning", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Provisioning_DeleteInstance_async", + "title": "Provisioning deleteInstance Sample", + "origin": "API_DEFINITION", + "description": " Deletes the Registry instance.", + "canonical": true, + "file": "provisioning.delete_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.DeleteInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ProvisioningClient", + "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" + }, + "method": { + "shortName": "DeleteInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.DeleteInstance", + "service": { + "shortName": "Provisioning", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Provisioning_GetInstance_async", + "title": "Provisioning getInstance Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Instance.", + "canonical": true, + "file": "provisioning.get_instance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.GetInstance", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Instance", + "client": { + "shortName": "ProvisioningClient", + "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" + }, + "method": { + "shortName": "GetInstance", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning.GetInstance", + "service": { + "shortName": "Provisioning", + "fullName": "google.cloud.apigeeregistry.v1.Provisioning" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApis_async", + "title": "Provisioning listApis Sample", + "origin": "API_DEFINITION", + "description": " Returns matching APIs.", + "canonical": true, + "file": "registry.list_apis.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApis", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApis", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApisResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApis", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApis", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApi_async", + "title": "Provisioning getApi Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified API.", + "canonical": true, + "file": "registry.get_api.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApi", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Api", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApi", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateApi_async", + "title": "Provisioning createApi Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified API.", + "canonical": true, + "file": "registry.create_api.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApi", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "api", + "type": ".google.cloud.apigeeregistry.v1.Api" + }, + { + "name": "api_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Api", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApi", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApi_async", + "title": "Provisioning updateApi Sample", + "origin": "API_DEFINITION", + "description": " Used to modify a specified API.", + "canonical": true, + "file": "registry.update_api.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApi", + "async": true, + "parameters": [ + { + "name": "api", + "type": ".google.cloud.apigeeregistry.v1.Api" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Api", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "UpdateApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApi", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApi_async", + "title": "Provisioning deleteApi Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified API and all of the resources that it owns.", + "canonical": true, + "file": "registry.delete_api.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApi", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApi", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApi", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiVersions_async", + "title": "Provisioning listApiVersions Sample", + "origin": "API_DEFINITION", + "description": " Returns matching versions.", + "canonical": true, + "file": "registry.list_api_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiVersions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiVersions", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiVersionsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiVersions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiVersions", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApiVersion_async", + "title": "Provisioning getApiVersion Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified version.", + "canonical": true, + "file": "registry.get_api_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiVersion", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiVersion_async", + "title": "Provisioning createApiVersion Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified version.", + "canonical": true, + "file": "registry.create_api_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "api_version", + "type": ".google.cloud.apigeeregistry.v1.ApiVersion" + }, + { + "name": "api_version_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiVersion", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiVersion_async", + "title": "Provisioning updateApiVersion Sample", + "origin": "API_DEFINITION", + "description": " Used to modify a specified version.", + "canonical": true, + "file": "registry.update_api_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiVersion", + "async": true, + "parameters": [ + { + "name": "api_version", + "type": ".google.cloud.apigeeregistry.v1.ApiVersion" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "UpdateApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiVersion", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiVersion_async", + "title": "Provisioning deleteApiVersion Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified version and all of the resources that it owns.", + "canonical": true, + "file": "registry.delete_api_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiVersion", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiVersion", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiSpecs_async", + "title": "Provisioning listApiSpecs Sample", + "origin": "API_DEFINITION", + "description": " Returns matching specs.", + "canonical": true, + "file": "registry.list_api_specs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiSpecs", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecs", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiSpecsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiSpecs", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecs", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApiSpec_async", + "title": "Provisioning getApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified spec.", + "canonical": true, + "file": "registry.get_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpec", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApiSpecContents_async", + "title": "Provisioning getApiSpecContents Sample", + "origin": "API_DEFINITION", + "description": " Returns the contents of a specified spec. If specs are stored with GZip compression, the default behavior is to return the spec uncompressed (the mime_type response field indicates the exact format returned).", + "canonical": true, + "file": "registry.get_api_spec_contents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApiSpecContents", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpecContents", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApiSpecContents", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpecContents", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiSpec_async", + "title": "Provisioning createApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified spec.", + "canonical": true, + "file": "registry.create_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiSpec", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "api_spec", + "type": ".google.cloud.apigeeregistry.v1.ApiSpec" + }, + { + "name": "api_spec_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiSpec_async", + "title": "Provisioning updateApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Used to modify a specified spec.", + "canonical": true, + "file": "registry.update_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiSpec", + "async": true, + "parameters": [ + { + "name": "api_spec", + "type": ".google.cloud.apigeeregistry.v1.ApiSpec" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "UpdateApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiSpec_async", + "title": "Provisioning deleteApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified spec, all revisions, and all child resources (e.g., artifacts).", + "canonical": true, + "file": "registry.delete_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpec", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async", + "title": "Provisioning tagApiSpecRevision Sample", + "origin": "API_DEFINITION", + "description": " Adds a tag to a specified revision of a spec.", + "canonical": true, + "file": "registry.tag_api_spec_revision.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TagApiSpecRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiSpecRevision", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "tag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "TagApiSpecRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiSpecRevision", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async", + "title": "Provisioning listApiSpecRevisions Sample", + "origin": "API_DEFINITION", + "description": " Lists all revisions of a spec. Revisions are returned in descending order of revision creation time.", + "canonical": true, + "file": "registry.list_api_spec_revisions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiSpecRevisions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecRevisions", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiSpecRevisionsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiSpecRevisions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecRevisions", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_RollbackApiSpec_async", + "title": "Provisioning rollbackApiSpec Sample", + "origin": "API_DEFINITION", + "description": " Sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID.", + "canonical": true, + "file": "registry.rollback_api_spec.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RollbackApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiSpec", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "revision_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "RollbackApiSpec", + "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiSpec", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async", + "title": "Provisioning deleteApiSpecRevision Sample", + "origin": "API_DEFINITION", + "description": " Deletes a revision of a spec.", + "canonical": true, + "file": "registry.delete_api_spec_revision.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiSpecRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpecRevision", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiSpecRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpecRevision", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiDeployments_async", + "title": "Provisioning listApiDeployments Sample", + "origin": "API_DEFINITION", + "description": " Returns matching deployments.", + "canonical": true, + "file": "registry.list_api_deployments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiDeployments", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeployments", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiDeploymentsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiDeployments", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeployments", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetApiDeployment_async", + "title": "Provisioning getApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified deployment.", + "canonical": true, + "file": "registry.get_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiDeployment_async", + "title": "Provisioning createApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified deployment.", + "canonical": true, + "file": "registry.create_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiDeployment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "api_deployment", + "type": ".google.cloud.apigeeregistry.v1.ApiDeployment" + }, + { + "name": "api_deployment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async", + "title": "Provisioning updateApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Used to modify a specified deployment.", + "canonical": true, + "file": "registry.update_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiDeployment", + "async": true, + "parameters": [ + { + "name": "api_deployment", + "type": ".google.cloud.apigeeregistry.v1.ApiDeployment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "UpdateApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async", + "title": "Provisioning deleteApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified deployment, all revisions, and all child resources (e.g., artifacts).", + "canonical": true, + "file": "registry.delete_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async", + "title": "Provisioning tagApiDeploymentRevision Sample", + "origin": "API_DEFINITION", + "description": " Adds a tag to a specified revision of a deployment.", + "canonical": true, + "file": "registry.tag_api_deployment_revision.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TagApiDeploymentRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiDeploymentRevision", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "tag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "TagApiDeploymentRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiDeploymentRevision", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async", + "title": "Provisioning listApiDeploymentRevisions Sample", + "origin": "API_DEFINITION", + "description": " Lists all revisions of a deployment. Revisions are returned in descending order of revision creation time.", + "canonical": true, + "file": "registry.list_api_deployment_revisions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListApiDeploymentRevisions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeploymentRevisions", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListApiDeploymentRevisions", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeploymentRevisions", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async", + "title": "Provisioning rollbackApiDeployment Sample", + "origin": "API_DEFINITION", + "description": " Sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID.", + "canonical": true, + "file": "registry.rollback_api_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RollbackApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "revision_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "RollbackApiDeployment", + "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiDeployment", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async", + "title": "Provisioning deleteApiDeploymentRevision Sample", + "origin": "API_DEFINITION", + "description": " Deletes a revision of a deployment.", + "canonical": true, + "file": "registry.delete_api_deployment_revision.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteApiDeploymentRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeploymentRevision", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteApiDeploymentRevision", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeploymentRevision", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ListArtifacts_async", + "title": "Provisioning listArtifacts Sample", + "origin": "API_DEFINITION", + "description": " Returns matching artifacts.", + "canonical": true, + "file": "registry.list_artifacts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListArtifacts", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListArtifacts", + "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" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.ListArtifactsResponse", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ListArtifacts", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ListArtifacts", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetArtifact_async", + "title": "Provisioning getArtifact Sample", + "origin": "API_DEFINITION", + "description": " Returns a specified artifact.", + "canonical": true, + "file": "registry.get_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifact", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Artifact", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifact", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_GetArtifactContents_async", + "title": "Provisioning getArtifactContents Sample", + "origin": "API_DEFINITION", + "description": " Returns the contents of a specified artifact. If artifacts are stored with GZip compression, the default behavior is to return the artifact uncompressed (the mime_type response field indicates the exact format returned).", + "canonical": true, + "file": "registry.get_artifact_contents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetArtifactContents", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifactContents", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.HttpBody", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "GetArtifactContents", + "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifactContents", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_CreateArtifact_async", + "title": "Provisioning createArtifact Sample", + "origin": "API_DEFINITION", + "description": " Creates a specified artifact.", + "canonical": true, + "file": "registry.create_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateArtifact", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "artifact", + "type": ".google.cloud.apigeeregistry.v1.Artifact" + }, + { + "name": "artifact_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Artifact", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "CreateArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateArtifact", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_ReplaceArtifact_async", + "title": "Provisioning replaceArtifact Sample", + "origin": "API_DEFINITION", + "description": " Used to replace a specified artifact.", + "canonical": true, + "file": "registry.replace_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReplaceArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ReplaceArtifact", + "async": true, + "parameters": [ + { + "name": "artifact", + "type": ".google.cloud.apigeeregistry.v1.Artifact" + } + ], + "resultType": ".google.cloud.apigeeregistry.v1.Artifact", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "ReplaceArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.ReplaceArtifact", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + }, + { + "regionTag": "apigeeregistry_v1_generated_Registry_DeleteArtifact_async", + "title": "Provisioning deleteArtifact Sample", + "origin": "API_DEFINITION", + "description": " Removes a specified artifact.", + "canonical": true, + "file": "registry.delete_artifact.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteArtifact", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "RegistryClient", + "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" + }, + "method": { + "shortName": "DeleteArtifact", + "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteArtifact", + "service": { + "shortName": "Registry", + "fullName": "google.cloud.apigeeregistry.v1.Registry" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..9fa6563 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,27 @@ +// 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 +// +// 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. ** + +import * as v1 from './v1'; +const ProvisioningClient = v1.ProvisioningClient; +type ProvisioningClient = v1.ProvisioningClient; +const RegistryClient = v1.RegistryClient; +type RegistryClient = v1.RegistryClient; +export {v1, ProvisioningClient, RegistryClient}; +export default {v1, ProvisioningClient, RegistryClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..783049f --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,445 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.apigeeregistry.v1", + "libraryPackage": "@google-cloud/apigee-registry", + "services": { + "Provisioning": { + "clients": { + "grpc": { + "libraryClient": "ProvisioningClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ProvisioningClient", + "rpcs": { + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + } + } + } + } + }, + "Registry": { + "clients": { + "grpc": { + "libraryClient": "RegistryClient", + "rpcs": { + "GetApi": { + "methods": [ + "getApi" + ] + }, + "CreateApi": { + "methods": [ + "createApi" + ] + }, + "UpdateApi": { + "methods": [ + "updateApi" + ] + }, + "DeleteApi": { + "methods": [ + "deleteApi" + ] + }, + "GetApiVersion": { + "methods": [ + "getApiVersion" + ] + }, + "CreateApiVersion": { + "methods": [ + "createApiVersion" + ] + }, + "UpdateApiVersion": { + "methods": [ + "updateApiVersion" + ] + }, + "DeleteApiVersion": { + "methods": [ + "deleteApiVersion" + ] + }, + "GetApiSpec": { + "methods": [ + "getApiSpec" + ] + }, + "GetApiSpecContents": { + "methods": [ + "getApiSpecContents" + ] + }, + "CreateApiSpec": { + "methods": [ + "createApiSpec" + ] + }, + "UpdateApiSpec": { + "methods": [ + "updateApiSpec" + ] + }, + "DeleteApiSpec": { + "methods": [ + "deleteApiSpec" + ] + }, + "TagApiSpecRevision": { + "methods": [ + "tagApiSpecRevision" + ] + }, + "RollbackApiSpec": { + "methods": [ + "rollbackApiSpec" + ] + }, + "DeleteApiSpecRevision": { + "methods": [ + "deleteApiSpecRevision" + ] + }, + "GetApiDeployment": { + "methods": [ + "getApiDeployment" + ] + }, + "CreateApiDeployment": { + "methods": [ + "createApiDeployment" + ] + }, + "UpdateApiDeployment": { + "methods": [ + "updateApiDeployment" + ] + }, + "DeleteApiDeployment": { + "methods": [ + "deleteApiDeployment" + ] + }, + "TagApiDeploymentRevision": { + "methods": [ + "tagApiDeploymentRevision" + ] + }, + "RollbackApiDeployment": { + "methods": [ + "rollbackApiDeployment" + ] + }, + "DeleteApiDeploymentRevision": { + "methods": [ + "deleteApiDeploymentRevision" + ] + }, + "GetArtifact": { + "methods": [ + "getArtifact" + ] + }, + "GetArtifactContents": { + "methods": [ + "getArtifactContents" + ] + }, + "CreateArtifact": { + "methods": [ + "createArtifact" + ] + }, + "ReplaceArtifact": { + "methods": [ + "replaceArtifact" + ] + }, + "DeleteArtifact": { + "methods": [ + "deleteArtifact" + ] + }, + "ListApis": { + "methods": [ + "listApis", + "listApisStream", + "listApisAsync" + ] + }, + "ListApiVersions": { + "methods": [ + "listApiVersions", + "listApiVersionsStream", + "listApiVersionsAsync" + ] + }, + "ListApiSpecs": { + "methods": [ + "listApiSpecs", + "listApiSpecsStream", + "listApiSpecsAsync" + ] + }, + "ListApiSpecRevisions": { + "methods": [ + "listApiSpecRevisions", + "listApiSpecRevisionsStream", + "listApiSpecRevisionsAsync" + ] + }, + "ListApiDeployments": { + "methods": [ + "listApiDeployments", + "listApiDeploymentsStream", + "listApiDeploymentsAsync" + ] + }, + "ListApiDeploymentRevisions": { + "methods": [ + "listApiDeploymentRevisions", + "listApiDeploymentRevisionsStream", + "listApiDeploymentRevisionsAsync" + ] + }, + "ListArtifacts": { + "methods": [ + "listArtifacts", + "listArtifactsStream", + "listArtifactsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "RegistryClient", + "rpcs": { + "GetApi": { + "methods": [ + "getApi" + ] + }, + "CreateApi": { + "methods": [ + "createApi" + ] + }, + "UpdateApi": { + "methods": [ + "updateApi" + ] + }, + "DeleteApi": { + "methods": [ + "deleteApi" + ] + }, + "GetApiVersion": { + "methods": [ + "getApiVersion" + ] + }, + "CreateApiVersion": { + "methods": [ + "createApiVersion" + ] + }, + "UpdateApiVersion": { + "methods": [ + "updateApiVersion" + ] + }, + "DeleteApiVersion": { + "methods": [ + "deleteApiVersion" + ] + }, + "GetApiSpec": { + "methods": [ + "getApiSpec" + ] + }, + "GetApiSpecContents": { + "methods": [ + "getApiSpecContents" + ] + }, + "CreateApiSpec": { + "methods": [ + "createApiSpec" + ] + }, + "UpdateApiSpec": { + "methods": [ + "updateApiSpec" + ] + }, + "DeleteApiSpec": { + "methods": [ + "deleteApiSpec" + ] + }, + "TagApiSpecRevision": { + "methods": [ + "tagApiSpecRevision" + ] + }, + "RollbackApiSpec": { + "methods": [ + "rollbackApiSpec" + ] + }, + "DeleteApiSpecRevision": { + "methods": [ + "deleteApiSpecRevision" + ] + }, + "GetApiDeployment": { + "methods": [ + "getApiDeployment" + ] + }, + "CreateApiDeployment": { + "methods": [ + "createApiDeployment" + ] + }, + "UpdateApiDeployment": { + "methods": [ + "updateApiDeployment" + ] + }, + "DeleteApiDeployment": { + "methods": [ + "deleteApiDeployment" + ] + }, + "TagApiDeploymentRevision": { + "methods": [ + "tagApiDeploymentRevision" + ] + }, + "RollbackApiDeployment": { + "methods": [ + "rollbackApiDeployment" + ] + }, + "DeleteApiDeploymentRevision": { + "methods": [ + "deleteApiDeploymentRevision" + ] + }, + "GetArtifact": { + "methods": [ + "getArtifact" + ] + }, + "GetArtifactContents": { + "methods": [ + "getArtifactContents" + ] + }, + "CreateArtifact": { + "methods": [ + "createArtifact" + ] + }, + "ReplaceArtifact": { + "methods": [ + "replaceArtifact" + ] + }, + "DeleteArtifact": { + "methods": [ + "deleteArtifact" + ] + }, + "ListApis": { + "methods": [ + "listApis", + "listApisStream", + "listApisAsync" + ] + }, + "ListApiVersions": { + "methods": [ + "listApiVersions", + "listApiVersionsStream", + "listApiVersionsAsync" + ] + }, + "ListApiSpecs": { + "methods": [ + "listApiSpecs", + "listApiSpecsStream", + "listApiSpecsAsync" + ] + }, + "ListApiSpecRevisions": { + "methods": [ + "listApiSpecRevisions", + "listApiSpecRevisionsStream", + "listApiSpecRevisionsAsync" + ] + }, + "ListApiDeployments": { + "methods": [ + "listApiDeployments", + "listApiDeploymentsStream", + "listApiDeploymentsAsync" + ] + }, + "ListApiDeploymentRevisions": { + "methods": [ + "listApiDeploymentRevisions", + "listApiDeploymentRevisionsStream", + "listApiDeploymentRevisionsAsync" + ] + }, + "ListArtifacts": { + "methods": [ + "listArtifacts", + "listArtifactsStream", + "listArtifactsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..03a07e1 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,20 @@ +// 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 +// +// 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. ** + +export {ProvisioningClient} from './provisioning_client'; +export {RegistryClient} from './registry_client'; diff --git a/owl-bot-staging/v1/src/v1/provisioning_client.ts b/owl-bot-staging/v1/src/v1/provisioning_client.ts new file mode 100644 index 0000000..729abd9 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/provisioning_client.ts @@ -0,0 +1,1737 @@ +// 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 +// +// 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/provisioning_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './provisioning_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The service that is used for managing the data plane provisioning of the + * Registry. + * @class + * @memberof v1 + */ +export class ProvisioningClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + provisioningStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProvisioningClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ProvisioningClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ProvisioningClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + apiPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}' + ), + apiDeploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}' + ), + apiSpecPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}' + ), + apiVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectLocationApiArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}' + ), + projectLocationApiDeploymentArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}' + ), + projectLocationApiVersionArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}' + ), + projectLocationApiVersionSpecArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}' + ), + projectLocationArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/artifacts/{artifact}' + ), + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/apis/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/instances/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/runtime}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/apis/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/apis/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:testIamPermissions',body: '*',}], + },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createInstanceResponse = protoFilesRoot.lookup( + '.google.cloud.apigeeregistry.v1.Instance') as gax.protobuf.Type; + const createInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.apigeeregistry.v1.OperationMetadata') as gax.protobuf.Type; + const deleteInstanceResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteInstanceMetadata = protoFilesRoot.lookup( + '.google.cloud.apigeeregistry.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createInstanceResponse.decode.bind(createInstanceResponse), + createInstanceMetadata.decode.bind(createInstanceMetadata)), + deleteInstance: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteInstanceResponse.decode.bind(deleteInstanceResponse), + deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.apigeeregistry.v1.Provisioning', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.provisioningStub) { + return this.provisioningStub; + } + + // Put together the "service stub" for + // google.cloud.apigeeregistry.v1.Provisioning. + this.provisioningStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.apigeeregistry.v1.Provisioning') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.apigeeregistry.v1.Provisioning, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const provisioningStubMethods = + ['createInstance', 'deleteInstance', 'getInstance']; + for (const methodName of provisioningStubMethods) { + const callPromise = this.provisioningStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.provisioningStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'apigeeregistry.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'apigeeregistry.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets details of a single Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Instance to retrieve. + * Format: `projects/* /locations/* /instances/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Instance]{@link google.cloud.apigeeregistry.v1.Instance}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.get_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_GetInstance_async + */ + getInstance( + request?: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|undefined, {}|undefined + ]>; + getInstance( + request: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): void; + getInstance( + request?: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IInstance, + protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getInstance(request, options, callback); + } + +/** + * Provisions instance resources for the Registry. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent resource of the Instance, of the form: `projects/* /locations/*` + * @param {string} request.instanceId + * Required. Identifier to assign to the Instance. Must be unique within scope of the + * parent resource. + * @param {google.cloud.apigeeregistry.v1.Instance} request.instance + * Required. The Instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.create_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_CreateInstance_async + */ + createInstance( + request?: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createInstance( + request: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createInstance( + request?: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.create_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_CreateInstance_async + */ + async checkCreateInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the Registry instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Instance to delete. + * Format: `projects/* /locations/* /instances/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.delete_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_DeleteInstance_async + */ + deleteInstance( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteInstance( + request: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteInstance( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteInstance(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteInstance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/provisioning.delete_instance.js + * region_tag:apigeeregistry_v1_generated_Provisioning_DeleteInstance_async + */ + async checkDeleteInstanceProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified api resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @returns {string} Resource name string. + */ + apiPath(project:string,location:string,api:string) { + return this.pathTemplates.apiPathTemplate.render({ + project: project, + location: location, + api: api, + }); + } + + /** + * Parse the project from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).project; + } + + /** + * Parse the location from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).location; + } + + /** + * Parse the api from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).api; + } + + /** + * Return a fully-qualified apiDeployment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} deployment + * @returns {string} Resource name string. + */ + apiDeploymentPath(project:string,location:string,api:string,deployment:string) { + return this.pathTemplates.apiDeploymentPathTemplate.render({ + project: project, + location: location, + api: api, + deployment: deployment, + }); + } + + /** + * Parse the project from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).project; + } + + /** + * Parse the location from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).location; + } + + /** + * Parse the api from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).api; + } + + /** + * Parse the deployment from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).deployment; + } + + /** + * Return a fully-qualified apiSpec resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} spec + * @returns {string} Resource name string. + */ + apiSpecPath(project:string,location:string,api:string,version:string,spec:string) { + return this.pathTemplates.apiSpecPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + spec: spec, + }); + } + + /** + * Parse the project from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).project; + } + + /** + * Parse the location from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).location; + } + + /** + * Parse the api from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).api; + } + + /** + * Parse the version from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the version. + */ + matchVersionFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).version; + } + + /** + * Parse the spec from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the spec. + */ + matchSpecFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).spec; + } + + /** + * Return a fully-qualified apiVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @returns {string} Resource name string. + */ + apiVersionPath(project:string,location:string,api:string,version:string) { + return this.pathTemplates.apiVersionPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + }); + } + + /** + * Parse the project from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).project; + } + + /** + * Parse the location from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).location; + } + + /** + * Parse the api from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).api; + } + + /** + * Parse the version from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the version. + */ + matchVersionFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).version; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).location; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified projectLocationApiArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiArtifactPath(project:string,location:string,api:string,artifact:string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).api; + } + + /** + * Parse the artifact from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiDeploymentArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} deployment + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiDeploymentArtifactPath(project:string,location:string,api:string,deployment:string,artifact:string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + deployment: deployment, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).api; + } + + /** + * Parse the deployment from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).deployment; + } + + /** + * Parse the artifact from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiVersionArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiVersionArtifactPath(project:string,location:string,api:string,version:string,artifact:string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).api; + } + + /** + * Parse the version from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).version; + } + + /** + * Parse the artifact from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiVersionSpecArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} spec + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiVersionSpecArtifactPath(project:string,location:string,api:string,version:string,spec:string,artifact:string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + spec: spec, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).api; + } + + /** + * Parse the version from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).version; + } + + /** + * Parse the spec from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the spec. + */ + matchSpecFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).spec; + } + + /** + * Parse the artifact from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationArtifactPath(project:string,location:string,artifact:string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.render({ + project: project, + location: location, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).project; + } + + /** + * Parse the location from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).location; + } + + /** + * Parse the artifact from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).artifact; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.provisioningStub && !this._terminated) { + return this.provisioningStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/provisioning_client_config.json b/owl-bot-staging/v1/src/v1/provisioning_client_config.json new file mode 100644 index 0000000..2e37ea8 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/provisioning_client_config.json @@ -0,0 +1,38 @@ +{ + "interfaces": { + "google.cloud.apigeeregistry.v1.Provisioning": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateInstance": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteInstance": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetInstance": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/provisioning_proto_list.json b/owl-bot-staging/v1/src/v1/provisioning_proto_list.json new file mode 100644 index 0000000..4fdc846 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/provisioning_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/apigeeregistry/v1/provisioning_service.proto", + "../../protos/google/cloud/apigeeregistry/v1/registry_models.proto", + "../../protos/google/cloud/apigeeregistry/v1/registry_service.proto" +] diff --git a/owl-bot-staging/v1/src/v1/registry_client.ts b/owl-bot-staging/v1/src/v1/registry_client.ts new file mode 100644 index 0000000..3fe4cd1 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/registry_client.ts @@ -0,0 +1,4842 @@ +// 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 +// +// 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/registry_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './registry_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Registry service allows teams to manage descriptions of APIs. + * @class + * @memberof v1 + */ +export class RegistryClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + registryStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of RegistryClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new RegistryClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof RegistryClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + apiPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}' + ), + apiDeploymentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}' + ), + apiSpecPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}' + ), + apiVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationApiArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}' + ), + projectLocationApiDeploymentArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}' + ), + projectLocationApiVersionArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}' + ), + projectLocationApiVersionSpecArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}' + ), + projectLocationArtifactPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/artifacts/{artifact}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listApis: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apis'), + listApiVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiVersions'), + listApiSpecs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiSpecs'), + listApiSpecRevisions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiSpecs'), + listApiDeployments: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiDeployments'), + listApiDeploymentRevisions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiDeployments'), + listArtifacts: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'artifacts') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.apigeeregistry.v1.Registry', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.registryStub) { + return this.registryStub; + } + + // Put together the "service stub" for + // google.cloud.apigeeregistry.v1.Registry. + this.registryStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.apigeeregistry.v1.Registry') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.apigeeregistry.v1.Registry, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const registryStubMethods = + ['listApis', 'getApi', 'createApi', 'updateApi', 'deleteApi', 'listApiVersions', 'getApiVersion', 'createApiVersion', 'updateApiVersion', 'deleteApiVersion', 'listApiSpecs', 'getApiSpec', 'getApiSpecContents', 'createApiSpec', 'updateApiSpec', 'deleteApiSpec', 'tagApiSpecRevision', 'listApiSpecRevisions', 'rollbackApiSpec', 'deleteApiSpecRevision', 'listApiDeployments', 'getApiDeployment', 'createApiDeployment', 'updateApiDeployment', 'deleteApiDeployment', 'tagApiDeploymentRevision', 'listApiDeploymentRevisions', 'rollbackApiDeployment', 'deleteApiDeploymentRevision', 'listArtifacts', 'getArtifact', 'getArtifactContents', 'createArtifact', 'replaceArtifact', 'deleteArtifact']; + for (const methodName of registryStubMethods) { + const callPromise = this.registryStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.registryStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'apigeeregistry.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'apigeeregistry.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Returns a specified API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the API to retrieve. + * Format: `projects/* /locations/* /apis/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApi_async + */ + getApi( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|undefined, {}|undefined + ]>; + getApi( + request: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, + {}|null|undefined>): void; + getApi( + request: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, + {}|null|undefined>): void; + getApi( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IGetApiRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApi(request, options, callback); + } +/** + * Creates a specified API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + * @param {google.cloud.apigeeregistry.v1.Api} request.api + * Required. The API to create. + * @param {string} request.apiId + * Required. The ID to use for the API, which will become the final component of + * the API's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_api.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateApi_async + */ + createApi( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|undefined, {}|undefined + ]>; + createApi( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, + {}|null|undefined>): void; + createApi( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, + {}|null|undefined>): void; + createApi( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createApi(request, options, callback); + } +/** + * Used to modify a specified API. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.Api} request.api + * Required. The API to update. + * + * The `name` field is used to identify the API to update. + * Format: `projects/* /locations/* /apis/*` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + * @param {boolean} request.allowMissing + * If set to true, and the API is not found, a new API will be created. + * In this situation, `update_mask` is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.update_api.js + * region_tag:apigeeregistry_v1_generated_Registry_UpdateApi_async + */ + updateApi( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|undefined, {}|undefined + ]>; + updateApi( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, + {}|null|undefined>): void; + updateApi( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, + {}|null|undefined>): void; + updateApi( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi, + protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'api.name': request.api!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateApi(request, options, callback); + } +/** + * Removes a specified API and all of the resources that it + * owns. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the API to delete. + * Format: `projects/* /locations/* /apis/*` + * @param {boolean} request.force + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApi_async + */ + deleteApi( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|undefined, {}|undefined + ]>; + deleteApi( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, + {}|null|undefined>): void; + deleteApi( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, + {}|null|undefined>): void; + deleteApi( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApi(request, options, callback); + } +/** + * Returns a specified version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version to retrieve. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api_version.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApiVersion_async + */ + getApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|undefined, {}|undefined + ]>; + getApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, + {}|null|undefined>): void; + getApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, + {}|null|undefined>): void; + getApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApiVersion(request, options, callback); + } +/** + * Creates a specified version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + * @param {google.cloud.apigeeregistry.v1.ApiVersion} request.apiVersion + * Required. The version to create. + * @param {string} request.apiVersionId + * Required. The ID to use for the version, which will become the final component of + * the version's resource name. + * + * This value should be 1-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_api_version.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateApiVersion_async + */ + createApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|undefined, {}|undefined + ]>; + createApiVersion( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, + {}|null|undefined>): void; + createApiVersion( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, + {}|null|undefined>): void; + createApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createApiVersion(request, options, callback); + } +/** + * Used to modify a specified version. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.ApiVersion} request.apiVersion + * Required. The version to update. + * + * The `name` field is used to identify the version to update. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + * @param {boolean} request.allowMissing + * If set to true, and the version is not found, a new version will be + * created. In this situation, `update_mask` is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.update_api_version.js + * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiVersion_async + */ + updateApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|undefined, {}|undefined + ]>; + updateApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, + {}|null|undefined>): void; + updateApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, + {}|null|undefined>): void; + updateApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion, + protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'api_version.name': request.apiVersion!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateApiVersion(request, options, callback); + } +/** + * Removes a specified version and all of the resources that + * it owns. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version to delete. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {boolean} request.force + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_version.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiVersion_async + */ + deleteApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|undefined, {}|undefined + ]>; + deleteApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiVersion( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiVersion( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiVersion(request, options, callback); + } +/** + * Returns a specified spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to retrieve. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApiSpec_async + */ + getApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|undefined, {}|undefined + ]>; + getApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, + {}|null|undefined>): void; + getApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, + {}|null|undefined>): void; + getApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApiSpec(request, options, callback); + } +/** + * Returns the contents of a specified spec. + * If specs are stored with GZip compression, the default behavior + * is to return the spec uncompressed (the mime_type response field + * indicates the exact format returned). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec whose contents should be retrieved. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api_spec_contents.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApiSpecContents_async + */ + getApiSpecContents( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|undefined, {}|undefined + ]>; + getApiSpecContents( + request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, + {}|null|undefined>): void; + getApiSpecContents( + request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, + {}|null|undefined>): void; + getApiSpecContents( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApiSpecContents(request, options, callback); + } +/** + * Creates a specified spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {google.cloud.apigeeregistry.v1.ApiSpec} request.apiSpec + * Required. The spec to create. + * @param {string} request.apiSpecId + * Required. The ID to use for the spec, which will become the final component of + * the spec's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateApiSpec_async + */ + createApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|undefined, {}|undefined + ]>; + createApiSpec( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, + {}|null|undefined>): void; + createApiSpec( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, + {}|null|undefined>): void; + createApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createApiSpec(request, options, callback); + } +/** + * Used to modify a specified spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.ApiSpec} request.apiSpec + * Required. The spec to update. + * + * The `name` field is used to identify the spec to update. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + * @param {boolean} request.allowMissing + * If set to true, and the spec is not found, a new spec will be created. + * In this situation, `update_mask` is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.update_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiSpec_async + */ + updateApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|undefined, {}|undefined + ]>; + updateApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, + {}|null|undefined>): void; + updateApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, + {}|null|undefined>): void; + updateApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'api_spec.name': request.apiSpec!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateApiSpec(request, options, callback); + } +/** + * Removes a specified spec, all revisions, and all child + * resources (e.g., artifacts). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to delete. + * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` + * @param {boolean} request.force + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiSpec_async + */ + deleteApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|undefined, {}|undefined + ]>; + deleteApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, + {}|null|undefined>): void; + deleteApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, + {}|null|undefined>): void; + deleteApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiSpec(request, options, callback); + } +/** + * Adds a tag to a specified revision of a spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to be tagged, including the revision ID. + * @param {string} request.tag + * Required. The tag to apply. + * The tag should be at most 40 characters, and match `{@link a-z0-9-|a-z}{3,39}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.tag_api_spec_revision.js + * region_tag:apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async + */ + tagApiSpecRevision( + request?: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|undefined, {}|undefined + ]>; + tagApiSpecRevision( + request: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): void; + tagApiSpecRevision( + request: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): void; + tagApiSpecRevision( + request?: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.tagApiSpecRevision(request, options, callback); + } +/** + * Sets the current revision to a specified prior revision. + * Note that this creates a new revision with a new revision ID. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The spec being rolled back. + * @param {string} request.revisionId + * Required. The revision ID to roll back to. + * It must be a revision of the same spec. + * + * Example: `c7cfa2a8` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.rollback_api_spec.js + * region_tag:apigeeregistry_v1_generated_Registry_RollbackApiSpec_async + */ + rollbackApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|undefined, {}|undefined + ]>; + rollbackApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, + {}|null|undefined>): void; + rollbackApiSpec( + request: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, + {}|null|undefined>): void; + rollbackApiSpec( + request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.rollbackApiSpec(request, options, callback); + } +/** + * Deletes a revision of a spec. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec revision to be deleted, + * with a revision ID explicitly included. + * + * Example: + * `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_spec_revision.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async + */ + deleteApiSpecRevision( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|undefined, {}|undefined + ]>; + deleteApiSpecRevision( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiSpecRevision( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiSpecRevision( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec, + protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiSpecRevision(request, options, callback); + } +/** + * Returns a specified deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to retrieve. + * Format: `projects/* /locations/* /apis/* /deployments/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_GetApiDeployment_async + */ + getApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|undefined, {}|undefined + ]>; + getApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + getApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + getApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getApiDeployment(request, options, callback); + } +/** + * Creates a specified deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + * @param {google.cloud.apigeeregistry.v1.ApiDeployment} request.apiDeployment + * Required. The deployment to create. + * @param {string} request.apiDeploymentId + * Required. The ID to use for the deployment, which will become the final component of + * the deployment's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateApiDeployment_async + */ + createApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|undefined, {}|undefined + ]>; + createApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + createApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + createApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createApiDeployment(request, options, callback); + } +/** + * Used to modify a specified deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.ApiDeployment} request.apiDeployment + * Required. The deployment to update. + * + * The `name` field is used to identify the deployment to update. + * Format: `projects/* /locations/* /apis/* /deployments/*` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If omitted, all fields are updated that + * are set in the request message (fields set to default values are ignored). + * If an asterisk "*" is specified, all fields are updated, including fields + * that are unspecified/default in the request. + * @param {boolean} request.allowMissing + * If set to true, and the deployment is not found, a new deployment will be + * created. In this situation, `update_mask` is ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.update_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async + */ + updateApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|undefined, {}|undefined + ]>; + updateApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + updateApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + updateApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'api_deployment.name': request.apiDeployment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateApiDeployment(request, options, callback); + } +/** + * Removes a specified deployment, all revisions, and all + * child resources (e.g., artifacts). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to delete. + * Format: `projects/* /locations/* /apis/* /deployments/*` + * @param {boolean} request.force + * If set to true, any child resources will also be deleted. + * (Otherwise, the request will only work if there are no child resources.) + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async + */ + deleteApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|undefined, {}|undefined + ]>; + deleteApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + deleteApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + deleteApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiDeployment(request, options, callback); + } +/** + * Adds a tag to a specified revision of a + * deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to be tagged, including the revision ID. + * @param {string} request.tag + * Required. The tag to apply. + * The tag should be at most 40 characters, and match `{@link a-z0-9-|a-z}{3,39}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.tag_api_deployment_revision.js + * region_tag:apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async + */ + tagApiDeploymentRevision( + request?: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|undefined, {}|undefined + ]>; + tagApiDeploymentRevision( + request: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): void; + tagApiDeploymentRevision( + request: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): void; + tagApiDeploymentRevision( + request?: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.tagApiDeploymentRevision(request, options, callback); + } +/** + * Sets the current revision to a specified prior + * revision. Note that this creates a new revision with a new revision ID. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The deployment being rolled back. + * @param {string} request.revisionId + * Required. The revision ID to roll back to. + * It must be a revision of the same deployment. + * + * Example: `c7cfa2a8` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.rollback_api_deployment.js + * region_tag:apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async + */ + rollbackApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|undefined, {}|undefined + ]>; + rollbackApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + rollbackApiDeployment( + request: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, + {}|null|undefined>): void; + rollbackApiDeployment( + request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.rollbackApiDeployment(request, options, callback); + } +/** + * Deletes a revision of a deployment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment revision to be deleted, + * with a revision ID explicitly included. + * + * Example: + * `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_api_deployment_revision.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async + */ + deleteApiDeploymentRevision( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|undefined, {}|undefined + ]>; + deleteApiDeploymentRevision( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiDeploymentRevision( + request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): void; + deleteApiDeploymentRevision( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment, + protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteApiDeploymentRevision(request, options, callback); + } +/** + * Returns a specified artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the artifact to retrieve. + * Format: `{parent}/artifacts/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_artifact.js + * region_tag:apigeeregistry_v1_generated_Registry_GetArtifact_async + */ + getArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|undefined, {}|undefined + ]>; + getArtifact( + request: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, + {}|null|undefined>): void; + getArtifact( + request: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, + {}|null|undefined>): void; + getArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getArtifact(request, options, callback); + } +/** + * Returns the contents of a specified artifact. + * If artifacts are stored with GZip compression, the default behavior + * is to return the artifact uncompressed (the mime_type response field + * indicates the exact format returned). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the artifact whose contents should be retrieved. + * Format: `{parent}/artifacts/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.get_artifact_contents.js + * region_tag:apigeeregistry_v1_generated_Registry_GetArtifactContents_async + */ + getArtifactContents( + request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, + options?: CallOptions): + Promise<[ + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|undefined, {}|undefined + ]>; + getArtifactContents( + request: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, + {}|null|undefined>): void; + getArtifactContents( + request: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, + callback: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, + {}|null|undefined>): void; + getArtifactContents( + request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.api.IHttpBody, + protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getArtifactContents(request, options, callback); + } +/** + * Creates a specified artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + * @param {google.cloud.apigeeregistry.v1.Artifact} request.artifact + * Required. The artifact to create. + * @param {string} request.artifactId + * Required. The ID to use for the artifact, which will become the final component of + * the artifact's resource name. + * + * This value should be 4-63 characters, and valid characters + * are /{@link 0-9|a-z}-/. + * + * Following AIP-162, IDs must not have the form of a UUID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.create_artifact.js + * region_tag:apigeeregistry_v1_generated_Registry_CreateArtifact_async + */ + createArtifact( + request?: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|undefined, {}|undefined + ]>; + createArtifact( + request: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, + {}|null|undefined>): void; + createArtifact( + request: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, + {}|null|undefined>): void; + createArtifact( + request?: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createArtifact(request, options, callback); + } +/** + * Used to replace a specified artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.apigeeregistry.v1.Artifact} request.artifact + * Required. The artifact to replace. + * + * The `name` field is used to identify the artifact to replace. + * Format: `{parent}/artifacts/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.replace_artifact.js + * region_tag:apigeeregistry_v1_generated_Registry_ReplaceArtifact_async + */ + replaceArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|undefined, {}|undefined + ]>; + replaceArtifact( + request: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, + {}|null|undefined>): void; + replaceArtifact( + request: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, + callback: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, + {}|null|undefined>): void; + replaceArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact, + protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'artifact.name': request.artifact!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.replaceArtifact(request, options, callback); + } +/** + * Removes a specified artifact. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the artifact to delete. + * Format: `{parent}/artifacts/*` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/registry.delete_artifact.js + * region_tag:apigeeregistry_v1_generated_Registry_DeleteArtifact_async + */ + deleteArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|undefined, {}|undefined + ]>; + deleteArtifact( + request: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, + {}|null|undefined>): void; + deleteArtifact( + request: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, + {}|null|undefined>): void; + deleteArtifact( + request?: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteArtifact(request, options, callback); + } + + /** + * Returns matching APIs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The maximum number of APIs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApis` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApis` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Api]{@link google.cloud.apigeeregistry.v1.Api}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApisAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApis( + request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi[], + protos.google.cloud.apigeeregistry.v1.IListApisRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApisResponse + ]>; + listApis( + request: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApisRequest, + protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApi>): void; + listApis( + request: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApisRequest, + protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApi>): void; + listApis( + request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApisRequest, + protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApi>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApisRequest, + protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApi>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApi[], + protos.google.cloud.apigeeregistry.v1.IListApisRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApisResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApis(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The maximum number of APIs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApis` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApis` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApisAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApisStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApis']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApis.createStream( + this.innerApiCalls.listApis as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApis`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of APIs. + * Format: `projects/* /locations/*` + * @param {number} request.pageSize + * The maximum number of APIs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApis` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApis` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Api]{@link google.cloud.apigeeregistry.v1.Api}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_apis.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApis_async + */ + listApisAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApis']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApis.asyncIterate( + this.innerApiCalls['listApis'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns matching versions. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of versions to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiVersions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiVersions` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiVersions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion[], + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse + ]>; + listApiVersions( + request: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiVersion>): void; + listApiVersions( + request: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiVersion>): void; + listApiVersions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiVersion>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiVersion>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiVersion[], + protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiVersions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of versions to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiVersions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiVersions` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiVersionsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiVersions.createStream( + this.innerApiCalls.listApiVersions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiVersions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of versions. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of versions to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiVersions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiVersions` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_versions.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiVersions_async + */ + listApiVersionsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiVersions.asyncIterate( + this.innerApiCalls['listApiVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns matching specs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {number} request.pageSize + * The maximum number of specs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiSpecs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiSpecs` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiSpecsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiSpecs( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec[], + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse + ]>; + listApiSpecs( + request: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; + listApiSpecs( + request: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; + listApiSpecs( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec[], + protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiSpecs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {number} request.pageSize + * The maximum number of specs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiSpecs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiSpecs` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiSpecsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiSpecsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiSpecs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiSpecs.createStream( + this.innerApiCalls.listApiSpecs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiSpecs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of specs. + * Format: `projects/* /locations/* /apis/* /versions/*` + * @param {number} request.pageSize + * The maximum number of specs to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiSpecs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiSpecs` must match + * the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_specs.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiSpecs_async + */ + listApiSpecsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiSpecs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiSpecs.asyncIterate( + this.innerApiCalls['listApiSpecs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all revisions of a spec. + * Revisions are returned in descending order of revision creation time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiSpecRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiSpecRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiSpecRevisions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec[], + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse + ]>; + listApiSpecRevisions( + request: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; + listApiSpecRevisions( + request: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; + listApiSpecRevisions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiSpec>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiSpec[], + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiSpecRevisions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiSpecRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiSpecRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiSpecRevisionsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listApiSpecRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiSpecRevisions.createStream( + this.innerApiCalls.listApiSpecRevisions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiSpecRevisions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spec to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiSpecRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_spec_revisions.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async + */ + listApiSpecRevisionsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listApiSpecRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiSpecRevisions.asyncIterate( + this.innerApiCalls['listApiSpecRevisions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns matching deployments. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of deployments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiDeployments` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiDeploymentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiDeployments( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment[], + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse + ]>; + listApiDeployments( + request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; + listApiDeployments( + request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; + listApiDeployments( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment[], + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiDeployments(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of deployments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiDeployments` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiDeploymentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiDeploymentsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiDeployments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiDeployments.createStream( + this.innerApiCalls.listApiDeployments as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiDeployments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of deployments. + * Format: `projects/* /locations/* /apis/*` + * @param {number} request.pageSize + * The maximum number of deployments to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListApiDeployments` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListApiDeployments` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_deployments.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiDeployments_async + */ + listApiDeploymentsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listApiDeployments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiDeployments.asyncIterate( + this.innerApiCalls['listApiDeployments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all revisions of a deployment. + * Revisions are returned in descending order of revision creation time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiDeploymentRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApiDeploymentRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiDeploymentRevisions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment[], + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse + ]>; + listApiDeploymentRevisions( + request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; + listApiDeploymentRevisions( + request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; + listApiDeploymentRevisions( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IApiDeployment>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IApiDeployment[], + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.listApiDeploymentRevisions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiDeploymentRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApiDeploymentRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listApiDeploymentRevisionsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiDeploymentRevisions.createStream( + this.innerApiCalls.listApiDeploymentRevisions as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listApiDeploymentRevisions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the deployment to list revisions for. + * @param {number} request.pageSize + * The maximum number of revisions to return per page. + * @param {string} request.pageToken + * The page token, received from a previous ListApiDeploymentRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_api_deployment_revisions.js + * region_tag:apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async + */ + listApiDeploymentRevisionsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listApiDeploymentRevisions.asyncIterate( + this.innerApiCalls['listApiDeploymentRevisions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Returns matching artifacts. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListArtifacts` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListArtifacts` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listArtifactsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listArtifacts( + request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact[], + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse + ]>; + listArtifacts( + request: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IArtifact>): void; + listArtifacts( + request: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + callback: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IArtifact>): void; + listArtifacts( + request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IArtifact>, + callback?: PaginationCallback< + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, + protos.google.cloud.apigeeregistry.v1.IArtifact>): + Promise<[ + protos.google.cloud.apigeeregistry.v1.IArtifact[], + protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest|null, + protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listArtifacts(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListArtifacts` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListArtifacts` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listArtifactsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listArtifactsStream( + request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listArtifacts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listArtifacts.createStream( + this.innerApiCalls.listArtifacts as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listArtifacts`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of artifacts. + * Format: `{parent}` + * @param {number} request.pageSize + * The maximum number of artifacts to return. + * The service may return fewer than this value. + * If unspecified, at most 50 values will be returned. + * The maximum is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListArtifacts` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListArtifacts` must + * match the call that provided the page token. + * @param {string} request.filter + * An expression that can be used to filter the list. Filters use the Common + * Expression Language and can refer to all message fields except contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/registry.list_artifacts.js + * region_tag:apigeeregistry_v1_generated_Registry_ListArtifacts_async + */ + listArtifactsAsync( + request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listArtifacts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listArtifacts.asyncIterate( + this.innerApiCalls['listArtifacts'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified api resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @returns {string} Resource name string. + */ + apiPath(project:string,location:string,api:string) { + return this.pathTemplates.apiPathTemplate.render({ + project: project, + location: location, + api: api, + }); + } + + /** + * Parse the project from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).project; + } + + /** + * Parse the location from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).location; + } + + /** + * Parse the api from Api resource. + * + * @param {string} apiName + * A fully-qualified path representing Api resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiName(apiName: string) { + return this.pathTemplates.apiPathTemplate.match(apiName).api; + } + + /** + * Return a fully-qualified apiDeployment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} deployment + * @returns {string} Resource name string. + */ + apiDeploymentPath(project:string,location:string,api:string,deployment:string) { + return this.pathTemplates.apiDeploymentPathTemplate.render({ + project: project, + location: location, + api: api, + deployment: deployment, + }); + } + + /** + * Parse the project from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).project; + } + + /** + * Parse the location from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).location; + } + + /** + * Parse the api from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).api; + } + + /** + * Parse the deployment from ApiDeployment resource. + * + * @param {string} apiDeploymentName + * A fully-qualified path representing ApiDeployment resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromApiDeploymentName(apiDeploymentName: string) { + return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).deployment; + } + + /** + * Return a fully-qualified apiSpec resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} spec + * @returns {string} Resource name string. + */ + apiSpecPath(project:string,location:string,api:string,version:string,spec:string) { + return this.pathTemplates.apiSpecPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + spec: spec, + }); + } + + /** + * Parse the project from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).project; + } + + /** + * Parse the location from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).location; + } + + /** + * Parse the api from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).api; + } + + /** + * Parse the version from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the version. + */ + matchVersionFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).version; + } + + /** + * Parse the spec from ApiSpec resource. + * + * @param {string} apiSpecName + * A fully-qualified path representing ApiSpec resource. + * @returns {string} A string representing the spec. + */ + matchSpecFromApiSpecName(apiSpecName: string) { + return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).spec; + } + + /** + * Return a fully-qualified apiVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @returns {string} Resource name string. + */ + apiVersionPath(project:string,location:string,api:string,version:string) { + return this.pathTemplates.apiVersionPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + }); + } + + /** + * Parse the project from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).project; + } + + /** + * Parse the location from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).location; + } + + /** + * Parse the api from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the api. + */ + matchApiFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).api; + } + + /** + * Parse the version from ApiVersion resource. + * + * @param {string} apiVersionName + * A fully-qualified path representing ApiVersion resource. + * @returns {string} A string representing the version. + */ + matchVersionFromApiVersionName(apiVersionName: string) { + return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).version; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,location:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the location from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).location; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationApiArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiArtifactPath(project:string,location:string,api:string,artifact:string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).api; + } + + /** + * Parse the artifact from ProjectLocationApiArtifact resource. + * + * @param {string} projectLocationApiArtifactName + * A fully-qualified path representing project_location_api_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { + return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiDeploymentArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} deployment + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiDeploymentArtifactPath(project:string,location:string,api:string,deployment:string,artifact:string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + deployment: deployment, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).api; + } + + /** + * Parse the deployment from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the deployment. + */ + matchDeploymentFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).deployment; + } + + /** + * Parse the artifact from ProjectLocationApiDeploymentArtifact resource. + * + * @param {string} projectLocationApiDeploymentArtifactName + * A fully-qualified path representing project_location_api_deployment_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { + return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiVersionArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiVersionArtifactPath(project:string,location:string,api:string,version:string,artifact:string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).api; + } + + /** + * Parse the version from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).version; + } + + /** + * Parse the artifact from ProjectLocationApiVersionArtifact resource. + * + * @param {string} projectLocationApiVersionArtifactName + * A fully-qualified path representing project_location_api_version_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationApiVersionSpecArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api + * @param {string} version + * @param {string} spec + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationApiVersionSpecArtifactPath(project:string,location:string,api:string,version:string,spec:string,artifact:string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render({ + project: project, + location: location, + api: api, + version: version, + spec: spec, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).project; + } + + /** + * Parse the location from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).location; + } + + /** + * Parse the api from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the api. + */ + matchApiFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).api; + } + + /** + * Parse the version from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).version; + } + + /** + * Parse the spec from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the spec. + */ + matchSpecFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).spec; + } + + /** + * Parse the artifact from ProjectLocationApiVersionSpecArtifact resource. + * + * @param {string} projectLocationApiVersionSpecArtifactName + * A fully-qualified path representing project_location_api_version_spec_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { + return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).artifact; + } + + /** + * Return a fully-qualified projectLocationArtifact resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} artifact + * @returns {string} Resource name string. + */ + projectLocationArtifactPath(project:string,location:string,artifact:string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.render({ + project: project, + location: location, + artifact: artifact, + }); + } + + /** + * Parse the project from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).project; + } + + /** + * Parse the location from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).location; + } + + /** + * Parse the artifact from ProjectLocationArtifact resource. + * + * @param {string} projectLocationArtifactName + * A fully-qualified path representing project_location_artifact resource. + * @returns {string} A string representing the artifact. + */ + matchArtifactFromProjectLocationArtifactName(projectLocationArtifactName: string) { + return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).artifact; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.registryStub && !this._terminated) { + return this.registryStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/registry_client_config.json b/owl-bot-staging/v1/src/v1/registry_client_config.json new file mode 100644 index 0000000..c26bf95 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/registry_client_config.json @@ -0,0 +1,216 @@ +{ + "interfaces": { + "google.cloud.apigeeregistry.v1.Registry": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "cancelled_deadline_exceeded_aborted_unavailable": [ + "CANCELLED", + "DEADLINE_EXCEEDED", + "ABORTED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "5763d5cb4f40f09b4de469b8a0f10443a7a49d00": { + "initial_retry_delay_millis": 200, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListApis": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApi": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateApi": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "UpdateApi": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteApi": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiVersions": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApiVersion": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateApiVersion": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "UpdateApiVersion": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteApiVersion": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiSpecs": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApiSpecContents": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "UpdateApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "TagApiSpecRevision": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiSpecRevisions": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "RollbackApiSpec": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteApiSpecRevision": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiDeployments": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "UpdateApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "TagApiDeploymentRevision": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListApiDeploymentRevisions": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "RollbackApiDeployment": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteApiDeploymentRevision": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ListArtifacts": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "GetArtifactContents": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "CreateArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "ReplaceArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + }, + "DeleteArtifact": { + "timeout_millis": 60000, + "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", + "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/registry_proto_list.json b/owl-bot-staging/v1/src/v1/registry_proto_list.json new file mode 100644 index 0000000..4fdc846 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/registry_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/apigeeregistry/v1/provisioning_service.proto", + "../../protos/google/cloud/apigeeregistry/v1/registry_models.proto", + "../../protos/google/cloud/apigeeregistry/v1/registry_service.proto" +] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..2bd97dc --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// 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 +// +// 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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const apigeeregistry = require('@google-cloud/apigee-registry'); + +function main() { + const provisioningClient = new apigeeregistry.ProvisioningClient(); + const registryClient = new apigeeregistry.RegistryClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..7c5f275 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,38 @@ +// 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 +// +// 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. ** + +import {ProvisioningClient, RegistryClient} from '@google-cloud/apigee-registry'; + +// check that the client class type name can be used +function doStuffWithProvisioningClient(client: ProvisioningClient) { + client.close(); +} +function doStuffWithRegistryClient(client: RegistryClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const provisioningClient = new ProvisioningClient(); + doStuffWithProvisioningClient(provisioningClient); + // check that the client instance can be created + const registryClient = new RegistryClient(); + doStuffWithRegistryClient(registryClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..557a575 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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 +// +// 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. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_provisioning_v1.ts b/owl-bot-staging/v1/test/gapic_provisioning_v1.ts new file mode 100644 index 0000000..3225e79 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_provisioning_v1.ts @@ -0,0 +1,1896 @@ +// 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 +// +// 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as provisioningModule from '../src'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.ProvisioningClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = provisioningModule.v1.ProvisioningClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = provisioningModule.v1.ProvisioningClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = provisioningModule.v1.ProvisioningClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new provisioningModule.v1.ProvisioningClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new provisioningModule.v1.ProvisioningClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.provisioningStub, undefined); + await client.initialize(); + assert(client.provisioningStub); + }); + + it('has close method for the initialized client', done => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.provisioningStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.provisioningStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Instance() + ); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Instance() + ); + client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IInstance|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getInstance with closed client', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('createInstance', () => { + it('invokes createInstance without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.createInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance with call error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createInstance with LRO error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateInstanceRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateInstanceProgress without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateInstanceProgress with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteInstance', () => { + it('invokes deleteInstance without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteInstance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteInstance( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance with call error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteInstance(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteInstance with LRO error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteInstance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteInstanceProgress without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteInstanceProgress with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('api', () => { + const fakePath = "/rendered/path/api"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiPath', () => { + const result = client.apiPath("projectValue", "locationValue", "apiValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiName', () => { + const result = client.matchProjectFromApiName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiName', () => { + const result = client.matchLocationFromApiName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiName', () => { + const result = client.matchApiFromApiName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiDeployment', () => { + const fakePath = "/rendered/path/apiDeployment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + deployment: "deploymentValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiDeploymentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiDeploymentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiDeploymentPath', () => { + const result = client.apiDeploymentPath("projectValue", "locationValue", "apiValue", "deploymentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiDeploymentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiDeploymentName', () => { + const result = client.matchProjectFromApiDeploymentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiDeploymentName', () => { + const result = client.matchLocationFromApiDeploymentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiDeploymentName', () => { + const result = client.matchApiFromApiDeploymentName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromApiDeploymentName', () => { + const result = client.matchDeploymentFromApiDeploymentName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiSpec', () => { + const fakePath = "/rendered/path/apiSpec"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + spec: "specValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiSpecPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiSpecPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiSpecPath', () => { + const result = client.apiSpecPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiSpecPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiSpecName', () => { + const result = client.matchProjectFromApiSpecName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiSpecName', () => { + const result = client.matchLocationFromApiSpecName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiSpecName', () => { + const result = client.matchApiFromApiSpecName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromApiSpecName', () => { + const result = client.matchVersionFromApiSpecName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpecFromApiSpecName', () => { + const result = client.matchSpecFromApiSpecName(fakePath); + assert.strictEqual(result, "specValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiVersion', () => { + const fakePath = "/rendered/path/apiVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiVersionPath', () => { + const result = client.apiVersionPath("projectValue", "locationValue", "apiValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiVersionName', () => { + const result = client.matchProjectFromApiVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiVersionName', () => { + const result = client.matchLocationFromApiVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiVersionName', () => { + const result = client.matchApiFromApiVersionName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromApiVersionName', () => { + const result = client.matchVersionFromApiVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiArtifactPath', () => { + const result = client.projectLocationApiArtifactPath("projectValue", "locationValue", "apiValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiArtifactName', () => { + const result = client.matchApiFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiDeploymentArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiDeploymentArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + deployment: "deploymentValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiDeploymentArtifactPath', () => { + const result = client.projectLocationApiDeploymentArtifactPath("projectValue", "locationValue", "apiValue", "deploymentValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchApiFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchDeploymentFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiVersionArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiVersionArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiVersionArtifactPath', () => { + const result = client.projectLocationApiVersionArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchApiFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchVersionFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiVersionSpecArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiVersionSpecArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + spec: "specValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiVersionSpecArtifactPath', () => { + const result = client.projectLocationApiVersionSpecArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchApiFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchVersionFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpecFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchSpecFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "specValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationArtifact', () => { + const fakePath = "/rendered/path/projectLocationArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + artifact: "artifactValue", + }; + const client = new provisioningModule.v1.ProvisioningClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationArtifactPath', () => { + const result = client.projectLocationArtifactPath("projectValue", "locationValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationArtifactName', () => { + const result = client.matchProjectFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationArtifactName', () => { + const result = client.matchLocationFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationArtifactName', () => { + const result = client.matchArtifactFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/test/gapic_registry_v1.ts b/owl-bot-staging/v1/test/gapic_registry_v1.ts new file mode 100644 index 0000000..f61594b --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_registry_v1.ts @@ -0,0 +1,6025 @@ +// 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 +// +// 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as registryModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.RegistryClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = registryModule.v1.RegistryClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = registryModule.v1.RegistryClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = registryModule.v1.RegistryClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new registryModule.v1.RegistryClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new registryModule.v1.RegistryClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.registryStub, undefined); + await client.initialize(); + assert(client.registryStub); + }); + + it('has close method for the initialized client', done => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.registryStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.registryStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getApi', () => { + it('invokes getApi without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.getApi = stubSimpleCall(expectedResponse); + const [response] = await client.getApi(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApi without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.getApi = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApi( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApi with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApi = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApi(request), expectedError); + const actualRequest = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApi with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApi(request), expectedError); + }); + }); + + describe('createApi', () => { + it('invokes createApi without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.createApi = stubSimpleCall(expectedResponse); + const [response] = await client.createApi(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApi without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.createApi = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApi( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApi with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApi = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApi(request), expectedError); + const actualRequest = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApi with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createApi(request), expectedError); + }); + }); + + describe('updateApi', () => { + it('invokes updateApi without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() + ); + request.api ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiRequest', ['api', 'name']); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.updateApi = stubSimpleCall(expectedResponse); + const [response] = await client.updateApi(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApi without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() + ); + request.api ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiRequest', ['api', 'name']); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Api() + ); + client.innerApiCalls.updateApi = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApi( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApi with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() + ); + request.api ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiRequest', ['api', 'name']); + request.api.name = defaultValue1; + const expectedHeaderRequestParams = `api.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApi = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApi(request), expectedError); + const actualRequest = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApi with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() + ); + request.api ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiRequest', ['api', 'name']); + request.api.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateApi(request), expectedError); + }); + }); + + describe('deleteApi', () => { + it('invokes deleteApi without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApi = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApi(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApi without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApi = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApi( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApi with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApi = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApi(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApi with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApi(request), expectedError); + }); + }); + + describe('getApiVersion', () => { + it('invokes getApiVersion without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.getApiVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getApiVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiVersion without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.getApiVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApiVersion( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiVersion with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApiVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApiVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiVersion with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApiVersion(request), expectedError); + }); + }); + + describe('createApiVersion', () => { + it('invokes createApiVersion without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.createApiVersion = stubSimpleCall(expectedResponse); + const [response] = await client.createApiVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiVersion without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.createApiVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApiVersion( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiVersion with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApiVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApiVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiVersion with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createApiVersion(request), expectedError); + }); + }); + + describe('updateApiVersion', () => { + it('invokes updateApiVersion without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() + ); + request.apiVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', ['apiVersion', 'name']); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.updateApiVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateApiVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiVersion without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() + ); + request.apiVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', ['apiVersion', 'name']); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiVersion() + ); + client.innerApiCalls.updateApiVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApiVersion( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiVersion with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() + ); + request.apiVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', ['apiVersion', 'name']); + request.apiVersion.name = defaultValue1; + const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApiVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApiVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiVersion with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() + ); + request.apiVersion ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', ['apiVersion', 'name']); + request.apiVersion.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateApiVersion(request), expectedError); + }); + }); + + describe('deleteApiVersion', () => { + it('invokes deleteApiVersion without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiVersion without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiVersion( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiVersion with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiVersion(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiVersion with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiVersion(request), expectedError); + }); + }); + + describe('getApiSpec', () => { + it('invokes getApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.getApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.getApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.getApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApiSpec( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApiSpec(request), expectedError); + }); + }); + + describe('getApiSpecContents', () => { + it('invokes getApiSpecContents without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getApiSpecContents = stubSimpleCall(expectedResponse); + const [response] = await client.getApiSpecContents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpecContents without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getApiSpecContents = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApiSpecContents( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpecContents with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApiSpecContents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApiSpecContents(request), expectedError); + const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiSpecContents with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApiSpecContents(request), expectedError); + }); + }); + + describe('createApiSpec', () => { + it('invokes createApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.createApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.createApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.createApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApiSpec( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createApiSpec(request), expectedError); + }); + }); + + describe('updateApiSpec', () => { + it('invokes updateApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() + ); + request.apiSpec ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', ['apiSpec', 'name']); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.updateApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.updateApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() + ); + request.apiSpec ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', ['apiSpec', 'name']); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.updateApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApiSpec( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() + ); + request.apiSpec ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', ['apiSpec', 'name']); + request.apiSpec.name = defaultValue1; + const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() + ); + request.apiSpec ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', ['apiSpec', 'name']); + request.apiSpec.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateApiSpec(request), expectedError); + }); + }); + + describe('deleteApiSpec', () => { + it('invokes deleteApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiSpec( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiSpec(request), expectedError); + }); + }); + + describe('tagApiSpecRevision', () => { + it('invokes tagApiSpecRevision without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.tagApiSpecRevision = stubSimpleCall(expectedResponse); + const [response] = await client.tagApiSpecRevision(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiSpecRevision without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.tagApiSpecRevision = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.tagApiSpecRevision( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiSpecRevision with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.tagApiSpecRevision = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.tagApiSpecRevision(request), expectedError); + const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiSpecRevision with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.tagApiSpecRevision(request), expectedError); + }); + }); + + describe('rollbackApiSpec', () => { + it('invokes rollbackApiSpec without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.rollbackApiSpec = stubSimpleCall(expectedResponse); + const [response] = await client.rollbackApiSpec(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiSpec without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.rollbackApiSpec = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollbackApiSpec( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiSpec with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollbackApiSpec = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rollbackApiSpec(request), expectedError); + const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiSpec with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.rollbackApiSpec(request), expectedError); + }); + }); + + describe('deleteApiSpecRevision', () => { + it('invokes deleteApiSpecRevision without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiSpecRevision(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpecRevision without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiSpec() + ); + client.innerApiCalls.deleteApiSpecRevision = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiSpecRevision( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpecRevision with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiSpecRevision(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiSpecRevision with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiSpecRevision(request), expectedError); + }); + }); + + describe('getApiDeployment', () => { + it('invokes getApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.getApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.getApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.getApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApiDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getApiDeployment(request), expectedError); + }); + }); + + describe('createApiDeployment', () => { + it('invokes createApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.createApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.createApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.createApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApiDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createApiDeployment(request), expectedError); + }); + }); + + describe('updateApiDeployment', () => { + it('invokes updateApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() + ); + request.apiDeployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', ['apiDeployment', 'name']); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.updateApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.updateApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() + ); + request.apiDeployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', ['apiDeployment', 'name']); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.updateApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApiDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() + ); + request.apiDeployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', ['apiDeployment', 'name']); + request.apiDeployment.name = defaultValue1; + const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() + ); + request.apiDeployment ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', ['apiDeployment', 'name']); + request.apiDeployment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateApiDeployment(request), expectedError); + }); + }); + + describe('deleteApiDeployment', () => { + it('invokes deleteApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiDeployment( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiDeployment(request), expectedError); + }); + }); + + describe('tagApiDeploymentRevision', () => { + it('invokes tagApiDeploymentRevision without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall(expectedResponse); + const [response] = await client.tagApiDeploymentRevision(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiDeploymentRevision without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.tagApiDeploymentRevision( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiDeploymentRevision with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.tagApiDeploymentRevision(request), expectedError); + const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes tagApiDeploymentRevision with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.tagApiDeploymentRevision(request), expectedError); + }); + }); + + describe('rollbackApiDeployment', () => { + it('invokes rollbackApiDeployment without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.rollbackApiDeployment = stubSimpleCall(expectedResponse); + const [response] = await client.rollbackApiDeployment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiDeployment without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.rollbackApiDeployment = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollbackApiDeployment( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiDeployment with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollbackApiDeployment = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.rollbackApiDeployment(request), expectedError); + const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rollbackApiDeployment with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.rollbackApiDeployment(request), expectedError); + }); + }); + + describe('deleteApiDeploymentRevision', () => { + it('invokes deleteApiDeploymentRevision without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall(expectedResponse); + const [response] = await client.deleteApiDeploymentRevision(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeploymentRevision without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ApiDeployment() + ); + client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApiDeploymentRevision( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeploymentRevision with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteApiDeploymentRevision(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteApiDeploymentRevision with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteApiDeploymentRevision(request), expectedError); + }); + }); + + describe('getArtifact', () => { + it('invokes getArtifact without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.getArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.getArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifact without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.getArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getArtifact( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifact with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifact with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getArtifact(request), expectedError); + }); + }); + + describe('getArtifactContents', () => { + it('invokes getArtifactContents without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getArtifactContents = stubSimpleCall(expectedResponse); + const [response] = await client.getArtifactContents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifactContents without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.HttpBody() + ); + client.innerApiCalls.getArtifactContents = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getArtifactContents( + request, + (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifactContents with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getArtifactContents = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getArtifactContents(request), expectedError); + const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getArtifactContents with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getArtifactContents(request), expectedError); + }); + }); + + describe('createArtifact', () => { + it('invokes createArtifact without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateArtifactRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.createArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.createArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createArtifact without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateArtifactRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.createArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createArtifact( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createArtifact with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateArtifactRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createArtifact with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateArtifactRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createArtifact(request), expectedError); + }); + }); + + describe('replaceArtifact', () => { + it('invokes replaceArtifact without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() + ); + request.artifact ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', ['artifact', 'name']); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.replaceArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.replaceArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceArtifact without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() + ); + request.artifact ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', ['artifact', 'name']); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.Artifact() + ); + client.innerApiCalls.replaceArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.replaceArtifact( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceArtifact with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() + ); + request.artifact ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', ['artifact', 'name']); + request.artifact.name = defaultValue1; + const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.replaceArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.replaceArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes replaceArtifact with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() + ); + request.artifact ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', ['artifact', 'name']); + request.artifact.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.replaceArtifact(request), expectedError); + }); + }); + + describe('deleteArtifact', () => { + it('invokes deleteArtifact without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteArtifact = stubSimpleCall(expectedResponse); + const [response] = await client.deleteArtifact(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteArtifact without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteArtifact = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteArtifact( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteArtifact with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteArtifact = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteArtifact(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteArtifact with closed client', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteArtifact(request), expectedError); + }); + }); + + describe('listApis', () => { + it('invokes listApis without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + ]; + client.innerApiCalls.listApis = stubSimpleCall(expectedResponse); + const [response] = await client.listApis(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApis without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + ]; + client.innerApiCalls.listApis = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApis( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApis with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApis = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApis(request), expectedError); + const actualRequest = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApisStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + ]; + client.descriptors.page.listApis.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApisStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.Api[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Api) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApis, request)); + assert( + (client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApisStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApis.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApisStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.Api[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Api) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApis, request)); + assert( + (client.descriptors.page.listApis.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApis without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), + ]; + client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApi[] = []; + const iterable = client.listApisAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApis with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApisRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApisAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApi[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApis.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiVersions', () => { + it('invokes listApiVersions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + ]; + client.innerApiCalls.listApiVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listApiVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiVersions without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + ]; + client.innerApiCalls.listApiVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiVersions( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiVersions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiVersions(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiVersionsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + ]; + client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiVersion[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiVersions, request)); + assert( + (client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiVersionsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiVersion[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiVersions, request)); + assert( + (client.descriptors.page.listApiVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiVersions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), + ]; + client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiVersion[] = []; + const iterable = client.listApiVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiVersions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiSpecs', () => { + it('invokes listApiSpecs without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.innerApiCalls.listApiSpecs = stubSimpleCall(expectedResponse); + const [response] = await client.listApiSpecs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecs without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.innerApiCalls.listApiSpecs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiSpecs( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecs with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiSpecs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiSpecs(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiSpecsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiSpecs, request)); + assert( + (client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiSpecsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiSpecsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiSpecs, request)); + assert( + (client.descriptors.page.listApiSpecs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiSpecs without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; + const iterable = client.listApiSpecsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiSpecs with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiSpecsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiSpecRevisions', () => { + it('invokes listApiSpecRevisions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.innerApiCalls.listApiSpecRevisions = stubSimpleCall(expectedResponse); + const [response] = await client.listApiSpecRevisions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecRevisions without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.innerApiCalls.listApiSpecRevisions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiSpecRevisions( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecRevisions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiSpecRevisions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiSpecRevisions(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiSpecRevisionsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiSpecRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiSpecRevisions, request)); + assert( + (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiSpecRevisionsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiSpecRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiSpecRevisions, request)); + assert( + (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiSpecRevisions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), + ]; + client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; + const iterable = client.listApiSpecRevisionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiSpecRevisions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiSpecRevisionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiDeployments', () => { + it('invokes listApiDeployments without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.innerApiCalls.listApiDeployments = stubSimpleCall(expectedResponse); + const [response] = await client.listApiDeployments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeployments without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.innerApiCalls.listApiDeployments = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiDeployments( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeployments with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiDeployments = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiDeployments(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeploymentsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiDeployments, request)); + assert( + (client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiDeploymentsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiDeploymentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiDeployments, request)); + assert( + (client.descriptors.page.listApiDeployments.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiDeployments without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; + const iterable = client.listApiDeploymentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiDeployments with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiDeploymentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listApiDeploymentRevisions', () => { + it('invokes listApiDeploymentRevisions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall(expectedResponse); + const [response] = await client.listApiDeploymentRevisions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeploymentRevisions without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApiDeploymentRevisions( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeploymentRevisions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listApiDeploymentRevisions(request), expectedError); + const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listApiDeploymentRevisionsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listApiDeploymentRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiDeploymentRevisions, request)); + assert( + (client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listApiDeploymentRevisionsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listApiDeploymentRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listApiDeploymentRevisions, request)); + assert( + (client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiDeploymentRevisions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), + ]; + client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; + const iterable = client.listApiDeploymentRevisionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listApiDeploymentRevisions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApiDeploymentRevisionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listArtifacts', () => { + it('invokes listArtifacts without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + ]; + client.innerApiCalls.listArtifacts = stubSimpleCall(expectedResponse); + const [response] = await client.listArtifacts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listArtifacts without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + ]; + client.innerApiCalls.listArtifacts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listArtifacts( + request, + (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listArtifacts with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listArtifacts = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listArtifacts(request), expectedError); + const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listArtifactsStream without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + ]; + client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listArtifactsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.Artifact[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Artifact) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listArtifacts, request)); + assert( + (client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listArtifactsStream with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listArtifactsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apigeeregistry.v1.Artifact[] = []; + stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Artifact) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listArtifacts, request)); + assert( + (client.descriptors.page.listArtifacts.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listArtifacts without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), + ]; + client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apigeeregistry.v1.IArtifact[] = []; + const iterable = client.listArtifactsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listArtifacts with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listArtifactsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apigeeregistry.v1.IArtifact[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('api', () => { + const fakePath = "/rendered/path/api"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiPath', () => { + const result = client.apiPath("projectValue", "locationValue", "apiValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiName', () => { + const result = client.matchProjectFromApiName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiName', () => { + const result = client.matchLocationFromApiName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiName', () => { + const result = client.matchApiFromApiName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiDeployment', () => { + const fakePath = "/rendered/path/apiDeployment"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + deployment: "deploymentValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiDeploymentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiDeploymentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiDeploymentPath', () => { + const result = client.apiDeploymentPath("projectValue", "locationValue", "apiValue", "deploymentValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiDeploymentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiDeploymentName', () => { + const result = client.matchProjectFromApiDeploymentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiDeploymentName', () => { + const result = client.matchLocationFromApiDeploymentName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiDeploymentName', () => { + const result = client.matchApiFromApiDeploymentName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromApiDeploymentName', () => { + const result = client.matchDeploymentFromApiDeploymentName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiSpec', () => { + const fakePath = "/rendered/path/apiSpec"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + spec: "specValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiSpecPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiSpecPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiSpecPath', () => { + const result = client.apiSpecPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiSpecPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiSpecName', () => { + const result = client.matchProjectFromApiSpecName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiSpecName', () => { + const result = client.matchLocationFromApiSpecName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiSpecName', () => { + const result = client.matchApiFromApiSpecName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromApiSpecName', () => { + const result = client.matchVersionFromApiSpecName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpecFromApiSpecName', () => { + const result = client.matchSpecFromApiSpecName(fakePath); + assert.strictEqual(result, "specValue"); + assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('apiVersion', () => { + const fakePath = "/rendered/path/apiVersion"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.apiVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiVersionPath', () => { + const result = client.apiVersionPath("projectValue", "locationValue", "apiValue", "versionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiVersionName', () => { + const result = client.matchProjectFromApiVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiVersionName', () => { + const result = client.matchLocationFromApiVersionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromApiVersionName', () => { + const result = client.matchApiFromApiVersionName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromApiVersionName', () => { + const result = client.matchVersionFromApiVersionName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiArtifactPath', () => { + const result = client.projectLocationApiArtifactPath("projectValue", "locationValue", "apiValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiArtifactName', () => { + const result = client.matchApiFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiDeploymentArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiDeploymentArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + deployment: "deploymentValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiDeploymentArtifactPath', () => { + const result = client.projectLocationApiDeploymentArtifactPath("projectValue", "locationValue", "apiValue", "deploymentValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchApiFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDeploymentFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchDeploymentFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "deploymentValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiDeploymentArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiDeploymentArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiVersionArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiVersionArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiVersionArtifactPath', () => { + const result = client.projectLocationApiVersionArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchApiFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchVersionFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiVersionArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiVersionArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiVersionSpecArtifact', () => { + const fakePath = "/rendered/path/projectLocationApiVersionSpecArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api: "apiValue", + version: "versionValue", + spec: "specValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiVersionSpecArtifactPath', () => { + const result = client.projectLocationApiVersionSpecArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchProjectFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchLocationFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchApiFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "apiValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchVersionFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchVersionFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "versionValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpecFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchSpecFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "specValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationApiVersionSpecArtifactName', () => { + const result = client.matchArtifactFromProjectLocationApiVersionSpecArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationArtifact', () => { + const fakePath = "/rendered/path/projectLocationArtifact"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + artifact: "artifactValue", + }; + const client = new registryModule.v1.RegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationArtifactPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationArtifactPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationArtifactPath', () => { + const result = client.projectLocationArtifactPath("projectValue", "locationValue", "artifactValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationArtifactName', () => { + const result = client.matchProjectFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationArtifactName', () => { + const result = client.matchLocationFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchArtifactFromProjectLocationArtifactName', () => { + const result = client.matchArtifactFromProjectLocationArtifactName(fakePath); + assert.strictEqual(result, "artifactValue"); + assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..c94e0fd --- /dev/null +++ b/owl-bot-staging/v1/webpack.config.js @@ -0,0 +1,64 @@ +// 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 +// +// 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'Provisioning', + filename: './provisioning.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 4e4407e131f60601c24170dc34b224f04fc46f5a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 21 Sep 2022 03:17:31 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 65 - .../v1/provisioning_service.proto | 205 - .../apigeeregistry/v1/registry_models.proto | 364 - .../apigeeregistry/v1/registry_service.proto | 1133 ---- .../v1/provisioning.create_instance.js | 73 - .../v1/provisioning.delete_instance.js | 63 - .../generated/v1/provisioning.get_instance.js | 62 - .../generated/v1/registry.create_api.js | 76 - .../v1/registry.create_api_deployment.js | 76 - .../generated/v1/registry.create_api_spec.js | 76 - .../v1/registry.create_api_version.js | 76 - .../generated/v1/registry.create_artifact.js | 76 - .../generated/v1/registry.delete_api.js | 67 - .../v1/registry.delete_api_deployment.js | 67 - ...registry.delete_api_deployment_revision.js | 64 - .../generated/v1/registry.delete_api_spec.js | 67 - .../v1/registry.delete_api_spec_revision.js | 64 - .../v1/registry.delete_api_version.js | 67 - .../generated/v1/registry.delete_artifact.js | 62 - .../samples/generated/v1/registry.get_api.js | 62 - .../v1/registry.get_api_deployment.js | 62 - .../generated/v1/registry.get_api_spec.js | 62 - .../v1/registry.get_api_spec_contents.js | 62 - .../generated/v1/registry.get_api_version.js | 62 - .../generated/v1/registry.get_artifact.js | 62 - .../v1/registry.get_artifact_contents.js | 62 - .../registry.list_api_deployment_revisions.js | 72 - .../v1/registry.list_api_deployments.js | 83 - .../v1/registry.list_api_spec_revisions.js | 72 - .../generated/v1/registry.list_api_specs.js | 83 - .../v1/registry.list_api_versions.js | 83 - .../generated/v1/registry.list_apis.js | 83 - .../generated/v1/registry.list_artifacts.js | 83 - .../generated/v1/registry.replace_artifact.js | 63 - .../v1/registry.rollback_api_deployment.js | 68 - .../v1/registry.rollback_api_spec.js | 68 - .../registry.tag_api_deployment_revision.js | 67 - .../v1/registry.tag_api_spec_revision.js | 67 - .../generated/v1/registry.update_api.js | 75 - .../v1/registry.update_api_deployment.js | 75 - .../generated/v1/registry.update_api_spec.js | 75 - .../v1/registry.update_api_version.js | 75 - ...tadata.google.cloud.apigeeregistry.v1.json | 1723 ----- owl-bot-staging/v1/src/index.ts | 27 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 445 -- owl-bot-staging/v1/src/v1/index.ts | 20 - .../v1/src/v1/provisioning_client.ts | 1737 ----- .../v1/src/v1/provisioning_client_config.json | 38 - .../v1/src/v1/provisioning_proto_list.json | 5 - owl-bot-staging/v1/src/v1/registry_client.ts | 4842 ------------- .../v1/src/v1/registry_client_config.json | 216 - .../v1/src/v1/registry_proto_list.json | 5 - .../system-test/fixtures/sample/src/index.js | 28 - .../system-test/fixtures/sample/src/index.ts | 38 - owl-bot-staging/v1/system-test/install.ts | 49 - .../v1/test/gapic_provisioning_v1.ts | 1896 ------ owl-bot-staging/v1/test/gapic_registry_v1.ts | 6025 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - src/v1/registry_client.ts | 341 - test/gapic_provisioning_v1.ts | 76 +- test/gapic_registry_v1.ts | 1290 ++-- 70 files changed, 624 insertions(+), 22840 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/provisioning_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/provisioning_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/provisioning_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/registry_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/registry_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/registry_proto_list.json delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_provisioning_v1.ts delete mode 100644 owl-bot-staging/v1/test/gapic_registry_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index 2efe6c2..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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 -// -// 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'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/apigee-registry', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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 -// -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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 -// -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 1c7b46e..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Apigeeregistry: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index bfde712..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@google-cloud/apigee-registry", - "version": "0.1.0", - "description": "Apigeeregistry client for Node.js", - "repository": "googleapis/nodejs-apigeeregistry", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google apigeeregistry", - "apigeeregistry", - "provisioning", - "registry" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.59", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto deleted file mode 100644 index 9e7baee..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/provisioning_service.proto +++ /dev/null @@ -1,205 +0,0 @@ -// 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.apigeeregistry.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; -option java_multiple_files = true; -option java_outer_classname = "ProvisioningServiceProto"; -option java_package = "com.google.cloud.apigeeregistry.v1"; -option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; -option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; - -// The service that is used for managing the data plane provisioning of the -// Registry. -service Provisioning { - option (google.api.default_host) = "apigeeregistry.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Provisions instance resources for the Registry. - rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/instances" - body: "instance" - }; - option (google.api.method_signature) = "parent,instance,instance_id"; - option (google.longrunning.operation_info) = { - response_type: "Instance" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the Registry instance. - rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Gets details of a single Instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for CreateInstance. -message CreateInstanceRequest { - // Required. Parent resource of the Instance, of the form: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Identifier to assign to the Instance. Must be unique within scope of the - // parent resource. - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Instance. - Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for DeleteInstance. -message DeleteInstanceRequest { - // Required. The name of the Instance to delete. - // Format: `projects/*/locations/*/instances/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Instance" - } - ]; -} - -// Request message for GetInstance. -message GetInstanceRequest { - // Required. The name of the Instance to retrieve. - // Format: `projects/*/locations/*/instances/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Instance" - } - ]; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // The time the operation was created. - google.protobuf.Timestamp create_time = 1; - - // The time the operation finished running. - google.protobuf.Timestamp end_time = 2; - - // Server-defined resource path for the target of the operation. - string target = 3; - - // Name of the verb executed by the operation. - string verb = 4; - - // Human-readable status of the operation, if any. - string status_message = 5; - - // Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool cancellation_requested = 6; - - // API version used to start the operation. - string api_version = 7; -} - -// An Instance represents the instance resources of the Registry. -// Currently, only one instance is allowed for each project. -message Instance { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/Instance" - pattern: "projects/{project}/locations/{location}/instances/{instance}" - }; - - // State of the Instance. - enum State { - // The default value. This value is used if the state is omitted. - STATE_UNSPECIFIED = 0; - - // The Instance has not been initialized or has been deleted. - INACTIVE = 1; - - // The Instance is being created. - CREATING = 2; - - // The Instance has been created and is ready for use. - ACTIVE = 3; - - // The Instance is being updated. - UPDATING = 4; - - // The Instance is being deleted. - DELETING = 5; - - // The Instance encountered an error during a state change. - FAILED = 6; - } - - // Available configurations to provision an Instance. - message Config { - // Output only. The GCP location where the Instance resides. - string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The Customer Managed Encryption Key (CMEK) used for data encryption. - // The CMEK name should follow the format of - // `projects/([^/]+)/locations/([^/]+)/keyRings/([^/]+)/cryptoKeys/([^/]+)`, - // where the `location` must match InstanceConfig.location. - string cmek_key_name = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Format: `projects/*/locations/*/instance`. - // Currently only `locations/global` is supported. - string name = 1; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the Instance. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Extra information of Instance.State if the state is `FAILED`. - string state_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Config of the Instance. - Config config = 6 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto deleted file mode 100644 index 8411f9e..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_models.proto +++ /dev/null @@ -1,364 +0,0 @@ -// 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.apigeeregistry.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; -option java_multiple_files = true; -option java_outer_classname = "RegistryModelsProto"; -option java_package = "com.google.cloud.apigeeregistry.v1"; -option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; -option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; - -// A top-level description of an API. -// Produced by producers and are commitments to provide services. -message Api { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/Api" - pattern: "projects/{project}/locations/{location}/apis/{api}" - }; - - // Resource name. - string name = 1; - - // Human-meaningful name. - string display_name = 2; - - // A detailed description. - string description = 3; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A user-definable description of the availability of this service. - // Format: free-form, but we expect single words that describe availability, - // e.g., "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN". - string availability = 6; - - // The recommended version of the API. - // Format: `apis/{api}/versions/{version}` - string recommended_version = 7 [(google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiVersion" - }]; - - // The recommended deployment of the API. - // Format: `apis/{api}/deployments/{deployment}` - string recommended_deployment = 8 [(google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - }]; - - // Labels attach identifying metadata to resources. Identifying metadata can - // be used to filter list operations. - // - // Label keys and values can be no longer than 64 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores, and dashes. International characters are allowed. - // No more than 64 user labels can be associated with one resource (System - // labels are excluded). - // - // See https://goo.gl/xmQnxf for more information and examples of labels. - // System reserved label keys are prefixed with - // `apigeeregistry.googleapis.com/` and cannot be changed. - map labels = 9; - - // Annotations attach non-identifying metadata to resources. - // - // Annotation keys and values are less restricted than those of labels, but - // should be generally used for small values of broad interest. Larger, topic- - // specific metadata should be stored in Artifacts. - map annotations = 10; -} - -// Describes a particular version of an API. -// ApiVersions are what consumers actually use. -message ApiVersion { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/ApiVersion" - pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}" - }; - - // Resource name. - string name = 1; - - // Human-meaningful name. - string display_name = 2; - - // A detailed description. - string description = 3; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A user-definable description of the lifecycle phase of this API version. - // Format: free-form, but we expect single words that describe API maturity, - // e.g., "CONCEPT", "DESIGN", "DEVELOPMENT", "STAGING", "PRODUCTION", - // "DEPRECATED", "RETIRED". - string state = 6; - - // Labels attach identifying metadata to resources. Identifying metadata can - // be used to filter list operations. - // - // Label keys and values can be no longer than 64 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // No more than 64 user labels can be associated with one resource (System - // labels are excluded). - // - // See https://goo.gl/xmQnxf for more information and examples of labels. - // System reserved label keys are prefixed with - // `apigeeregistry.googleapis.com/` and cannot be changed. - map labels = 7; - - // Annotations attach non-identifying metadata to resources. - // - // Annotation keys and values are less restricted than those of labels, but - // should be generally used for small values of broad interest. Larger, topic- - // specific metadata should be stored in Artifacts. - map annotations = 8; -} - -// Describes a version of an API in a structured way. -// ApiSpecs provide formal descriptions that consumers can use to use a version. -// ApiSpec resources are intended to be fully-resolved descriptions of an -// ApiVersion. When specs consist of multiple files, these should be bundled -// together (e.g., in a zip archive) and stored as a unit. Multiple specs can -// exist to provide representations in different API description formats. -// Synchronization of these representations would be provided by tooling and -// background services. -message ApiSpec { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}" - }; - - // Resource name. - string name = 1; - - // A possibly-hierarchical name used to refer to the spec from other specs. - string filename = 2; - - // A detailed description. - string description = 3; - - // Output only. Immutable. The revision ID of the spec. - // A new revision is committed whenever the spec contents are changed. - // The format is an 8-character hexadecimal string. - string revision_id = 4 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Output only. Creation timestamp; when the spec resource was created. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Revision creation timestamp; when the represented revision was created. - google.protobuf.Timestamp revision_create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp: when the represented revision was last modified. - google.protobuf.Timestamp revision_update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A style (format) descriptor for this spec that is specified as a Media Type - // (https://en.wikipedia.org/wiki/Media_type). Possible values include - // `application/vnd.apigee.proto`, `application/vnd.apigee.openapi`, and - // `application/vnd.apigee.graphql`, with possible suffixes representing - // compression types. These hypothetical names are defined in the vendor tree - // defined in RFC6838 (https://tools.ietf.org/html/rfc6838) and are not final. - // Content types can specify compression. Currently only GZip compression is - // supported (indicated with "+gzip"). - string mime_type = 8; - - // Output only. The size of the spec file in bytes. If the spec is gzipped, this is the - // size of the uncompressed spec. - int32 size_bytes = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A SHA-256 hash of the spec's contents. If the spec is gzipped, this is - // the hash of the uncompressed spec. - string hash = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The original source URI of the spec (if one exists). - // This is an external location that can be used for reference purposes - // but which may not be authoritative since this external resource may - // change after the spec is retrieved. - string source_uri = 11; - - // Input only. The contents of the spec. - // Provided by API callers when specs are created or updated. - // To access the contents of a spec, use GetApiSpecContents. - bytes contents = 12 [(google.api.field_behavior) = INPUT_ONLY]; - - // Labels attach identifying metadata to resources. Identifying metadata can - // be used to filter list operations. - // - // Label keys and values can be no longer than 64 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // No more than 64 user labels can be associated with one resource (System - // labels are excluded). - // - // See https://goo.gl/xmQnxf for more information and examples of labels. - // System reserved label keys are prefixed with - // `apigeeregistry.googleapis.com/` and cannot be changed. - map labels = 14; - - // Annotations attach non-identifying metadata to resources. - // - // Annotation keys and values are less restricted than those of labels, but - // should be generally used for small values of broad interest. Larger, topic- - // specific metadata should be stored in Artifacts. - map annotations = 15; -} - -// Describes a service running at particular address that -// provides a particular version of an API. ApiDeployments have revisions which -// correspond to different configurations of a single deployment in time. -// Revision identifiers should be updated whenever the served API spec or -// endpoint address changes. -message ApiDeployment { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - pattern: "projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}" - }; - - // Resource name. - string name = 1; - - // Human-meaningful name. - string display_name = 2; - - // A detailed description. - string description = 3; - - // Output only. Immutable. The revision ID of the deployment. - // A new revision is committed whenever the deployment contents are changed. - // The format is an 8-character hexadecimal string. - string revision_id = 4 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Output only. Creation timestamp; when the deployment resource was created. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Revision creation timestamp; when the represented revision was created. - google.protobuf.Timestamp revision_create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp: when the represented revision was last modified. - google.protobuf.Timestamp revision_update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The full resource name (including revision ID) of the spec of the API being - // served by the deployment. Changes to this value will update the revision. - // Format: `apis/{api}/deployments/{deployment}` - string api_spec_revision = 8 [(google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - }]; - - // The address where the deployment is serving. Changes to this value will - // update the revision. - string endpoint_uri = 9; - - // The address of the external channel of the API (e.g., the Developer - // Portal). Changes to this value will not affect the revision. - string external_channel_uri = 10; - - // Text briefly identifying the intended audience of the API. Changes to this - // value will not affect the revision. - string intended_audience = 11; - - // Text briefly describing how to access the endpoint. Changes to this value - // will not affect the revision. - string access_guidance = 12; - - // Labels attach identifying metadata to resources. Identifying metadata can - // be used to filter list operations. - // - // Label keys and values can be no longer than 64 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // No more than 64 user labels can be associated with one resource (System - // labels are excluded). - // - // See https://goo.gl/xmQnxf for more information and examples of labels. - // System reserved label keys are prefixed with - // `apigeeregistry.googleapis.com/` and cannot be changed. - map labels = 14; - - // Annotations attach non-identifying metadata to resources. - // - // Annotation keys and values are less restricted than those of labels, but - // should be generally used for small values of broad interest. Larger, topic- - // specific metadata should be stored in Artifacts. - map annotations = 15; -} - -// Artifacts of resources. Artifacts are unique (single-value) per resource -// and are used to store metadata that is too large or numerous to be stored -// directly on the resource. Since artifacts are stored separately from parent -// resources, they should generally be used for metadata that is needed -// infrequently, i.e., not for display in primary views of the resource but -// perhaps displayed or downloaded upon request. The `ListArtifacts` method -// allows artifacts to be quickly enumerated and checked for presence without -// downloading their (potentially-large) contents. -message Artifact { - option (google.api.resource) = { - type: "apigeeregistry.googleapis.com/Artifact" - pattern: "projects/{project}/locations/{location}/artifacts/{artifact}" - pattern: "projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}" - pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}" - pattern: "projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}" - pattern: "projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}" - }; - - // Resource name. - string name = 1; - - // Output only. Creation timestamp. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Last update timestamp. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A content type specifier for the artifact. - // Content type specifiers are Media Types - // (https://en.wikipedia.org/wiki/Media_type) with a possible "schema" - // parameter that specifies a schema for the stored information. - // Content types can specify compression. Currently only GZip compression is - // supported (indicated with "+gzip"). - string mime_type = 4; - - // Output only. The size of the artifact in bytes. If the artifact is gzipped, this is - // the size of the uncompressed artifact. - int32 size_bytes = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A SHA-256 hash of the artifact's contents. If the artifact is gzipped, - // this is the hash of the uncompressed artifact. - string hash = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input only. The contents of the artifact. - // Provided by API callers when artifacts are created or replaced. - // To access the contents of an artifact, use GetArtifactContents. - bytes contents = 7 [(google.api.field_behavior) = INPUT_ONLY]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto b/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto deleted file mode 100644 index 1eec64e..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/apigeeregistry/v1/registry_service.proto +++ /dev/null @@ -1,1133 +0,0 @@ -// 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.apigeeregistry.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/httpbody.proto"; -import "google/api/resource.proto"; -import "google/cloud/apigeeregistry/v1/registry_models.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.ApigeeRegistry.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1;apigeeregistry"; -option java_multiple_files = true; -option java_outer_classname = "RegistryServiceProto"; -option java_package = "com.google.cloud.apigeeregistry.v1"; -option php_namespace = "Google\\Cloud\\ApigeeRegistry\\V1"; -option ruby_package = "Google::Cloud::ApigeeRegistry::V1"; - -// The Registry service allows teams to manage descriptions of APIs. -service Registry { - option (google.api.default_host) = "apigeeregistry.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Returns matching APIs. - rpc ListApis(ListApisRequest) returns (ListApisResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/apis" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified API. - rpc GetApi(GetApiRequest) returns (Api) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified API. - rpc CreateApi(CreateApiRequest) returns (Api) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/apis" - body: "api" - }; - option (google.api.method_signature) = "parent,api,api_id"; - } - - // Used to modify a specified API. - rpc UpdateApi(UpdateApiRequest) returns (Api) { - option (google.api.http) = { - patch: "/v1/{api.name=projects/*/locations/*/apis/*}" - body: "api" - }; - option (google.api.method_signature) = "api,update_mask"; - } - - // Removes a specified API and all of the resources that it - // owns. - rpc DeleteApi(DeleteApiRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns matching versions. - rpc ListApiVersions(ListApiVersionsRequest) returns (ListApiVersionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/apis/*}/versions" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified version. - rpc GetApiVersion(GetApiVersionRequest) returns (ApiVersion) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified version. - rpc CreateApiVersion(CreateApiVersionRequest) returns (ApiVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/apis/*}/versions" - body: "api_version" - }; - option (google.api.method_signature) = "parent,api_version,api_version_id"; - } - - // Used to modify a specified version. - rpc UpdateApiVersion(UpdateApiVersionRequest) returns (ApiVersion) { - option (google.api.http) = { - patch: "/v1/{api_version.name=projects/*/locations/*/apis/*/versions/*}" - body: "api_version" - }; - option (google.api.method_signature) = "api_version,update_mask"; - } - - // Removes a specified version and all of the resources that - // it owns. - rpc DeleteApiVersion(DeleteApiVersionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns matching specs. - rpc ListApiSpecs(ListApiSpecsRequest) returns (ListApiSpecsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified spec. - rpc GetApiSpec(GetApiSpecRequest) returns (ApiSpec) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns the contents of a specified spec. - // If specs are stored with GZip compression, the default behavior - // is to return the spec uncompressed (the mime_type response field - // indicates the exact format returned). - rpc GetApiSpecContents(GetApiSpecContentsRequest) returns (google.api.HttpBody) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:getContents" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified spec. - rpc CreateApiSpec(CreateApiSpecRequest) returns (ApiSpec) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs" - body: "api_spec" - }; - option (google.api.method_signature) = "parent,api_spec,api_spec_id"; - } - - // Used to modify a specified spec. - rpc UpdateApiSpec(UpdateApiSpecRequest) returns (ApiSpec) { - option (google.api.http) = { - patch: "/v1/{api_spec.name=projects/*/locations/*/apis/*/versions/*/specs/*}" - body: "api_spec" - }; - option (google.api.method_signature) = "api_spec,update_mask"; - } - - // Removes a specified spec, all revisions, and all child - // resources (e.g., artifacts). - rpc DeleteApiSpec(DeleteApiSpecRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Adds a tag to a specified revision of a spec. - rpc TagApiSpecRevision(TagApiSpecRevisionRequest) returns (ApiSpec) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:tagRevision" - body: "*" - }; - } - - // Lists all revisions of a spec. - // Revisions are returned in descending order of revision creation time. - rpc ListApiSpecRevisions(ListApiSpecRevisionsRequest) returns (ListApiSpecRevisionsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:listRevisions" - }; - } - - // Sets the current revision to a specified prior revision. - // Note that this creates a new revision with a new revision ID. - rpc RollbackApiSpec(RollbackApiSpecRequest) returns (ApiSpec) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:rollback" - body: "*" - }; - } - - // Deletes a revision of a spec. - rpc DeleteApiSpecRevision(DeleteApiSpecRevisionRequest) returns (ApiSpec) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*}:deleteRevision" - }; - option (google.api.method_signature) = "name"; - } - - // Returns matching deployments. - rpc ListApiDeployments(ListApiDeploymentsRequest) returns (ListApiDeploymentsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/apis/*}/deployments" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified deployment. - rpc GetApiDeployment(GetApiDeploymentRequest) returns (ApiDeployment) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified deployment. - rpc CreateApiDeployment(CreateApiDeploymentRequest) returns (ApiDeployment) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/apis/*}/deployments" - body: "api_deployment" - }; - option (google.api.method_signature) = "parent,api_deployment,api_deployment_id"; - } - - // Used to modify a specified deployment. - rpc UpdateApiDeployment(UpdateApiDeploymentRequest) returns (ApiDeployment) { - option (google.api.http) = { - patch: "/v1/{api_deployment.name=projects/*/locations/*/apis/*/deployments/*}" - body: "api_deployment" - }; - option (google.api.method_signature) = "api_deployment,update_mask"; - } - - // Removes a specified deployment, all revisions, and all - // child resources (e.g., artifacts). - rpc DeleteApiDeployment(DeleteApiDeploymentRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Adds a tag to a specified revision of a - // deployment. - rpc TagApiDeploymentRevision(TagApiDeploymentRevisionRequest) returns (ApiDeployment) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:tagRevision" - body: "*" - }; - } - - // Lists all revisions of a deployment. - // Revisions are returned in descending order of revision creation time. - rpc ListApiDeploymentRevisions(ListApiDeploymentRevisionsRequest) returns (ListApiDeploymentRevisionsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:listRevisions" - }; - } - - // Sets the current revision to a specified prior - // revision. Note that this creates a new revision with a new revision ID. - rpc RollbackApiDeployment(RollbackApiDeploymentRequest) returns (ApiDeployment) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:rollback" - body: "*" - }; - } - - // Deletes a revision of a deployment. - rpc DeleteApiDeploymentRevision(DeleteApiDeploymentRevisionRequest) returns (ApiDeployment) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*}:deleteRevision" - }; - option (google.api.method_signature) = "name"; - } - - // Returns matching artifacts. - rpc ListArtifacts(ListArtifactsRequest) returns (ListArtifactsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/artifacts" - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/apis/*}/artifacts" - } - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/artifacts" - } - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/apis/*/versions/*/specs/*}/artifacts" - } - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/apis/*/deployments/*}/artifacts" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Returns a specified artifact. - rpc GetArtifact(GetArtifactRequest) returns (Artifact) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/artifacts/*}" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Returns the contents of a specified artifact. - // If artifacts are stored with GZip compression, the default behavior - // is to return the artifact uncompressed (the mime_type response field - // indicates the exact format returned). - rpc GetArtifactContents(GetArtifactContentsRequest) returns (google.api.HttpBody) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/artifacts/*}:getContents" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}:getContents" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getContents" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getContents" - } - additional_bindings { - get: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}:getContents" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a specified artifact. - rpc CreateArtifact(CreateArtifactRequest) returns (Artifact) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/artifacts" - body: "artifact" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/apis/*}/artifacts" - body: "artifact" - } - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*}/artifacts" - body: "artifact" - } - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/apis/*/versions/*/specs/*}/artifacts" - body: "artifact" - } - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/apis/*/deployments/*}/artifacts" - body: "artifact" - } - }; - option (google.api.method_signature) = "parent,artifact,artifact_id"; - } - - // Used to replace a specified artifact. - rpc ReplaceArtifact(ReplaceArtifactRequest) returns (Artifact) { - option (google.api.http) = { - put: "/v1/{artifact.name=projects/*/locations/*/artifacts/*}" - body: "artifact" - additional_bindings { - put: "/v1/{artifact.name=projects/*/locations/*/apis/*/artifacts/*}" - body: "artifact" - } - additional_bindings { - put: "/v1/{artifact.name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" - body: "artifact" - } - additional_bindings { - put: "/v1/{artifact.name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" - body: "artifact" - } - additional_bindings { - put: "/v1/{artifact.name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" - body: "artifact" - } - }; - option (google.api.method_signature) = "artifact"; - } - - // Removes a specified artifact. - rpc DeleteArtifact(DeleteArtifactRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/artifacts/*}" - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/apis/*/artifacts/*}" - } - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/artifacts/*}" - } - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}" - } - additional_bindings { - delete: "/v1/{name=projects/*/locations/*/apis/*/deployments/*/artifacts/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for ListApis. -message ListApisRequest { - // Required. The parent, which owns this collection of APIs. - // Format: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/Api" - } - ]; - - // The maximum number of APIs to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListApis` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListApis` must match - // the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields. - string filter = 4; -} - -// Response message for ListApis. -message ListApisResponse { - // The APIs from the specified publisher. - repeated Api apis = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetApi. -message GetApiRequest { - // Required. The name of the API to retrieve. - // Format: `projects/*/locations/*/apis/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Api" - } - ]; -} - -// Request message for CreateApi. -message CreateApiRequest { - // Required. The parent, which owns this collection of APIs. - // Format: `projects/*/locations/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/Api" - } - ]; - - // Required. The API to create. - Api api = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the API, which will become the final component of - // the API's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string api_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for UpdateApi. -message UpdateApiRequest { - // Required. The API to update. - // - // The `name` field is used to identify the API to update. - // Format: `projects/*/locations/*/apis/*` - Api api = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. If omitted, all fields are updated that - // are set in the request message (fields set to default values are ignored). - // If an asterisk "*" is specified, all fields are updated, including fields - // that are unspecified/default in the request. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the API is not found, a new API will be created. - // In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for DeleteApi. -message DeleteApiRequest { - // Required. The name of the API to delete. - // Format: `projects/*/locations/*/apis/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Api" - } - ]; - - // If set to true, any child resources will also be deleted. - // (Otherwise, the request will only work if there are no child resources.) - bool force = 2; -} - -// Request message for ListApiVersions. -message ListApiVersionsRequest { - // Required. The parent, which owns this collection of versions. - // Format: `projects/*/locations/*/apis/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiVersion" - } - ]; - - // The maximum number of versions to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListApiVersions` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListApiVersions` must - // match the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields. - string filter = 4; -} - -// Response message for ListApiVersions. -message ListApiVersionsResponse { - // The versions from the specified publisher. - repeated ApiVersion api_versions = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetApiVersion. -message GetApiVersionRequest { - // Required. The name of the version to retrieve. - // Format: `projects/*/locations/*/apis/*/versions/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiVersion" - } - ]; -} - -// Request message for CreateApiVersion. -message CreateApiVersionRequest { - // Required. The parent, which owns this collection of versions. - // Format: `projects/*/locations/*/apis/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiVersion" - } - ]; - - // Required. The version to create. - ApiVersion api_version = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the version, which will become the final component of - // the version's resource name. - // - // This value should be 1-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string api_version_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for UpdateApiVersion. -message UpdateApiVersionRequest { - // Required. The version to update. - // - // The `name` field is used to identify the version to update. - // Format: `projects/*/locations/*/apis/*/versions/*` - ApiVersion api_version = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. If omitted, all fields are updated that - // are set in the request message (fields set to default values are ignored). - // If an asterisk "*" is specified, all fields are updated, including fields - // that are unspecified/default in the request. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the version is not found, a new version will be - // created. In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for DeleteApiVersion. -message DeleteApiVersionRequest { - // Required. The name of the version to delete. - // Format: `projects/*/locations/*/apis/*/versions/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiVersion" - } - ]; - - // If set to true, any child resources will also be deleted. - // (Otherwise, the request will only work if there are no child resources.) - bool force = 2; -} - -// Request message for ListApiSpecs. -message ListApiSpecsRequest { - // Required. The parent, which owns this collection of specs. - // Format: `projects/*/locations/*/apis/*/versions/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // The maximum number of specs to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListApiSpecs` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListApiSpecs` must match - // the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields except contents. - string filter = 4; -} - -// Response message for ListApiSpecs. -message ListApiSpecsResponse { - // The specs from the specified publisher. - repeated ApiSpec api_specs = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetApiSpec. -message GetApiSpecRequest { - // Required. The name of the spec to retrieve. - // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; -} - -// Request message for GetApiSpecContents. -message GetApiSpecContentsRequest { - // Required. The name of the spec whose contents should be retrieved. - // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; -} - -// Request message for CreateApiSpec. -message CreateApiSpecRequest { - // Required. The parent, which owns this collection of specs. - // Format: `projects/*/locations/*/apis/*/versions/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // Required. The spec to create. - ApiSpec api_spec = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the spec, which will become the final component of - // the spec's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string api_spec_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for UpdateApiSpec. -message UpdateApiSpecRequest { - // Required. The spec to update. - // - // The `name` field is used to identify the spec to update. - // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` - ApiSpec api_spec = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. If omitted, all fields are updated that - // are set in the request message (fields set to default values are ignored). - // If an asterisk "*" is specified, all fields are updated, including fields - // that are unspecified/default in the request. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the spec is not found, a new spec will be created. - // In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for DeleteApiSpec. -message DeleteApiSpecRequest { - // Required. The name of the spec to delete. - // Format: `projects/*/locations/*/apis/*/versions/*/specs/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // If set to true, any child resources will also be deleted. - // (Otherwise, the request will only work if there are no child resources.) - bool force = 2; -} - -// Request message for TagApiSpecRevision. -message TagApiSpecRevisionRequest { - // Required. The name of the spec to be tagged, including the revision ID. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // Required. The tag to apply. - // The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. - string tag = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ListApiSpecRevisions. -message ListApiSpecRevisionsRequest { - // Required. The name of the spec to list revisions for. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // The maximum number of revisions to return per page. - int32 page_size = 2; - - // The page token, received from a previous ListApiSpecRevisions call. - // Provide this to retrieve the subsequent page. - string page_token = 3; -} - -// Response message for ListApiSpecRevisionsResponse. -message ListApiSpecRevisionsResponse { - // The revisions of the spec. - repeated ApiSpec api_specs = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for RollbackApiSpec. -message RollbackApiSpecRequest { - // Required. The spec being rolled back. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; - - // Required. The revision ID to roll back to. - // It must be a revision of the same spec. - // - // Example: `c7cfa2a8` - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for DeleteApiSpecRevision. -message DeleteApiSpecRevisionRequest { - // Required. The name of the spec revision to be deleted, - // with a revision ID explicitly included. - // - // Example: - // `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiSpec" - } - ]; -} - -// Request message for ListApiDeployments. -message ListApiDeploymentsRequest { - // Required. The parent, which owns this collection of deployments. - // Format: `projects/*/locations/*/apis/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // The maximum number of deployments to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListApiDeployments` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListApiDeployments` must - // match the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields. - string filter = 4; -} - -// Response message for ListApiDeployments. -message ListApiDeploymentsResponse { - // The deployments from the specified publisher. - repeated ApiDeployment api_deployments = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetApiDeployment. -message GetApiDeploymentRequest { - // Required. The name of the deployment to retrieve. - // Format: `projects/*/locations/*/apis/*/deployments/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; -} - -// Request message for CreateApiDeployment. -message CreateApiDeploymentRequest { - // Required. The parent, which owns this collection of deployments. - // Format: `projects/*/locations/*/apis/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // Required. The deployment to create. - ApiDeployment api_deployment = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the deployment, which will become the final component of - // the deployment's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string api_deployment_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for UpdateApiDeployment. -message UpdateApiDeploymentRequest { - // Required. The deployment to update. - // - // The `name` field is used to identify the deployment to update. - // Format: `projects/*/locations/*/apis/*/deployments/*` - ApiDeployment api_deployment = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. If omitted, all fields are updated that - // are set in the request message (fields set to default values are ignored). - // If an asterisk "*" is specified, all fields are updated, including fields - // that are unspecified/default in the request. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the deployment is not found, a new deployment will be - // created. In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for DeleteApiDeployment. -message DeleteApiDeploymentRequest { - // Required. The name of the deployment to delete. - // Format: `projects/*/locations/*/apis/*/deployments/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // If set to true, any child resources will also be deleted. - // (Otherwise, the request will only work if there are no child resources.) - bool force = 2; -} - -// Request message for TagApiDeploymentRevision. -message TagApiDeploymentRevisionRequest { - // Required. The name of the deployment to be tagged, including the revision ID. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // Required. The tag to apply. - // The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. - string tag = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ListApiDeploymentRevisions. -message ListApiDeploymentRevisionsRequest { - // Required. The name of the deployment to list revisions for. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // The maximum number of revisions to return per page. - int32 page_size = 2; - - // The page token, received from a previous ListApiDeploymentRevisions call. - // Provide this to retrieve the subsequent page. - string page_token = 3; -} - -// Response message for ListApiDeploymentRevisionsResponse. -message ListApiDeploymentRevisionsResponse { - // The revisions of the deployment. - repeated ApiDeployment api_deployments = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for RollbackApiDeployment. -message RollbackApiDeploymentRequest { - // Required. The deployment being rolled back. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; - - // Required. The revision ID to roll back to. - // It must be a revision of the same deployment. - // - // Example: `c7cfa2a8` - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for DeleteApiDeploymentRevision. -message DeleteApiDeploymentRevisionRequest { - // Required. The name of the deployment revision to be deleted, - // with a revision ID explicitly included. - // - // Example: - // `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/ApiDeployment" - } - ]; -} - -// Request message for ListArtifacts. -message ListArtifactsRequest { - // Required. The parent, which owns this collection of artifacts. - // Format: `{parent}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/Artifact" - } - ]; - - // The maximum number of artifacts to return. - // The service may return fewer than this value. - // If unspecified, at most 50 values will be returned. - // The maximum is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListArtifacts` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListArtifacts` must - // match the call that provided the page token. - string page_token = 3; - - // An expression that can be used to filter the list. Filters use the Common - // Expression Language and can refer to all message fields except contents. - string filter = 4; -} - -// Response message for ListArtifacts. -message ListArtifactsResponse { - // The artifacts from the specified publisher. - repeated Artifact artifacts = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for GetArtifact. -message GetArtifactRequest { - // Required. The name of the artifact to retrieve. - // Format: `{parent}/artifacts/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Artifact" - } - ]; -} - -// Request message for GetArtifactContents. -message GetArtifactContentsRequest { - // Required. The name of the artifact whose contents should be retrieved. - // Format: `{parent}/artifacts/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Artifact" - } - ]; -} - -// Request message for CreateArtifact. -message CreateArtifactRequest { - // Required. The parent, which owns this collection of artifacts. - // Format: `{parent}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "apigeeregistry.googleapis.com/Artifact" - } - ]; - - // Required. The artifact to create. - Artifact artifact = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the artifact, which will become the final component of - // the artifact's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-/. - // - // Following AIP-162, IDs must not have the form of a UUID. - string artifact_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for ReplaceArtifact. -message ReplaceArtifactRequest { - // Required. The artifact to replace. - // - // The `name` field is used to identify the artifact to replace. - // Format: `{parent}/artifacts/*` - Artifact artifact = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for DeleteArtifact. -message DeleteArtifactRequest { - // Required. The name of the artifact to delete. - // Format: `{parent}/artifacts/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "apigeeregistry.googleapis.com/Artifact" - } - ]; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js deleted file mode 100644 index 4f84cd1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/provisioning.create_instance.js +++ /dev/null @@ -1,73 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, instanceId, instance) { - // [START apigeeregistry_v1_generated_Provisioning_CreateInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Parent resource of the Instance, of the form: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. Identifier to assign to the Instance. Must be unique within scope of the - * parent resource. - */ - // const instanceId = 'abc123' - /** - * Required. The Instance. - */ - // const instance = {} - - // Imports the Apigeeregistry library - const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new ProvisioningClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - }; - - // Run request - const [operation] = await apigeeregistryClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END apigeeregistry_v1_generated_Provisioning_CreateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js deleted file mode 100644 index 9e1d226..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/provisioning.delete_instance.js +++ /dev/null @@ -1,63 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Provisioning_DeleteInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Instance to delete. - * Format: `projects/* /locations/* /instances/*`. - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new ProvisioningClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await apigeeregistryClient.deleteInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteInstance(); - // [END apigeeregistry_v1_generated_Provisioning_DeleteInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js b/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js deleted file mode 100644 index 4a4355c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/provisioning.get_instance.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Provisioning_GetInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Instance to retrieve. - * Format: `projects/* /locations/* /instances/*`. - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {ProvisioningClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new ProvisioningClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END apigeeregistry_v1_generated_Provisioning_GetInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js deleted file mode 100644 index ebce3b4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_api.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, api, apiId) { - // [START apigeeregistry_v1_generated_Registry_CreateApi_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * Required. The API to create. - */ - // const api = {} - /** - * Required. The ID to use for the API, which will become the final component of - * the API's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const apiId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateApi() { - // Construct request - const request = { - parent, - api, - apiId, - }; - - // Run request - const response = await apigeeregistryClient.createApi(request); - console.log(response); - } - - callCreateApi(); - // [END apigeeregistry_v1_generated_Registry_CreateApi_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js deleted file mode 100644 index 1d0c276..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_deployment.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, apiDeployment, apiDeploymentId) { - // [START apigeeregistry_v1_generated_Registry_CreateApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - */ - // const parent = 'abc123' - /** - * Required. The deployment to create. - */ - // const apiDeployment = {} - /** - * Required. The ID to use for the deployment, which will become the final component of - * the deployment's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const apiDeploymentId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateApiDeployment() { - // Construct request - const request = { - parent, - apiDeployment, - apiDeploymentId, - }; - - // Run request - const response = await apigeeregistryClient.createApiDeployment(request); - console.log(response); - } - - callCreateApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_CreateApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js deleted file mode 100644 index 44c0e05..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_spec.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, apiSpec, apiSpecId) { - // [START apigeeregistry_v1_generated_Registry_CreateApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const parent = 'abc123' - /** - * Required. The spec to create. - */ - // const apiSpec = {} - /** - * Required. The ID to use for the spec, which will become the final component of - * the spec's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const apiSpecId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateApiSpec() { - // Construct request - const request = { - parent, - apiSpec, - apiSpecId, - }; - - // Run request - const response = await apigeeregistryClient.createApiSpec(request); - console.log(response); - } - - callCreateApiSpec(); - // [END apigeeregistry_v1_generated_Registry_CreateApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js deleted file mode 100644 index dd7182a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_api_version.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, apiVersion, apiVersionId) { - // [START apigeeregistry_v1_generated_Registry_CreateApiVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - */ - // const parent = 'abc123' - /** - * Required. The version to create. - */ - // const apiVersion = {} - /** - * Required. The ID to use for the version, which will become the final component of - * the version's resource name. - * This value should be 1-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const apiVersionId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateApiVersion() { - // Construct request - const request = { - parent, - apiVersion, - apiVersionId, - }; - - // Run request - const response = await apigeeregistryClient.createApiVersion(request); - console.log(response); - } - - callCreateApiVersion(); - // [END apigeeregistry_v1_generated_Registry_CreateApiVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js deleted file mode 100644 index 565ba5f..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.create_artifact.js +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -// -// 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'; - -function main(parent, artifact, artifactId) { - // [START apigeeregistry_v1_generated_Registry_CreateArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - */ - // const parent = 'abc123' - /** - * Required. The artifact to create. - */ - // const artifact = {} - /** - * Required. The ID to use for the artifact, which will become the final component of - * the artifact's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-/. - * Following AIP-162, IDs must not have the form of a UUID. - */ - // const artifactId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callCreateArtifact() { - // Construct request - const request = { - parent, - artifact, - artifactId, - }; - - // Run request - const response = await apigeeregistryClient.createArtifact(request); - console.log(response); - } - - callCreateArtifact(); - // [END apigeeregistry_v1_generated_Registry_CreateArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js deleted file mode 100644 index 440f846..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApi_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the API to delete. - * Format: `projects/* /locations/* /apis/*` - */ - // const name = 'abc123' - /** - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - */ - // const force = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApi() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApi(request); - console.log(response); - } - - callDeleteApi(); - // [END apigeeregistry_v1_generated_Registry_DeleteApi_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js deleted file mode 100644 index 47100ad..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment to delete. - * Format: `projects/* /locations/* /apis/* /deployments/*` - */ - // const name = 'abc123' - /** - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - */ - // const force = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiDeployment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiDeployment(request); - console.log(response); - } - - callDeleteApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js deleted file mode 100644 index b46ffa3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_deployment_revision.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment revision to be deleted, - * with a revision ID explicitly included. - * Example: - * `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiDeploymentRevision() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiDeploymentRevision(request); - console.log(response); - } - - callDeleteApiDeploymentRevision(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js deleted file mode 100644 index bf1dfe8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec to delete. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - */ - // const name = 'abc123' - /** - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - */ - // const force = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiSpec() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiSpec(request); - console.log(response); - } - - callDeleteApiSpec(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js deleted file mode 100644 index 21fb813..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_spec_revision.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec revision to be deleted, - * with a revision ID explicitly included. - * Example: - * `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiSpecRevision() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiSpecRevision(request); - console.log(response); - } - - callDeleteApiSpecRevision(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js deleted file mode 100644 index 9c59f0b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_api_version.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteApiVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the version to delete. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const name = 'abc123' - /** - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - */ - // const force = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteApiVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteApiVersion(request); - console.log(response); - } - - callDeleteApiVersion(); - // [END apigeeregistry_v1_generated_Registry_DeleteApiVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js deleted file mode 100644 index d3e2b7c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.delete_artifact.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_DeleteArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the artifact to delete. - * Format: `{parent}/artifacts/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callDeleteArtifact() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.deleteArtifact(request); - console.log(response); - } - - callDeleteArtifact(); - // [END apigeeregistry_v1_generated_Registry_DeleteArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js deleted file mode 100644 index 79568c8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApi_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the API to retrieve. - * Format: `projects/* /locations/* /apis/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApi() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApi(request); - console.log(response); - } - - callGetApi(); - // [END apigeeregistry_v1_generated_Registry_GetApi_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js deleted file mode 100644 index 2c0d9d1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_deployment.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment to retrieve. - * Format: `projects/* /locations/* /apis/* /deployments/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApiDeployment() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApiDeployment(request); - console.log(response); - } - - callGetApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_GetApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js deleted file mode 100644 index 364e0d1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec to retrieve. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApiSpec() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApiSpec(request); - console.log(response); - } - - callGetApiSpec(); - // [END apigeeregistry_v1_generated_Registry_GetApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js deleted file mode 100644 index 419e495..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_spec_contents.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApiSpecContents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec whose contents should be retrieved. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApiSpecContents() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApiSpecContents(request); - console.log(response); - } - - callGetApiSpecContents(); - // [END apigeeregistry_v1_generated_Registry_GetApiSpecContents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js deleted file mode 100644 index 384f458..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_api_version.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetApiVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the version to retrieve. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetApiVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getApiVersion(request); - console.log(response); - } - - callGetApiVersion(); - // [END apigeeregistry_v1_generated_Registry_GetApiVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js deleted file mode 100644 index fd8cf04..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the artifact to retrieve. - * Format: `{parent}/artifacts/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetArtifact() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getArtifact(request); - console.log(response); - } - - callGetArtifact(); - // [END apigeeregistry_v1_generated_Registry_GetArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js b/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js deleted file mode 100644 index 983ab0f..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.get_artifact_contents.js +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_GetArtifactContents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the artifact whose contents should be retrieved. - * Format: `{parent}/artifacts/*` - */ - // const name = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callGetArtifactContents() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await apigeeregistryClient.getArtifactContents(request); - console.log(response); - } - - callGetArtifactContents(); - // [END apigeeregistry_v1_generated_Registry_GetArtifactContents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js deleted file mode 100644 index 0f9fa67..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployment_revisions.js +++ /dev/null @@ -1,72 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment to list revisions for. - */ - // const name = 'abc123' - /** - * The maximum number of revisions to return per page. - */ - // const pageSize = 1234 - /** - * The page token, received from a previous ListApiDeploymentRevisions call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiDeploymentRevisions() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiDeploymentRevisionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiDeploymentRevisions(); - // [END apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js deleted file mode 100644 index 10a7f19..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_deployments.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListApiDeployments_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - */ - // const parent = 'abc123' - /** - * The maximum number of deployments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListApiDeployments` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListApiDeployments` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiDeployments() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiDeploymentsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiDeployments(); - // [END apigeeregistry_v1_generated_Registry_ListApiDeployments_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js deleted file mode 100644 index 1ee59f0..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_spec_revisions.js +++ /dev/null @@ -1,72 +0,0 @@ -// 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 -// -// 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'; - -function main(name) { - // [START apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec to list revisions for. - */ - // const name = 'abc123' - /** - * The maximum number of revisions to return per page. - */ - // const pageSize = 1234 - /** - * The page token, received from a previous ListApiSpecRevisions call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiSpecRevisions() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiSpecRevisionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiSpecRevisions(); - // [END apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js deleted file mode 100644 index ed3c4e9..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_specs.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListApiSpecs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const parent = 'abc123' - /** - * The maximum number of specs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListApiSpecs` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListApiSpecs` must match - * the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiSpecs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiSpecsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiSpecs(); - // [END apigeeregistry_v1_generated_Registry_ListApiSpecs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js deleted file mode 100644 index 01a6314..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_api_versions.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListApiVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - */ - // const parent = 'abc123' - /** - * The maximum number of versions to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListApiVersions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListApiVersions` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApiVersions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listApiVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApiVersions(); - // [END apigeeregistry_v1_generated_Registry_ListApiVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js deleted file mode 100644 index 9280a53..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_apis.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListApis_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - */ - // const parent = 'abc123' - /** - * The maximum number of APIs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListApis` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListApis` must match - * the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListApis() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listApisAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListApis(); - // [END apigeeregistry_v1_generated_Registry_ListApis_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js b/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js deleted file mode 100644 index c5d2c3e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.list_artifacts.js +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -// -// 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'; - -function main(parent) { - // [START apigeeregistry_v1_generated_Registry_ListArtifacts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - */ - // const parent = 'abc123' - /** - * The maximum number of artifacts to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListArtifacts` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListArtifacts` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - */ - // const filter = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callListArtifacts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await apigeeregistryClient.listArtifactsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListArtifacts(); - // [END apigeeregistry_v1_generated_Registry_ListArtifacts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js b/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js deleted file mode 100644 index af41ce8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.replace_artifact.js +++ /dev/null @@ -1,63 +0,0 @@ -// 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 -// -// 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'; - -function main(artifact) { - // [START apigeeregistry_v1_generated_Registry_ReplaceArtifact_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The artifact to replace. - * The `name` field is used to identify the artifact to replace. - * Format: `{parent}/artifacts/*` - */ - // const artifact = {} - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callReplaceArtifact() { - // Construct request - const request = { - artifact, - }; - - // Run request - const response = await apigeeregistryClient.replaceArtifact(request); - console.log(response); - } - - callReplaceArtifact(); - // [END apigeeregistry_v1_generated_Registry_ReplaceArtifact_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js deleted file mode 100644 index 022b8dc..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_deployment.js +++ /dev/null @@ -1,68 +0,0 @@ -// 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 -// -// 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'; - -function main(name, revisionId) { - // [START apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The deployment being rolled back. - */ - // const name = 'abc123' - /** - * Required. The revision ID to roll back to. - * It must be a revision of the same deployment. - * Example: `c7cfa2a8` - */ - // const revisionId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callRollbackApiDeployment() { - // Construct request - const request = { - name, - revisionId, - }; - - // Run request - const response = await apigeeregistryClient.rollbackApiDeployment(request); - console.log(response); - } - - callRollbackApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js deleted file mode 100644 index d8acd25..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.rollback_api_spec.js +++ /dev/null @@ -1,68 +0,0 @@ -// 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 -// -// 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'; - -function main(name, revisionId) { - // [START apigeeregistry_v1_generated_Registry_RollbackApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The spec being rolled back. - */ - // const name = 'abc123' - /** - * Required. The revision ID to roll back to. - * It must be a revision of the same spec. - * Example: `c7cfa2a8` - */ - // const revisionId = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callRollbackApiSpec() { - // Construct request - const request = { - name, - revisionId, - }; - - // Run request - const response = await apigeeregistryClient.rollbackApiSpec(request); - console.log(response); - } - - callRollbackApiSpec(); - // [END apigeeregistry_v1_generated_Registry_RollbackApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js deleted file mode 100644 index 5c386cc..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_deployment_revision.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name, tag) { - // [START apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the deployment to be tagged, including the revision ID. - */ - // const name = 'abc123' - /** - * Required. The tag to apply. - * The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. - */ - // const tag = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callTagApiDeploymentRevision() { - // Construct request - const request = { - name, - tag, - }; - - // Run request - const response = await apigeeregistryClient.tagApiDeploymentRevision(request); - console.log(response); - } - - callTagApiDeploymentRevision(); - // [END apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js b/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js deleted file mode 100644 index 838836c..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.tag_api_spec_revision.js +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -// -// 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'; - -function main(name, tag) { - // [START apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spec to be tagged, including the revision ID. - */ - // const name = 'abc123' - /** - * Required. The tag to apply. - * The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. - */ - // const tag = 'abc123' - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callTagApiSpecRevision() { - // Construct request - const request = { - name, - tag, - }; - - // Run request - const response = await apigeeregistryClient.tagApiSpecRevision(request); - console.log(response); - } - - callTagApiSpecRevision(); - // [END apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js deleted file mode 100644 index 8cb7e3d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.update_api.js +++ /dev/null @@ -1,75 +0,0 @@ -// 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 -// -// 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'; - -function main(api) { - // [START apigeeregistry_v1_generated_Registry_UpdateApi_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The API to update. - * The `name` field is used to identify the API to update. - * Format: `projects/* /locations/* /apis/*` - */ - // const api = {} - /** - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - */ - // const updateMask = {} - /** - * If set to true, and the API is not found, a new API will be created. - * In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callUpdateApi() { - // Construct request - const request = { - api, - }; - - // Run request - const response = await apigeeregistryClient.updateApi(request); - console.log(response); - } - - callUpdateApi(); - // [END apigeeregistry_v1_generated_Registry_UpdateApi_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js deleted file mode 100644 index 2858dd4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_deployment.js +++ /dev/null @@ -1,75 +0,0 @@ -// 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 -// -// 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'; - -function main(apiDeployment) { - // [START apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The deployment to update. - * The `name` field is used to identify the deployment to update. - * Format: `projects/* /locations/* /apis/* /deployments/*` - */ - // const apiDeployment = {} - /** - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - */ - // const updateMask = {} - /** - * If set to true, and the deployment is not found, a new deployment will be - * created. In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callUpdateApiDeployment() { - // Construct request - const request = { - apiDeployment, - }; - - // Run request - const response = await apigeeregistryClient.updateApiDeployment(request); - console.log(response); - } - - callUpdateApiDeployment(); - // [END apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js deleted file mode 100644 index 563ac37..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_spec.js +++ /dev/null @@ -1,75 +0,0 @@ -// 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 -// -// 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'; - -function main(apiSpec) { - // [START apigeeregistry_v1_generated_Registry_UpdateApiSpec_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The spec to update. - * The `name` field is used to identify the spec to update. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - */ - // const apiSpec = {} - /** - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - */ - // const updateMask = {} - /** - * If set to true, and the spec is not found, a new spec will be created. - * In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callUpdateApiSpec() { - // Construct request - const request = { - apiSpec, - }; - - // Run request - const response = await apigeeregistryClient.updateApiSpec(request); - console.log(response); - } - - callUpdateApiSpec(); - // [END apigeeregistry_v1_generated_Registry_UpdateApiSpec_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js b/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js deleted file mode 100644 index 59fb2f5..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/registry.update_api_version.js +++ /dev/null @@ -1,75 +0,0 @@ -// 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 -// -// 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'; - -function main(apiVersion) { - // [START apigeeregistry_v1_generated_Registry_UpdateApiVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The version to update. - * The `name` field is used to identify the version to update. - * Format: `projects/* /locations/* /apis/* /versions/*` - */ - // const apiVersion = {} - /** - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - */ - // const updateMask = {} - /** - * If set to true, and the version is not found, a new version will be - * created. In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Apigeeregistry library - const {RegistryClient} = require('@google-cloud/apigee-registry').v1; - - // Instantiates a client - const apigeeregistryClient = new RegistryClient(); - - async function callUpdateApiVersion() { - // Construct request - const request = { - apiVersion, - }; - - // Run request - const response = await apigeeregistryClient.updateApiVersion(request); - console.log(response); - } - - callUpdateApiVersion(); - // [END apigeeregistry_v1_generated_Registry_UpdateApiVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json deleted file mode 100644 index 56680c6..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.apigeeregistry.v1.json +++ /dev/null @@ -1,1723 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-apigeeregistry", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.apigeeregistry.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "apigeeregistry_v1_generated_Provisioning_CreateInstance_async", - "title": "Provisioning createInstance Sample", - "origin": "API_DEFINITION", - "description": " Provisions instance resources for the Registry.", - "canonical": true, - "file": "provisioning.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": ".google.cloud.apigeeregistry.v1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProvisioningClient", - "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.CreateInstance", - "service": { - "shortName": "Provisioning", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Provisioning_DeleteInstance_async", - "title": "Provisioning deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Deletes the Registry instance.", - "canonical": true, - "file": "provisioning.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProvisioningClient", - "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.DeleteInstance", - "service": { - "shortName": "Provisioning", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Provisioning_GetInstance_async", - "title": "Provisioning getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Instance.", - "canonical": true, - "file": "provisioning.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Instance", - "client": { - "shortName": "ProvisioningClient", - "fullName": "google.cloud.apigeeregistry.v1.ProvisioningClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning.GetInstance", - "service": { - "shortName": "Provisioning", - "fullName": "google.cloud.apigeeregistry.v1.Provisioning" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApis_async", - "title": "Provisioning listApis Sample", - "origin": "API_DEFINITION", - "description": " Returns matching APIs.", - "canonical": true, - "file": "registry.list_apis.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApis", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApis", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApisResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApis", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApis", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApi_async", - "title": "Provisioning getApi Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified API.", - "canonical": true, - "file": "registry.get_api.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApi", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Api", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApi", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateApi_async", - "title": "Provisioning createApi Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified API.", - "canonical": true, - "file": "registry.create_api.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApi", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "api", - "type": ".google.cloud.apigeeregistry.v1.Api" - }, - { - "name": "api_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Api", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApi", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApi_async", - "title": "Provisioning updateApi Sample", - "origin": "API_DEFINITION", - "description": " Used to modify a specified API.", - "canonical": true, - "file": "registry.update_api.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApi", - "async": true, - "parameters": [ - { - "name": "api", - "type": ".google.cloud.apigeeregistry.v1.Api" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Api", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "UpdateApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApi", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApi_async", - "title": "Provisioning deleteApi Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified API and all of the resources that it owns.", - "canonical": true, - "file": "registry.delete_api.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApi", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApi", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApi", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiVersions_async", - "title": "Provisioning listApiVersions Sample", - "origin": "API_DEFINITION", - "description": " Returns matching versions.", - "canonical": true, - "file": "registry.list_api_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiVersions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiVersions", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiVersionsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiVersions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiVersions", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApiVersion_async", - "title": "Provisioning getApiVersion Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified version.", - "canonical": true, - "file": "registry.get_api_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiVersion", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiVersion_async", - "title": "Provisioning createApiVersion Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified version.", - "canonical": true, - "file": "registry.create_api_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "api_version", - "type": ".google.cloud.apigeeregistry.v1.ApiVersion" - }, - { - "name": "api_version_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiVersion", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiVersion_async", - "title": "Provisioning updateApiVersion Sample", - "origin": "API_DEFINITION", - "description": " Used to modify a specified version.", - "canonical": true, - "file": "registry.update_api_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiVersion", - "async": true, - "parameters": [ - { - "name": "api_version", - "type": ".google.cloud.apigeeregistry.v1.ApiVersion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiVersion", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "UpdateApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiVersion", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiVersion_async", - "title": "Provisioning deleteApiVersion Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified version and all of the resources that it owns.", - "canonical": true, - "file": "registry.delete_api_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiVersion", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiVersion", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiSpecs_async", - "title": "Provisioning listApiSpecs Sample", - "origin": "API_DEFINITION", - "description": " Returns matching specs.", - "canonical": true, - "file": "registry.list_api_specs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiSpecs", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecs", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiSpecsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiSpecs", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecs", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApiSpec_async", - "title": "Provisioning getApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified spec.", - "canonical": true, - "file": "registry.get_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpec", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApiSpecContents_async", - "title": "Provisioning getApiSpecContents Sample", - "origin": "API_DEFINITION", - "description": " Returns the contents of a specified spec. If specs are stored with GZip compression, the default behavior is to return the spec uncompressed (the mime_type response field indicates the exact format returned).", - "canonical": true, - "file": "registry.get_api_spec_contents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApiSpecContents", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpecContents", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApiSpecContents", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiSpecContents", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiSpec_async", - "title": "Provisioning createApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified spec.", - "canonical": true, - "file": "registry.create_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiSpec", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "api_spec", - "type": ".google.cloud.apigeeregistry.v1.ApiSpec" - }, - { - "name": "api_spec_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiSpec_async", - "title": "Provisioning updateApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Used to modify a specified spec.", - "canonical": true, - "file": "registry.update_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiSpec", - "async": true, - "parameters": [ - { - "name": "api_spec", - "type": ".google.cloud.apigeeregistry.v1.ApiSpec" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "UpdateApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiSpec_async", - "title": "Provisioning deleteApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified spec, all revisions, and all child resources (e.g., artifacts).", - "canonical": true, - "file": "registry.delete_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpec", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async", - "title": "Provisioning tagApiSpecRevision Sample", - "origin": "API_DEFINITION", - "description": " Adds a tag to a specified revision of a spec.", - "canonical": true, - "file": "registry.tag_api_spec_revision.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TagApiSpecRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiSpecRevision", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "tag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "TagApiSpecRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiSpecRevision", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async", - "title": "Provisioning listApiSpecRevisions Sample", - "origin": "API_DEFINITION", - "description": " Lists all revisions of a spec. Revisions are returned in descending order of revision creation time.", - "canonical": true, - "file": "registry.list_api_spec_revisions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiSpecRevisions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecRevisions", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiSpecRevisionsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiSpecRevisions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiSpecRevisions", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_RollbackApiSpec_async", - "title": "Provisioning rollbackApiSpec Sample", - "origin": "API_DEFINITION", - "description": " Sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID.", - "canonical": true, - "file": "registry.rollback_api_spec.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RollbackApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiSpec", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "revision_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "RollbackApiSpec", - "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiSpec", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async", - "title": "Provisioning deleteApiSpecRevision Sample", - "origin": "API_DEFINITION", - "description": " Deletes a revision of a spec.", - "canonical": true, - "file": "registry.delete_api_spec_revision.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiSpecRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpecRevision", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiSpec", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiSpecRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiSpecRevision", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiDeployments_async", - "title": "Provisioning listApiDeployments Sample", - "origin": "API_DEFINITION", - "description": " Returns matching deployments.", - "canonical": true, - "file": "registry.list_api_deployments.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiDeployments", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeployments", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiDeploymentsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiDeployments", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeployments", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetApiDeployment_async", - "title": "Provisioning getApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified deployment.", - "canonical": true, - "file": "registry.get_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateApiDeployment_async", - "title": "Provisioning createApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified deployment.", - "canonical": true, - "file": "registry.create_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiDeployment", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "api_deployment", - "type": ".google.cloud.apigeeregistry.v1.ApiDeployment" - }, - { - "name": "api_deployment_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async", - "title": "Provisioning updateApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Used to modify a specified deployment.", - "canonical": true, - "file": "registry.update_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiDeployment", - "async": true, - "parameters": [ - { - "name": "api_deployment", - "type": ".google.cloud.apigeeregistry.v1.ApiDeployment" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "UpdateApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.UpdateApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async", - "title": "Provisioning deleteApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified deployment, all revisions, and all child resources (e.g., artifacts).", - "canonical": true, - "file": "registry.delete_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async", - "title": "Provisioning tagApiDeploymentRevision Sample", - "origin": "API_DEFINITION", - "description": " Adds a tag to a specified revision of a deployment.", - "canonical": true, - "file": "registry.tag_api_deployment_revision.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TagApiDeploymentRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiDeploymentRevision", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "tag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "TagApiDeploymentRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.TagApiDeploymentRevision", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async", - "title": "Provisioning listApiDeploymentRevisions Sample", - "origin": "API_DEFINITION", - "description": " Lists all revisions of a deployment. Revisions are returned in descending order of revision creation time.", - "canonical": true, - "file": "registry.list_api_deployment_revisions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListApiDeploymentRevisions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeploymentRevisions", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListApiDeploymentRevisions", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListApiDeploymentRevisions", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async", - "title": "Provisioning rollbackApiDeployment Sample", - "origin": "API_DEFINITION", - "description": " Sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID.", - "canonical": true, - "file": "registry.rollback_api_deployment.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RollbackApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiDeployment", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "revision_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "RollbackApiDeployment", - "fullName": "google.cloud.apigeeregistry.v1.Registry.RollbackApiDeployment", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async", - "title": "Provisioning deleteApiDeploymentRevision Sample", - "origin": "API_DEFINITION", - "description": " Deletes a revision of a deployment.", - "canonical": true, - "file": "registry.delete_api_deployment_revision.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteApiDeploymentRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeploymentRevision", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ApiDeployment", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteApiDeploymentRevision", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteApiDeploymentRevision", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ListArtifacts_async", - "title": "Provisioning listArtifacts Sample", - "origin": "API_DEFINITION", - "description": " Returns matching artifacts.", - "canonical": true, - "file": "registry.list_artifacts.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListArtifacts", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListArtifacts", - "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" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.ListArtifactsResponse", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ListArtifacts", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ListArtifacts", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetArtifact_async", - "title": "Provisioning getArtifact Sample", - "origin": "API_DEFINITION", - "description": " Returns a specified artifact.", - "canonical": true, - "file": "registry.get_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifact", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Artifact", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifact", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_GetArtifactContents_async", - "title": "Provisioning getArtifactContents Sample", - "origin": "API_DEFINITION", - "description": " Returns the contents of a specified artifact. If artifacts are stored with GZip compression, the default behavior is to return the artifact uncompressed (the mime_type response field indicates the exact format returned).", - "canonical": true, - "file": "registry.get_artifact_contents.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetArtifactContents", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifactContents", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "GetArtifactContents", - "fullName": "google.cloud.apigeeregistry.v1.Registry.GetArtifactContents", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_CreateArtifact_async", - "title": "Provisioning createArtifact Sample", - "origin": "API_DEFINITION", - "description": " Creates a specified artifact.", - "canonical": true, - "file": "registry.create_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateArtifact", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "artifact", - "type": ".google.cloud.apigeeregistry.v1.Artifact" - }, - { - "name": "artifact_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Artifact", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "CreateArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.CreateArtifact", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_ReplaceArtifact_async", - "title": "Provisioning replaceArtifact Sample", - "origin": "API_DEFINITION", - "description": " Used to replace a specified artifact.", - "canonical": true, - "file": "registry.replace_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ReplaceArtifact", - "async": true, - "parameters": [ - { - "name": "artifact", - "type": ".google.cloud.apigeeregistry.v1.Artifact" - } - ], - "resultType": ".google.cloud.apigeeregistry.v1.Artifact", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "ReplaceArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.ReplaceArtifact", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - }, - { - "regionTag": "apigeeregistry_v1_generated_Registry_DeleteArtifact_async", - "title": "Provisioning deleteArtifact Sample", - "origin": "API_DEFINITION", - "description": " Removes a specified artifact.", - "canonical": true, - "file": "registry.delete_artifact.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteArtifact", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RegistryClient", - "fullName": "google.cloud.apigeeregistry.v1.RegistryClient" - }, - "method": { - "shortName": "DeleteArtifact", - "fullName": "google.cloud.apigeeregistry.v1.Registry.DeleteArtifact", - "service": { - "shortName": "Registry", - "fullName": "google.cloud.apigeeregistry.v1.Registry" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 9fa6563..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -// 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 -// -// 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. ** - -import * as v1 from './v1'; -const ProvisioningClient = v1.ProvisioningClient; -type ProvisioningClient = v1.ProvisioningClient; -const RegistryClient = v1.RegistryClient; -type RegistryClient = v1.RegistryClient; -export {v1, ProvisioningClient, RegistryClient}; -export default {v1, ProvisioningClient, RegistryClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 783049f..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,445 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.apigeeregistry.v1", - "libraryPackage": "@google-cloud/apigee-registry", - "services": { - "Provisioning": { - "clients": { - "grpc": { - "libraryClient": "ProvisioningClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ProvisioningClient", - "rpcs": { - "GetInstance": { - "methods": [ - "getInstance" - ] - }, - "CreateInstance": { - "methods": [ - "createInstance" - ] - }, - "DeleteInstance": { - "methods": [ - "deleteInstance" - ] - } - } - } - } - }, - "Registry": { - "clients": { - "grpc": { - "libraryClient": "RegistryClient", - "rpcs": { - "GetApi": { - "methods": [ - "getApi" - ] - }, - "CreateApi": { - "methods": [ - "createApi" - ] - }, - "UpdateApi": { - "methods": [ - "updateApi" - ] - }, - "DeleteApi": { - "methods": [ - "deleteApi" - ] - }, - "GetApiVersion": { - "methods": [ - "getApiVersion" - ] - }, - "CreateApiVersion": { - "methods": [ - "createApiVersion" - ] - }, - "UpdateApiVersion": { - "methods": [ - "updateApiVersion" - ] - }, - "DeleteApiVersion": { - "methods": [ - "deleteApiVersion" - ] - }, - "GetApiSpec": { - "methods": [ - "getApiSpec" - ] - }, - "GetApiSpecContents": { - "methods": [ - "getApiSpecContents" - ] - }, - "CreateApiSpec": { - "methods": [ - "createApiSpec" - ] - }, - "UpdateApiSpec": { - "methods": [ - "updateApiSpec" - ] - }, - "DeleteApiSpec": { - "methods": [ - "deleteApiSpec" - ] - }, - "TagApiSpecRevision": { - "methods": [ - "tagApiSpecRevision" - ] - }, - "RollbackApiSpec": { - "methods": [ - "rollbackApiSpec" - ] - }, - "DeleteApiSpecRevision": { - "methods": [ - "deleteApiSpecRevision" - ] - }, - "GetApiDeployment": { - "methods": [ - "getApiDeployment" - ] - }, - "CreateApiDeployment": { - "methods": [ - "createApiDeployment" - ] - }, - "UpdateApiDeployment": { - "methods": [ - "updateApiDeployment" - ] - }, - "DeleteApiDeployment": { - "methods": [ - "deleteApiDeployment" - ] - }, - "TagApiDeploymentRevision": { - "methods": [ - "tagApiDeploymentRevision" - ] - }, - "RollbackApiDeployment": { - "methods": [ - "rollbackApiDeployment" - ] - }, - "DeleteApiDeploymentRevision": { - "methods": [ - "deleteApiDeploymentRevision" - ] - }, - "GetArtifact": { - "methods": [ - "getArtifact" - ] - }, - "GetArtifactContents": { - "methods": [ - "getArtifactContents" - ] - }, - "CreateArtifact": { - "methods": [ - "createArtifact" - ] - }, - "ReplaceArtifact": { - "methods": [ - "replaceArtifact" - ] - }, - "DeleteArtifact": { - "methods": [ - "deleteArtifact" - ] - }, - "ListApis": { - "methods": [ - "listApis", - "listApisStream", - "listApisAsync" - ] - }, - "ListApiVersions": { - "methods": [ - "listApiVersions", - "listApiVersionsStream", - "listApiVersionsAsync" - ] - }, - "ListApiSpecs": { - "methods": [ - "listApiSpecs", - "listApiSpecsStream", - "listApiSpecsAsync" - ] - }, - "ListApiSpecRevisions": { - "methods": [ - "listApiSpecRevisions", - "listApiSpecRevisionsStream", - "listApiSpecRevisionsAsync" - ] - }, - "ListApiDeployments": { - "methods": [ - "listApiDeployments", - "listApiDeploymentsStream", - "listApiDeploymentsAsync" - ] - }, - "ListApiDeploymentRevisions": { - "methods": [ - "listApiDeploymentRevisions", - "listApiDeploymentRevisionsStream", - "listApiDeploymentRevisionsAsync" - ] - }, - "ListArtifacts": { - "methods": [ - "listArtifacts", - "listArtifactsStream", - "listArtifactsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "RegistryClient", - "rpcs": { - "GetApi": { - "methods": [ - "getApi" - ] - }, - "CreateApi": { - "methods": [ - "createApi" - ] - }, - "UpdateApi": { - "methods": [ - "updateApi" - ] - }, - "DeleteApi": { - "methods": [ - "deleteApi" - ] - }, - "GetApiVersion": { - "methods": [ - "getApiVersion" - ] - }, - "CreateApiVersion": { - "methods": [ - "createApiVersion" - ] - }, - "UpdateApiVersion": { - "methods": [ - "updateApiVersion" - ] - }, - "DeleteApiVersion": { - "methods": [ - "deleteApiVersion" - ] - }, - "GetApiSpec": { - "methods": [ - "getApiSpec" - ] - }, - "GetApiSpecContents": { - "methods": [ - "getApiSpecContents" - ] - }, - "CreateApiSpec": { - "methods": [ - "createApiSpec" - ] - }, - "UpdateApiSpec": { - "methods": [ - "updateApiSpec" - ] - }, - "DeleteApiSpec": { - "methods": [ - "deleteApiSpec" - ] - }, - "TagApiSpecRevision": { - "methods": [ - "tagApiSpecRevision" - ] - }, - "RollbackApiSpec": { - "methods": [ - "rollbackApiSpec" - ] - }, - "DeleteApiSpecRevision": { - "methods": [ - "deleteApiSpecRevision" - ] - }, - "GetApiDeployment": { - "methods": [ - "getApiDeployment" - ] - }, - "CreateApiDeployment": { - "methods": [ - "createApiDeployment" - ] - }, - "UpdateApiDeployment": { - "methods": [ - "updateApiDeployment" - ] - }, - "DeleteApiDeployment": { - "methods": [ - "deleteApiDeployment" - ] - }, - "TagApiDeploymentRevision": { - "methods": [ - "tagApiDeploymentRevision" - ] - }, - "RollbackApiDeployment": { - "methods": [ - "rollbackApiDeployment" - ] - }, - "DeleteApiDeploymentRevision": { - "methods": [ - "deleteApiDeploymentRevision" - ] - }, - "GetArtifact": { - "methods": [ - "getArtifact" - ] - }, - "GetArtifactContents": { - "methods": [ - "getArtifactContents" - ] - }, - "CreateArtifact": { - "methods": [ - "createArtifact" - ] - }, - "ReplaceArtifact": { - "methods": [ - "replaceArtifact" - ] - }, - "DeleteArtifact": { - "methods": [ - "deleteArtifact" - ] - }, - "ListApis": { - "methods": [ - "listApis", - "listApisStream", - "listApisAsync" - ] - }, - "ListApiVersions": { - "methods": [ - "listApiVersions", - "listApiVersionsStream", - "listApiVersionsAsync" - ] - }, - "ListApiSpecs": { - "methods": [ - "listApiSpecs", - "listApiSpecsStream", - "listApiSpecsAsync" - ] - }, - "ListApiSpecRevisions": { - "methods": [ - "listApiSpecRevisions", - "listApiSpecRevisionsStream", - "listApiSpecRevisionsAsync" - ] - }, - "ListApiDeployments": { - "methods": [ - "listApiDeployments", - "listApiDeploymentsStream", - "listApiDeploymentsAsync" - ] - }, - "ListApiDeploymentRevisions": { - "methods": [ - "listApiDeploymentRevisions", - "listApiDeploymentRevisionsStream", - "listApiDeploymentRevisionsAsync" - ] - }, - "ListArtifacts": { - "methods": [ - "listArtifacts", - "listArtifactsStream", - "listArtifactsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index 03a07e1..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// 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 -// -// 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. ** - -export {ProvisioningClient} from './provisioning_client'; -export {RegistryClient} from './registry_client'; diff --git a/owl-bot-staging/v1/src/v1/provisioning_client.ts b/owl-bot-staging/v1/src/v1/provisioning_client.ts deleted file mode 100644 index 729abd9..0000000 --- a/owl-bot-staging/v1/src/v1/provisioning_client.ts +++ /dev/null @@ -1,1737 +0,0 @@ -// 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 -// -// 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/provisioning_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './provisioning_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The service that is used for managing the data plane provisioning of the - * Registry. - * @class - * @memberof v1 - */ -export class ProvisioningClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - provisioningStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProvisioningClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new ProvisioningClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProvisioningClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - apiPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}' - ), - apiDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}' - ), - apiSpecPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}' - ), - apiVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectLocationApiArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}' - ), - projectLocationApiDeploymentArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}' - ), - projectLocationApiVersionArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}' - ), - projectLocationApiVersionSpecArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}' - ), - projectLocationArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/artifacts/{artifact}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/apis/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/instances/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/runtime}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/apis/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/apis/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/instances/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/runtime}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.apigeeregistry.v1.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.apigeeregistry.v1.OperationMetadata') as gax.protobuf.Type; - const deleteInstanceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInstanceMetadata = protoFilesRoot.lookup( - '.google.cloud.apigeeregistry.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - deleteInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInstanceResponse.decode.bind(deleteInstanceResponse), - deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.apigeeregistry.v1.Provisioning', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.provisioningStub) { - return this.provisioningStub; - } - - // Put together the "service stub" for - // google.cloud.apigeeregistry.v1.Provisioning. - this.provisioningStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.apigeeregistry.v1.Provisioning') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.apigeeregistry.v1.Provisioning, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const provisioningStubMethods = - ['createInstance', 'deleteInstance', 'getInstance']; - for (const methodName of provisioningStubMethods) { - const callPromise = this.provisioningStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.provisioningStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'apigeeregistry.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'apigeeregistry.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets details of a single Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Instance to retrieve. - * Format: `projects/* /locations/* /instances/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Instance]{@link google.cloud.apigeeregistry.v1.Instance}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.get_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_GetInstance_async - */ - getInstance( - request?: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IInstance, - protos.google.cloud.apigeeregistry.v1.IGetInstanceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getInstance(request, options, callback); - } - -/** - * Provisions instance resources for the Registry. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent resource of the Instance, of the form: `projects/* /locations/*` - * @param {string} request.instanceId - * Required. Identifier to assign to the Instance. Must be unique within scope of the - * parent resource. - * @param {google.cloud.apigeeregistry.v1.Instance} request.instance - * Required. The Instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.create_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_CreateInstance_async - */ - createInstance( - request?: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.cloud.apigeeregistry.v1.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.create_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the Registry instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Instance to delete. - * Format: `projects/* /locations/* /instances/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.delete_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteInstance(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/provisioning.delete_instance.js - * region_tag:apigeeregistry_v1_generated_Provisioning_DeleteInstance_async - */ - async checkDeleteInstanceProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified api resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @returns {string} Resource name string. - */ - apiPath(project:string,location:string,api:string) { - return this.pathTemplates.apiPathTemplate.render({ - project: project, - location: location, - api: api, - }); - } - - /** - * Parse the project from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).project; - } - - /** - * Parse the location from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).location; - } - - /** - * Parse the api from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).api; - } - - /** - * Return a fully-qualified apiDeployment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} deployment - * @returns {string} Resource name string. - */ - apiDeploymentPath(project:string,location:string,api:string,deployment:string) { - return this.pathTemplates.apiDeploymentPathTemplate.render({ - project: project, - location: location, - api: api, - deployment: deployment, - }); - } - - /** - * Parse the project from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).project; - } - - /** - * Parse the location from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).location; - } - - /** - * Parse the api from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).api; - } - - /** - * Parse the deployment from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).deployment; - } - - /** - * Return a fully-qualified apiSpec resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} spec - * @returns {string} Resource name string. - */ - apiSpecPath(project:string,location:string,api:string,version:string,spec:string) { - return this.pathTemplates.apiSpecPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - spec: spec, - }); - } - - /** - * Parse the project from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).project; - } - - /** - * Parse the location from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).location; - } - - /** - * Parse the api from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).api; - } - - /** - * Parse the version from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the version. - */ - matchVersionFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).version; - } - - /** - * Parse the spec from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the spec. - */ - matchSpecFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).spec; - } - - /** - * Return a fully-qualified apiVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @returns {string} Resource name string. - */ - apiVersionPath(project:string,location:string,api:string,version:string) { - return this.pathTemplates.apiVersionPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - }); - } - - /** - * Parse the project from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).project; - } - - /** - * Parse the location from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).location; - } - - /** - * Parse the api from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).api; - } - - /** - * Parse the version from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the version. - */ - matchVersionFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).version; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified projectLocationApiArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiArtifactPath(project:string,location:string,api:string,artifact:string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).api; - } - - /** - * Parse the artifact from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiDeploymentArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} deployment - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiDeploymentArtifactPath(project:string,location:string,api:string,deployment:string,artifact:string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - deployment: deployment, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).api; - } - - /** - * Parse the deployment from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).deployment; - } - - /** - * Parse the artifact from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiVersionArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiVersionArtifactPath(project:string,location:string,api:string,version:string,artifact:string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).api; - } - - /** - * Parse the version from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).version; - } - - /** - * Parse the artifact from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiVersionSpecArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} spec - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiVersionSpecArtifactPath(project:string,location:string,api:string,version:string,spec:string,artifact:string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - spec: spec, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).api; - } - - /** - * Parse the version from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).version; - } - - /** - * Parse the spec from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the spec. - */ - matchSpecFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).spec; - } - - /** - * Parse the artifact from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationArtifactPath(project:string,location:string,artifact:string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.render({ - project: project, - location: location, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).project; - } - - /** - * Parse the location from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).location; - } - - /** - * Parse the artifact from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).artifact; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.provisioningStub && !this._terminated) { - return this.provisioningStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/provisioning_client_config.json b/owl-bot-staging/v1/src/v1/provisioning_client_config.json deleted file mode 100644 index 2e37ea8..0000000 --- a/owl-bot-staging/v1/src/v1/provisioning_client_config.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.cloud.apigeeregistry.v1.Provisioning": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/provisioning_proto_list.json b/owl-bot-staging/v1/src/v1/provisioning_proto_list.json deleted file mode 100644 index 4fdc846..0000000 --- a/owl-bot-staging/v1/src/v1/provisioning_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/apigeeregistry/v1/provisioning_service.proto", - "../../protos/google/cloud/apigeeregistry/v1/registry_models.proto", - "../../protos/google/cloud/apigeeregistry/v1/registry_service.proto" -] diff --git a/owl-bot-staging/v1/src/v1/registry_client.ts b/owl-bot-staging/v1/src/v1/registry_client.ts deleted file mode 100644 index 3fe4cd1..0000000 --- a/owl-bot-staging/v1/src/v1/registry_client.ts +++ /dev/null @@ -1,4842 +0,0 @@ -// 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 -// -// 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/registry_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './registry_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Registry service allows teams to manage descriptions of APIs. - * @class - * @memberof v1 - */ -export class RegistryClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - registryStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RegistryClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new RegistryClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RegistryClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - apiPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}' - ), - apiDeploymentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}' - ), - apiSpecPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}' - ), - apiVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectLocationApiArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/artifacts/{artifact}' - ), - projectLocationApiDeploymentArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/deployments/{deployment}/artifacts/{artifact}' - ), - projectLocationApiVersionArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/artifacts/{artifact}' - ), - projectLocationApiVersionSpecArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}/artifacts/{artifact}' - ), - projectLocationArtifactPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/artifacts/{artifact}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listApis: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apis'), - listApiVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiVersions'), - listApiSpecs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiSpecs'), - listApiSpecRevisions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiSpecs'), - listApiDeployments: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiDeployments'), - listApiDeploymentRevisions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'apiDeployments'), - listArtifacts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'artifacts') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.apigeeregistry.v1.Registry', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.registryStub) { - return this.registryStub; - } - - // Put together the "service stub" for - // google.cloud.apigeeregistry.v1.Registry. - this.registryStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.apigeeregistry.v1.Registry') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.apigeeregistry.v1.Registry, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const registryStubMethods = - ['listApis', 'getApi', 'createApi', 'updateApi', 'deleteApi', 'listApiVersions', 'getApiVersion', 'createApiVersion', 'updateApiVersion', 'deleteApiVersion', 'listApiSpecs', 'getApiSpec', 'getApiSpecContents', 'createApiSpec', 'updateApiSpec', 'deleteApiSpec', 'tagApiSpecRevision', 'listApiSpecRevisions', 'rollbackApiSpec', 'deleteApiSpecRevision', 'listApiDeployments', 'getApiDeployment', 'createApiDeployment', 'updateApiDeployment', 'deleteApiDeployment', 'tagApiDeploymentRevision', 'listApiDeploymentRevisions', 'rollbackApiDeployment', 'deleteApiDeploymentRevision', 'listArtifacts', 'getArtifact', 'getArtifactContents', 'createArtifact', 'replaceArtifact', 'deleteArtifact']; - for (const methodName of registryStubMethods) { - const callPromise = this.registryStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.registryStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'apigeeregistry.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'apigeeregistry.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns a specified API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the API to retrieve. - * Format: `projects/* /locations/* /apis/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApi_async - */ - getApi( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|undefined, {}|undefined - ]>; - getApi( - request: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, - {}|null|undefined>): void; - getApi( - request: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, - {}|null|undefined>): void; - getApi( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IGetApiRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApi(request, options, callback); - } -/** - * Creates a specified API. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - * @param {google.cloud.apigeeregistry.v1.Api} request.api - * Required. The API to create. - * @param {string} request.apiId - * Required. The ID to use for the API, which will become the final component of - * the API's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_api.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateApi_async - */ - createApi( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|undefined, {}|undefined - ]>; - createApi( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, - {}|null|undefined>): void; - createApi( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, - {}|null|undefined>): void; - createApi( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.ICreateApiRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createApi(request, options, callback); - } -/** - * Used to modify a specified API. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.Api} request.api - * Required. The API to update. - * - * The `name` field is used to identify the API to update. - * Format: `projects/* /locations/* /apis/*` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - * @param {boolean} request.allowMissing - * If set to true, and the API is not found, a new API will be created. - * In this situation, `update_mask` is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.update_api.js - * region_tag:apigeeregistry_v1_generated_Registry_UpdateApi_async - */ - updateApi( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|undefined, {}|undefined - ]>; - updateApi( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, - {}|null|undefined>): void; - updateApi( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, - {}|null|undefined>): void; - updateApi( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi, - protos.google.cloud.apigeeregistry.v1.IUpdateApiRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'api.name': request.api!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateApi(request, options, callback); - } -/** - * Removes a specified API and all of the resources that it - * owns. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the API to delete. - * Format: `projects/* /locations/* /apis/*` - * @param {boolean} request.force - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApi_async - */ - deleteApi( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|undefined, {}|undefined - ]>; - deleteApi( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, - {}|null|undefined>): void; - deleteApi( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, - {}|null|undefined>): void; - deleteApi( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApi(request, options, callback); - } -/** - * Returns a specified version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the version to retrieve. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api_version.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApiVersion_async - */ - getApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|undefined, {}|undefined - ]>; - getApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, - {}|null|undefined>): void; - getApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, - {}|null|undefined>): void; - getApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IGetApiVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApiVersion(request, options, callback); - } -/** - * Creates a specified version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - * @param {google.cloud.apigeeregistry.v1.ApiVersion} request.apiVersion - * Required. The version to create. - * @param {string} request.apiVersionId - * Required. The ID to use for the version, which will become the final component of - * the version's resource name. - * - * This value should be 1-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_api_version.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateApiVersion_async - */ - createApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|undefined, {}|undefined - ]>; - createApiVersion( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, - {}|null|undefined>): void; - createApiVersion( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, - {}|null|undefined>): void; - createApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.ICreateApiVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createApiVersion(request, options, callback); - } -/** - * Used to modify a specified version. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.ApiVersion} request.apiVersion - * Required. The version to update. - * - * The `name` field is used to identify the version to update. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - * @param {boolean} request.allowMissing - * If set to true, and the version is not found, a new version will be - * created. In this situation, `update_mask` is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.update_api_version.js - * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiVersion_async - */ - updateApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|undefined, {}|undefined - ]>; - updateApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, - {}|null|undefined>): void; - updateApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, - {}|null|undefined>): void; - updateApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion, - protos.google.cloud.apigeeregistry.v1.IUpdateApiVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'api_version.name': request.apiVersion!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateApiVersion(request, options, callback); - } -/** - * Removes a specified version and all of the resources that - * it owns. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the version to delete. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {boolean} request.force - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_version.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiVersion_async - */ - deleteApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|undefined, {}|undefined - ]>; - deleteApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiVersion( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiVersion( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiVersion(request, options, callback); - } -/** - * Returns a specified spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to retrieve. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApiSpec_async - */ - getApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|undefined, {}|undefined - ]>; - getApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, - {}|null|undefined>): void; - getApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, - {}|null|undefined>): void; - getApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApiSpec(request, options, callback); - } -/** - * Returns the contents of a specified spec. - * If specs are stored with GZip compression, the default behavior - * is to return the spec uncompressed (the mime_type response field - * indicates the exact format returned). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec whose contents should be retrieved. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api_spec_contents.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApiSpecContents_async - */ - getApiSpecContents( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|undefined, {}|undefined - ]>; - getApiSpecContents( - request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, - {}|null|undefined>): void; - getApiSpecContents( - request: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, - {}|null|undefined>): void; - getApiSpecContents( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetApiSpecContentsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApiSpecContents(request, options, callback); - } -/** - * Creates a specified spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {google.cloud.apigeeregistry.v1.ApiSpec} request.apiSpec - * Required. The spec to create. - * @param {string} request.apiSpecId - * Required. The ID to use for the spec, which will become the final component of - * the spec's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateApiSpec_async - */ - createApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|undefined, {}|undefined - ]>; - createApiSpec( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, - {}|null|undefined>): void; - createApiSpec( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, - {}|null|undefined>): void; - createApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ICreateApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createApiSpec(request, options, callback); - } -/** - * Used to modify a specified spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.ApiSpec} request.apiSpec - * Required. The spec to update. - * - * The `name` field is used to identify the spec to update. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - * @param {boolean} request.allowMissing - * If set to true, and the spec is not found, a new spec will be created. - * In this situation, `update_mask` is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.update_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiSpec_async - */ - updateApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|undefined, {}|undefined - ]>; - updateApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, - {}|null|undefined>): void; - updateApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, - {}|null|undefined>): void; - updateApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IUpdateApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'api_spec.name': request.apiSpec!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateApiSpec(request, options, callback); - } -/** - * Removes a specified spec, all revisions, and all child - * resources (e.g., artifacts). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to delete. - * Format: `projects/* /locations/* /apis/* /versions/* /specs/*` - * @param {boolean} request.force - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiSpec_async - */ - deleteApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|undefined, {}|undefined - ]>; - deleteApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, - {}|null|undefined>): void; - deleteApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, - {}|null|undefined>): void; - deleteApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiSpec(request, options, callback); - } -/** - * Adds a tag to a specified revision of a spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to be tagged, including the revision ID. - * @param {string} request.tag - * Required. The tag to apply. - * The tag should be at most 40 characters, and match `{@link a-z0-9-|a-z}{3,39}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.tag_api_spec_revision.js - * region_tag:apigeeregistry_v1_generated_Registry_TagApiSpecRevision_async - */ - tagApiSpecRevision( - request?: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|undefined, {}|undefined - ]>; - tagApiSpecRevision( - request: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): void; - tagApiSpecRevision( - request: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): void; - tagApiSpecRevision( - request?: protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.ITagApiSpecRevisionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.tagApiSpecRevision(request, options, callback); - } -/** - * Sets the current revision to a specified prior revision. - * Note that this creates a new revision with a new revision ID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The spec being rolled back. - * @param {string} request.revisionId - * Required. The revision ID to roll back to. - * It must be a revision of the same spec. - * - * Example: `c7cfa2a8` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.rollback_api_spec.js - * region_tag:apigeeregistry_v1_generated_Registry_RollbackApiSpec_async - */ - rollbackApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|undefined, {}|undefined - ]>; - rollbackApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, - {}|null|undefined>): void; - rollbackApiSpec( - request: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, - {}|null|undefined>): void; - rollbackApiSpec( - request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IRollbackApiSpecRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.rollbackApiSpec(request, options, callback); - } -/** - * Deletes a revision of a spec. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec revision to be deleted, - * with a revision ID explicitly included. - * - * Example: - * `projects/sample/locations/global/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_spec_revision.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiSpecRevision_async - */ - deleteApiSpecRevision( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|undefined, {}|undefined - ]>; - deleteApiSpecRevision( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiSpecRevision( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiSpecRevision( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec, - protos.google.cloud.apigeeregistry.v1.IDeleteApiSpecRevisionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiSpecRevision(request, options, callback); - } -/** - * Returns a specified deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to retrieve. - * Format: `projects/* /locations/* /apis/* /deployments/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_GetApiDeployment_async - */ - getApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|undefined, {}|undefined - ]>; - getApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - getApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - getApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IGetApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getApiDeployment(request, options, callback); - } -/** - * Creates a specified deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - * @param {google.cloud.apigeeregistry.v1.ApiDeployment} request.apiDeployment - * Required. The deployment to create. - * @param {string} request.apiDeploymentId - * Required. The ID to use for the deployment, which will become the final component of - * the deployment's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateApiDeployment_async - */ - createApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|undefined, {}|undefined - ]>; - createApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - createApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - createApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ICreateApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createApiDeployment(request, options, callback); - } -/** - * Used to modify a specified deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.ApiDeployment} request.apiDeployment - * Required. The deployment to update. - * - * The `name` field is used to identify the deployment to update. - * Format: `projects/* /locations/* /apis/* /deployments/*` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If omitted, all fields are updated that - * are set in the request message (fields set to default values are ignored). - * If an asterisk "*" is specified, all fields are updated, including fields - * that are unspecified/default in the request. - * @param {boolean} request.allowMissing - * If set to true, and the deployment is not found, a new deployment will be - * created. In this situation, `update_mask` is ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.update_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_UpdateApiDeployment_async - */ - updateApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|undefined, {}|undefined - ]>; - updateApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - updateApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - updateApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IUpdateApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'api_deployment.name': request.apiDeployment!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateApiDeployment(request, options, callback); - } -/** - * Removes a specified deployment, all revisions, and all - * child resources (e.g., artifacts). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to delete. - * Format: `projects/* /locations/* /apis/* /deployments/*` - * @param {boolean} request.force - * If set to true, any child resources will also be deleted. - * (Otherwise, the request will only work if there are no child resources.) - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiDeployment_async - */ - deleteApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|undefined, {}|undefined - ]>; - deleteApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - deleteApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - deleteApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiDeployment(request, options, callback); - } -/** - * Adds a tag to a specified revision of a - * deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to be tagged, including the revision ID. - * @param {string} request.tag - * Required. The tag to apply. - * The tag should be at most 40 characters, and match `{@link a-z0-9-|a-z}{3,39}`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.tag_api_deployment_revision.js - * region_tag:apigeeregistry_v1_generated_Registry_TagApiDeploymentRevision_async - */ - tagApiDeploymentRevision( - request?: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|undefined, {}|undefined - ]>; - tagApiDeploymentRevision( - request: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): void; - tagApiDeploymentRevision( - request: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): void; - tagApiDeploymentRevision( - request?: protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.ITagApiDeploymentRevisionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.tagApiDeploymentRevision(request, options, callback); - } -/** - * Sets the current revision to a specified prior - * revision. Note that this creates a new revision with a new revision ID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The deployment being rolled back. - * @param {string} request.revisionId - * Required. The revision ID to roll back to. - * It must be a revision of the same deployment. - * - * Example: `c7cfa2a8` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.rollback_api_deployment.js - * region_tag:apigeeregistry_v1_generated_Registry_RollbackApiDeployment_async - */ - rollbackApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|undefined, {}|undefined - ]>; - rollbackApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - rollbackApiDeployment( - request: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, - {}|null|undefined>): void; - rollbackApiDeployment( - request?: protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IRollbackApiDeploymentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.rollbackApiDeployment(request, options, callback); - } -/** - * Deletes a revision of a deployment. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment revision to be deleted, - * with a revision ID explicitly included. - * - * Example: - * `projects/sample/locations/global/apis/petstore/deployments/prod@c7cfa2a8` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_api_deployment_revision.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteApiDeploymentRevision_async - */ - deleteApiDeploymentRevision( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|undefined, {}|undefined - ]>; - deleteApiDeploymentRevision( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiDeploymentRevision( - request: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): void; - deleteApiDeploymentRevision( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment, - protos.google.cloud.apigeeregistry.v1.IDeleteApiDeploymentRevisionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteApiDeploymentRevision(request, options, callback); - } -/** - * Returns a specified artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the artifact to retrieve. - * Format: `{parent}/artifacts/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_artifact.js - * region_tag:apigeeregistry_v1_generated_Registry_GetArtifact_async - */ - getArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|undefined, {}|undefined - ]>; - getArtifact( - request: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, - {}|null|undefined>): void; - getArtifact( - request: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, - {}|null|undefined>): void; - getArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IGetArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getArtifact(request, options, callback); - } -/** - * Returns the contents of a specified artifact. - * If artifacts are stored with GZip compression, the default behavior - * is to return the artifact uncompressed (the mime_type response field - * indicates the exact format returned). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the artifact whose contents should be retrieved. - * Format: `{parent}/artifacts/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [HttpBody]{@link google.api.HttpBody}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.get_artifact_contents.js - * region_tag:apigeeregistry_v1_generated_Registry_GetArtifactContents_async - */ - getArtifactContents( - request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|undefined, {}|undefined - ]>; - getArtifactContents( - request: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, - {}|null|undefined>): void; - getArtifactContents( - request: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, - {}|null|undefined>): void; - getArtifactContents( - request?: protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.apigeeregistry.v1.IGetArtifactContentsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getArtifactContents(request, options, callback); - } -/** - * Creates a specified artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - * @param {google.cloud.apigeeregistry.v1.Artifact} request.artifact - * Required. The artifact to create. - * @param {string} request.artifactId - * Required. The ID to use for the artifact, which will become the final component of - * the artifact's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link 0-9|a-z}-/. - * - * Following AIP-162, IDs must not have the form of a UUID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.create_artifact.js - * region_tag:apigeeregistry_v1_generated_Registry_CreateArtifact_async - */ - createArtifact( - request?: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|undefined, {}|undefined - ]>; - createArtifact( - request: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, - {}|null|undefined>): void; - createArtifact( - request: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, - {}|null|undefined>): void; - createArtifact( - request?: protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.ICreateArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createArtifact(request, options, callback); - } -/** - * Used to replace a specified artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.apigeeregistry.v1.Artifact} request.artifact - * Required. The artifact to replace. - * - * The `name` field is used to identify the artifact to replace. - * Format: `{parent}/artifacts/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.replace_artifact.js - * region_tag:apigeeregistry_v1_generated_Registry_ReplaceArtifact_async - */ - replaceArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|undefined, {}|undefined - ]>; - replaceArtifact( - request: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, - {}|null|undefined>): void; - replaceArtifact( - request: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, - callback: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, - {}|null|undefined>): void; - replaceArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact, - protos.google.cloud.apigeeregistry.v1.IReplaceArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'artifact.name': request.artifact!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.replaceArtifact(request, options, callback); - } -/** - * Removes a specified artifact. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the artifact to delete. - * Format: `{parent}/artifacts/*` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/registry.delete_artifact.js - * region_tag:apigeeregistry_v1_generated_Registry_DeleteArtifact_async - */ - deleteArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|undefined, {}|undefined - ]>; - deleteArtifact( - request: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, - {}|null|undefined>): void; - deleteArtifact( - request: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, - {}|null|undefined>): void; - deleteArtifact( - request?: protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.apigeeregistry.v1.IDeleteArtifactRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteArtifact(request, options, callback); - } - - /** - * Returns matching APIs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The maximum number of APIs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApis` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApis` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Api]{@link google.cloud.apigeeregistry.v1.Api}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApisAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApis( - request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi[], - protos.google.cloud.apigeeregistry.v1.IListApisRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApisResponse - ]>; - listApis( - request: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApisRequest, - protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApi>): void; - listApis( - request: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApisRequest, - protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApi>): void; - listApis( - request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApisRequest, - protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApi>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApisRequest, - protos.google.cloud.apigeeregistry.v1.IListApisResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApi>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApi[], - protos.google.cloud.apigeeregistry.v1.IListApisRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApisResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApis(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The maximum number of APIs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApis` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApis` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Api]{@link google.cloud.apigeeregistry.v1.Api} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApisAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApisStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApis']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApis.createStream( - this.innerApiCalls.listApis as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApis`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of APIs. - * Format: `projects/* /locations/*` - * @param {number} request.pageSize - * The maximum number of APIs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApis` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApis` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Api]{@link google.cloud.apigeeregistry.v1.Api}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_apis.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApis_async - */ - listApisAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApisRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApis']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApis.asyncIterate( - this.innerApiCalls['listApis'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns matching versions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of versions to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiVersions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiVersions` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiVersions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion[], - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse - ]>; - listApiVersions( - request: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiVersion>): void; - listApiVersions( - request: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiVersion>): void; - listApiVersions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiVersion>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiVersion>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiVersion[], - protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiVersions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of versions to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiVersions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiVersions` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiVersionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiVersionsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiVersions.createStream( - this.innerApiCalls.listApiVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiVersions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of versions. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of versions to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiVersions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiVersions` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiVersion]{@link google.cloud.apigeeregistry.v1.ApiVersion}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_versions.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiVersions_async - */ - listApiVersionsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiVersionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiVersions.asyncIterate( - this.innerApiCalls['listApiVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns matching specs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {number} request.pageSize - * The maximum number of specs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiSpecs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiSpecs` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiSpecsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiSpecs( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec[], - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse - ]>; - listApiSpecs( - request: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; - listApiSpecs( - request: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; - listApiSpecs( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec[], - protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiSpecsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiSpecs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {number} request.pageSize - * The maximum number of specs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiSpecs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiSpecs` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiSpecsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiSpecsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiSpecs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiSpecs.createStream( - this.innerApiCalls.listApiSpecs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiSpecs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of specs. - * Format: `projects/* /locations/* /apis/* /versions/*` - * @param {number} request.pageSize - * The maximum number of specs to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiSpecs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiSpecs` must match - * the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_specs.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiSpecs_async - */ - listApiSpecsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiSpecs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiSpecs.asyncIterate( - this.innerApiCalls['listApiSpecs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all revisions of a spec. - * Revisions are returned in descending order of revision creation time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiSpecRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiSpecRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiSpecRevisions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec[], - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse - ]>; - listApiSpecRevisions( - request: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; - listApiSpecRevisions( - request: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): void; - listApiSpecRevisions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiSpec>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiSpec[], - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiSpecRevisions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiSpecRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiSpecRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiSpecRevisionsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listApiSpecRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiSpecRevisions.createStream( - this.innerApiCalls.listApiSpecRevisions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiSpecRevisions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spec to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiSpecRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiSpec]{@link google.cloud.apigeeregistry.v1.ApiSpec}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_spec_revisions.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiSpecRevisions_async - */ - listApiSpecRevisionsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiSpecRevisionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listApiSpecRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiSpecRevisions.asyncIterate( - this.innerApiCalls['listApiSpecRevisions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns matching deployments. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of deployments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiDeployments` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiDeploymentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiDeployments( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment[], - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse - ]>; - listApiDeployments( - request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; - listApiDeployments( - request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; - listApiDeployments( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment[], - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiDeployments(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of deployments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiDeployments` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiDeploymentsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiDeploymentsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiDeployments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiDeployments.createStream( - this.innerApiCalls.listApiDeployments as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiDeployments`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of deployments. - * Format: `projects/* /locations/* /apis/*` - * @param {number} request.pageSize - * The maximum number of deployments to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListApiDeployments` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListApiDeployments` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_deployments.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiDeployments_async - */ - listApiDeploymentsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listApiDeployments']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiDeployments.asyncIterate( - this.innerApiCalls['listApiDeployments'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all revisions of a deployment. - * Revisions are returned in descending order of revision creation time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiDeploymentRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApiDeploymentRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiDeploymentRevisions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment[], - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse - ]>; - listApiDeploymentRevisions( - request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; - listApiDeploymentRevisions( - request: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): void; - listApiDeploymentRevisions( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IApiDeployment>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IApiDeployment[], - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.listApiDeploymentRevisions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiDeploymentRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApiDeploymentRevisionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listApiDeploymentRevisionsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiDeploymentRevisions.createStream( - this.innerApiCalls.listApiDeploymentRevisions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listApiDeploymentRevisions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the deployment to list revisions for. - * @param {number} request.pageSize - * The maximum number of revisions to return per page. - * @param {string} request.pageToken - * The page token, received from a previous ListApiDeploymentRevisions call. - * Provide this to retrieve the subsequent page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ApiDeployment]{@link google.cloud.apigeeregistry.v1.ApiDeployment}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_api_deployment_revisions.js - * region_tag:apigeeregistry_v1_generated_Registry_ListApiDeploymentRevisions_async - */ - listApiDeploymentRevisionsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListApiDeploymentRevisionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listApiDeploymentRevisions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listApiDeploymentRevisions.asyncIterate( - this.innerApiCalls['listApiDeploymentRevisions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns matching artifacts. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListArtifacts` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListArtifacts` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listArtifactsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listArtifacts( - request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact[], - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse - ]>; - listArtifacts( - request: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IArtifact>): void; - listArtifacts( - request: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - callback: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IArtifact>): void; - listArtifacts( - request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IArtifact>, - callback?: PaginationCallback< - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse|null|undefined, - protos.google.cloud.apigeeregistry.v1.IArtifact>): - Promise<[ - protos.google.cloud.apigeeregistry.v1.IArtifact[], - protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest|null, - protos.google.cloud.apigeeregistry.v1.IListArtifactsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listArtifacts(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListArtifacts` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListArtifacts` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listArtifactsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listArtifactsStream( - request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listArtifacts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listArtifacts.createStream( - this.innerApiCalls.listArtifacts as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listArtifacts`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of artifacts. - * Format: `{parent}` - * @param {number} request.pageSize - * The maximum number of artifacts to return. - * The service may return fewer than this value. - * If unspecified, at most 50 values will be returned. - * The maximum is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListArtifacts` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListArtifacts` must - * match the call that provided the page token. - * @param {string} request.filter - * An expression that can be used to filter the list. Filters use the Common - * Expression Language and can refer to all message fields except contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Artifact]{@link google.cloud.apigeeregistry.v1.Artifact}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/registry.list_artifacts.js - * region_tag:apigeeregistry_v1_generated_Registry_ListArtifacts_async - */ - listArtifactsAsync( - request?: protos.google.cloud.apigeeregistry.v1.IListArtifactsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listArtifacts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listArtifacts.asyncIterate( - this.innerApiCalls['listArtifacts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified api resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @returns {string} Resource name string. - */ - apiPath(project:string,location:string,api:string) { - return this.pathTemplates.apiPathTemplate.render({ - project: project, - location: location, - api: api, - }); - } - - /** - * Parse the project from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).project; - } - - /** - * Parse the location from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).location; - } - - /** - * Parse the api from Api resource. - * - * @param {string} apiName - * A fully-qualified path representing Api resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiName(apiName: string) { - return this.pathTemplates.apiPathTemplate.match(apiName).api; - } - - /** - * Return a fully-qualified apiDeployment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} deployment - * @returns {string} Resource name string. - */ - apiDeploymentPath(project:string,location:string,api:string,deployment:string) { - return this.pathTemplates.apiDeploymentPathTemplate.render({ - project: project, - location: location, - api: api, - deployment: deployment, - }); - } - - /** - * Parse the project from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).project; - } - - /** - * Parse the location from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).location; - } - - /** - * Parse the api from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).api; - } - - /** - * Parse the deployment from ApiDeployment resource. - * - * @param {string} apiDeploymentName - * A fully-qualified path representing ApiDeployment resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromApiDeploymentName(apiDeploymentName: string) { - return this.pathTemplates.apiDeploymentPathTemplate.match(apiDeploymentName).deployment; - } - - /** - * Return a fully-qualified apiSpec resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} spec - * @returns {string} Resource name string. - */ - apiSpecPath(project:string,location:string,api:string,version:string,spec:string) { - return this.pathTemplates.apiSpecPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - spec: spec, - }); - } - - /** - * Parse the project from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).project; - } - - /** - * Parse the location from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).location; - } - - /** - * Parse the api from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).api; - } - - /** - * Parse the version from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the version. - */ - matchVersionFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).version; - } - - /** - * Parse the spec from ApiSpec resource. - * - * @param {string} apiSpecName - * A fully-qualified path representing ApiSpec resource. - * @returns {string} A string representing the spec. - */ - matchSpecFromApiSpecName(apiSpecName: string) { - return this.pathTemplates.apiSpecPathTemplate.match(apiSpecName).spec; - } - - /** - * Return a fully-qualified apiVersion resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @returns {string} Resource name string. - */ - apiVersionPath(project:string,location:string,api:string,version:string) { - return this.pathTemplates.apiVersionPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - }); - } - - /** - * Parse the project from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).project; - } - - /** - * Parse the location from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the location. - */ - matchLocationFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).location; - } - - /** - * Parse the api from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the api. - */ - matchApiFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).api; - } - - /** - * Parse the version from ApiVersion resource. - * - * @param {string} apiVersionName - * A fully-qualified path representing ApiVersion resource. - * @returns {string} A string representing the version. - */ - matchVersionFromApiVersionName(apiVersionName: string) { - return this.pathTemplates.apiVersionPathTemplate.match(apiVersionName).version; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectLocationApiArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiArtifactPath(project:string,location:string,api:string,artifact:string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).api; - } - - /** - * Parse the artifact from ProjectLocationApiArtifact resource. - * - * @param {string} projectLocationApiArtifactName - * A fully-qualified path representing project_location_api_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiArtifactName(projectLocationApiArtifactName: string) { - return this.pathTemplates.projectLocationApiArtifactPathTemplate.match(projectLocationApiArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiDeploymentArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} deployment - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiDeploymentArtifactPath(project:string,location:string,api:string,deployment:string,artifact:string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - deployment: deployment, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).api; - } - - /** - * Parse the deployment from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the deployment. - */ - matchDeploymentFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).deployment; - } - - /** - * Parse the artifact from ProjectLocationApiDeploymentArtifact resource. - * - * @param {string} projectLocationApiDeploymentArtifactName - * A fully-qualified path representing project_location_api_deployment_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiDeploymentArtifactName(projectLocationApiDeploymentArtifactName: string) { - return this.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match(projectLocationApiDeploymentArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiVersionArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiVersionArtifactPath(project:string,location:string,api:string,version:string,artifact:string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).api; - } - - /** - * Parse the version from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).version; - } - - /** - * Parse the artifact from ProjectLocationApiVersionArtifact resource. - * - * @param {string} projectLocationApiVersionArtifactName - * A fully-qualified path representing project_location_api_version_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiVersionArtifactName(projectLocationApiVersionArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match(projectLocationApiVersionArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationApiVersionSpecArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} api - * @param {string} version - * @param {string} spec - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationApiVersionSpecArtifactPath(project:string,location:string,api:string,version:string,spec:string,artifact:string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render({ - project: project, - location: location, - api: api, - version: version, - spec: spec, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).project; - } - - /** - * Parse the location from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).location; - } - - /** - * Parse the api from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the api. - */ - matchApiFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).api; - } - - /** - * Parse the version from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the version. - */ - matchVersionFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).version; - } - - /** - * Parse the spec from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the spec. - */ - matchSpecFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).spec; - } - - /** - * Parse the artifact from ProjectLocationApiVersionSpecArtifact resource. - * - * @param {string} projectLocationApiVersionSpecArtifactName - * A fully-qualified path representing project_location_api_version_spec_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationApiVersionSpecArtifactName(projectLocationApiVersionSpecArtifactName: string) { - return this.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match(projectLocationApiVersionSpecArtifactName).artifact; - } - - /** - * Return a fully-qualified projectLocationArtifact resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} artifact - * @returns {string} Resource name string. - */ - projectLocationArtifactPath(project:string,location:string,artifact:string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.render({ - project: project, - location: location, - artifact: artifact, - }); - } - - /** - * Parse the project from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).project; - } - - /** - * Parse the location from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).location; - } - - /** - * Parse the artifact from ProjectLocationArtifact resource. - * - * @param {string} projectLocationArtifactName - * A fully-qualified path representing project_location_artifact resource. - * @returns {string} A string representing the artifact. - */ - matchArtifactFromProjectLocationArtifactName(projectLocationArtifactName: string) { - return this.pathTemplates.projectLocationArtifactPathTemplate.match(projectLocationArtifactName).artifact; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.registryStub && !this._terminated) { - return this.registryStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/registry_client_config.json b/owl-bot-staging/v1/src/v1/registry_client_config.json deleted file mode 100644 index c26bf95..0000000 --- a/owl-bot-staging/v1/src/v1/registry_client_config.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "interfaces": { - "google.cloud.apigeeregistry.v1.Registry": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "cancelled_deadline_exceeded_aborted_unavailable": [ - "CANCELLED", - "DEADLINE_EXCEEDED", - "ABORTED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "5763d5cb4f40f09b4de469b8a0f10443a7a49d00": { - "initial_retry_delay_millis": 200, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListApis": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApi": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateApi": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "UpdateApi": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteApi": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiVersions": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApiVersion": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateApiVersion": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "UpdateApiVersion": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteApiVersion": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiSpecs": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApiSpecContents": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "UpdateApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "TagApiSpecRevision": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiSpecRevisions": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "RollbackApiSpec": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteApiSpecRevision": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiDeployments": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "UpdateApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "TagApiDeploymentRevision": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListApiDeploymentRevisions": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "RollbackApiDeployment": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteApiDeploymentRevision": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ListArtifacts": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "GetArtifactContents": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "CreateArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "ReplaceArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - }, - "DeleteArtifact": { - "timeout_millis": 60000, - "retry_codes_name": "cancelled_deadline_exceeded_aborted_unavailable", - "retry_params_name": "5763d5cb4f40f09b4de469b8a0f10443a7a49d00" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/registry_proto_list.json b/owl-bot-staging/v1/src/v1/registry_proto_list.json deleted file mode 100644 index 4fdc846..0000000 --- a/owl-bot-staging/v1/src/v1/registry_proto_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "../../protos/google/cloud/apigeeregistry/v1/provisioning_service.proto", - "../../protos/google/cloud/apigeeregistry/v1/registry_models.proto", - "../../protos/google/cloud/apigeeregistry/v1/registry_service.proto" -] diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2bd97dc..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -// 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 -// -// 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const apigeeregistry = require('@google-cloud/apigee-registry'); - -function main() { - const provisioningClient = new apigeeregistry.ProvisioningClient(); - const registryClient = new apigeeregistry.RegistryClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 7c5f275..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -// 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 -// -// 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. ** - -import {ProvisioningClient, RegistryClient} from '@google-cloud/apigee-registry'; - -// check that the client class type name can be used -function doStuffWithProvisioningClient(client: ProvisioningClient) { - client.close(); -} -function doStuffWithRegistryClient(client: RegistryClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const provisioningClient = new ProvisioningClient(); - doStuffWithProvisioningClient(provisioningClient); - // check that the client instance can be created - const registryClient = new RegistryClient(); - doStuffWithRegistryClient(registryClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 557a575..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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 -// -// 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_provisioning_v1.ts b/owl-bot-staging/v1/test/gapic_provisioning_v1.ts deleted file mode 100644 index 3225e79..0000000 --- a/owl-bot-staging/v1/test/gapic_provisioning_v1.ts +++ /dev/null @@ -1,1896 +0,0 @@ -// 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 -// -// 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as provisioningModule from '../src'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.ProvisioningClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = provisioningModule.v1.ProvisioningClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = provisioningModule.v1.ProvisioningClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = provisioningModule.v1.ProvisioningClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new provisioningModule.v1.ProvisioningClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new provisioningModule.v1.ProvisioningClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.provisioningStub, undefined); - await client.initialize(); - assert(client.provisioningStub); - }); - - it('has close method for the initialized client', done => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.provisioningStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.provisioningStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with call error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with call error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with LRO error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteInstanceProgress without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteInstanceProgress with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('api', () => { - const fakePath = "/rendered/path/api"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiPath', () => { - const result = client.apiPath("projectValue", "locationValue", "apiValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiName', () => { - const result = client.matchProjectFromApiName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiName', () => { - const result = client.matchLocationFromApiName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiName', () => { - const result = client.matchApiFromApiName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiDeployment', () => { - const fakePath = "/rendered/path/apiDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - deployment: "deploymentValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiDeploymentPath', () => { - const result = client.apiDeploymentPath("projectValue", "locationValue", "apiValue", "deploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiDeploymentName', () => { - const result = client.matchProjectFromApiDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiDeploymentName', () => { - const result = client.matchLocationFromApiDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiDeploymentName', () => { - const result = client.matchApiFromApiDeploymentName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromApiDeploymentName', () => { - const result = client.matchDeploymentFromApiDeploymentName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiSpec', () => { - const fakePath = "/rendered/path/apiSpec"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - spec: "specValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiSpecPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiSpecPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiSpecPath', () => { - const result = client.apiSpecPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiSpecPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiSpecName', () => { - const result = client.matchProjectFromApiSpecName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiSpecName', () => { - const result = client.matchLocationFromApiSpecName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiSpecName', () => { - const result = client.matchApiFromApiSpecName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromApiSpecName', () => { - const result = client.matchVersionFromApiSpecName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpecFromApiSpecName', () => { - const result = client.matchSpecFromApiSpecName(fakePath); - assert.strictEqual(result, "specValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiVersion', () => { - const fakePath = "/rendered/path/apiVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiVersionPath', () => { - const result = client.apiVersionPath("projectValue", "locationValue", "apiValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiVersionName', () => { - const result = client.matchProjectFromApiVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiVersionName', () => { - const result = client.matchLocationFromApiVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiVersionName', () => { - const result = client.matchApiFromApiVersionName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromApiVersionName', () => { - const result = client.matchVersionFromApiVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiArtifactPath', () => { - const result = client.projectLocationApiArtifactPath("projectValue", "locationValue", "apiValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiArtifactName', () => { - const result = client.matchApiFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiDeploymentArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiDeploymentArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - deployment: "deploymentValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiDeploymentArtifactPath', () => { - const result = client.projectLocationApiDeploymentArtifactPath("projectValue", "locationValue", "apiValue", "deploymentValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchApiFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchDeploymentFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiVersionArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiVersionArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiVersionArtifactPath', () => { - const result = client.projectLocationApiVersionArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchApiFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchVersionFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiVersionSpecArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiVersionSpecArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - spec: "specValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiVersionSpecArtifactPath', () => { - const result = client.projectLocationApiVersionSpecArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchApiFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchVersionFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpecFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchSpecFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "specValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationArtifact', () => { - const fakePath = "/rendered/path/projectLocationArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - artifact: "artifactValue", - }; - const client = new provisioningModule.v1.ProvisioningClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationArtifactPath', () => { - const result = client.projectLocationArtifactPath("projectValue", "locationValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationArtifactName', () => { - const result = client.matchProjectFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationArtifactName', () => { - const result = client.matchLocationFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationArtifactName', () => { - const result = client.matchArtifactFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/test/gapic_registry_v1.ts b/owl-bot-staging/v1/test/gapic_registry_v1.ts deleted file mode 100644 index f61594b..0000000 --- a/owl-bot-staging/v1/test/gapic_registry_v1.ts +++ /dev/null @@ -1,6025 +0,0 @@ -// 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 -// -// 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as registryModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.RegistryClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = registryModule.v1.RegistryClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = registryModule.v1.RegistryClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = registryModule.v1.RegistryClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new registryModule.v1.RegistryClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new registryModule.v1.RegistryClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.registryStub, undefined); - await client.initialize(); - assert(client.registryStub); - }); - - it('has close method for the initialized client', done => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.registryStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.registryStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getApi', () => { - it('invokes getApi without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.getApi = stubSimpleCall(expectedResponse); - const [response] = await client.getApi(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApi without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.getApi = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApi( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApi with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApi = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApi(request), expectedError); - const actualRequest = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApi with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApi(request), expectedError); - }); - }); - - describe('createApi', () => { - it('invokes createApi without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.createApi = stubSimpleCall(expectedResponse); - const [response] = await client.createApi(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApi without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.createApi = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApi( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApi with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApi = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createApi(request), expectedError); - const actualRequest = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApi with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createApi(request), expectedError); - }); - }); - - describe('updateApi', () => { - it('invokes updateApi without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() - ); - request.api ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiRequest', ['api', 'name']); - request.api.name = defaultValue1; - const expectedHeaderRequestParams = `api.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.updateApi = stubSimpleCall(expectedResponse); - const [response] = await client.updateApi(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApi without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() - ); - request.api ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiRequest', ['api', 'name']); - request.api.name = defaultValue1; - const expectedHeaderRequestParams = `api.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Api() - ); - client.innerApiCalls.updateApi = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApi( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApi with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() - ); - request.api ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiRequest', ['api', 'name']); - request.api.name = defaultValue1; - const expectedHeaderRequestParams = `api.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApi = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateApi(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApi with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() - ); - request.api ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiRequest', ['api', 'name']); - request.api.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateApi(request), expectedError); - }); - }); - - describe('deleteApi', () => { - it('invokes deleteApi without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApi = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApi(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApi without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApi = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApi( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApi with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApi = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApi(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApi as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApi with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApi(request), expectedError); - }); - }); - - describe('getApiVersion', () => { - it('invokes getApiVersion without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.getApiVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getApiVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiVersion without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.getApiVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApiVersion( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiVersion with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApiVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApiVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiVersion with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApiVersion(request), expectedError); - }); - }); - - describe('createApiVersion', () => { - it('invokes createApiVersion without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.createApiVersion = stubSimpleCall(expectedResponse); - const [response] = await client.createApiVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiVersion without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.createApiVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApiVersion( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiVersion with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApiVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createApiVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiVersion with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createApiVersion(request), expectedError); - }); - }); - - describe('updateApiVersion', () => { - it('invokes updateApiVersion without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() - ); - request.apiVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', ['apiVersion', 'name']); - request.apiVersion.name = defaultValue1; - const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.updateApiVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateApiVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiVersion without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() - ); - request.apiVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', ['apiVersion', 'name']); - request.apiVersion.name = defaultValue1; - const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiVersion() - ); - client.innerApiCalls.updateApiVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApiVersion( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiVersion with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() - ); - request.apiVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', ['apiVersion', 'name']); - request.apiVersion.name = defaultValue1; - const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApiVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateApiVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiVersion with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() - ); - request.apiVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', ['apiVersion', 'name']); - request.apiVersion.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateApiVersion(request), expectedError); - }); - }); - - describe('deleteApiVersion', () => { - it('invokes deleteApiVersion without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiVersion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiVersion without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiVersion( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiVersion with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiVersion with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiVersion(request), expectedError); - }); - }); - - describe('getApiSpec', () => { - it('invokes getApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.getApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.getApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.getApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApiSpec( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApiSpec(request), expectedError); - }); - }); - - describe('getApiSpecContents', () => { - it('invokes getApiSpecContents without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getApiSpecContents = stubSimpleCall(expectedResponse); - const [response] = await client.getApiSpecContents(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpecContents without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getApiSpecContents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApiSpecContents( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpecContents with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApiSpecContents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApiSpecContents(request), expectedError); - const actualRequest = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiSpecContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiSpecContents with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApiSpecContents(request), expectedError); - }); - }); - - describe('createApiSpec', () => { - it('invokes createApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.createApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.createApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.createApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApiSpec( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createApiSpec(request), expectedError); - }); - }); - - describe('updateApiSpec', () => { - it('invokes updateApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() - ); - request.apiSpec ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', ['apiSpec', 'name']); - request.apiSpec.name = defaultValue1; - const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.updateApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.updateApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() - ); - request.apiSpec ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', ['apiSpec', 'name']); - request.apiSpec.name = defaultValue1; - const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.updateApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApiSpec( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() - ); - request.apiSpec ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', ['apiSpec', 'name']); - request.apiSpec.name = defaultValue1; - const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() - ); - request.apiSpec ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', ['apiSpec', 'name']); - request.apiSpec.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateApiSpec(request), expectedError); - }); - }); - - describe('deleteApiSpec', () => { - it('invokes deleteApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiSpec( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiSpec(request), expectedError); - }); - }); - - describe('tagApiSpecRevision', () => { - it('invokes tagApiSpecRevision without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.tagApiSpecRevision = stubSimpleCall(expectedResponse); - const [response] = await client.tagApiSpecRevision(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiSpecRevision without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.tagApiSpecRevision = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.tagApiSpecRevision( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiSpecRevision with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.tagApiSpecRevision = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.tagApiSpecRevision(request), expectedError); - const actualRequest = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiSpecRevision with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.tagApiSpecRevision(request), expectedError); - }); - }); - - describe('rollbackApiSpec', () => { - it('invokes rollbackApiSpec without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.rollbackApiSpec = stubSimpleCall(expectedResponse); - const [response] = await client.rollbackApiSpec(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiSpec without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.rollbackApiSpec = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rollbackApiSpec( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiSpec with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rollbackApiSpec = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rollbackApiSpec(request), expectedError); - const actualRequest = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiSpec as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiSpec with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.rollbackApiSpec(request), expectedError); - }); - }); - - describe('deleteApiSpecRevision', () => { - it('invokes deleteApiSpecRevision without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiSpecRevision(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpecRevision without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiSpec() - ); - client.innerApiCalls.deleteApiSpecRevision = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiSpecRevision( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpecRevision with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiSpecRevision = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiSpecRevision(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiSpecRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiSpecRevision with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiSpecRevision(request), expectedError); - }); - }); - - describe('getApiDeployment', () => { - it('invokes getApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.getApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.getApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.getApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApiDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getApiDeployment(request), expectedError); - }); - }); - - describe('createApiDeployment', () => { - it('invokes createApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.createApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.createApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.createApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApiDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createApiDeployment(request), expectedError); - }); - }); - - describe('updateApiDeployment', () => { - it('invokes updateApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() - ); - request.apiDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', ['apiDeployment', 'name']); - request.apiDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.updateApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.updateApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() - ); - request.apiDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', ['apiDeployment', 'name']); - request.apiDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.updateApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApiDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() - ); - request.apiDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', ['apiDeployment', 'name']); - request.apiDeployment.name = defaultValue1; - const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() - ); - request.apiDeployment ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', ['apiDeployment', 'name']); - request.apiDeployment.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateApiDeployment(request), expectedError); - }); - }); - - describe('deleteApiDeployment', () => { - it('invokes deleteApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiDeployment( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiDeployment(request), expectedError); - }); - }); - - describe('tagApiDeploymentRevision', () => { - it('invokes tagApiDeploymentRevision without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall(expectedResponse); - const [response] = await client.tagApiDeploymentRevision(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiDeploymentRevision without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.tagApiDeploymentRevision( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiDeploymentRevision with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.tagApiDeploymentRevision = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.tagApiDeploymentRevision(request), expectedError); - const actualRequest = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tagApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tagApiDeploymentRevision with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.tagApiDeploymentRevision(request), expectedError); - }); - }); - - describe('rollbackApiDeployment', () => { - it('invokes rollbackApiDeployment without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.rollbackApiDeployment = stubSimpleCall(expectedResponse); - const [response] = await client.rollbackApiDeployment(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiDeployment without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.rollbackApiDeployment = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rollbackApiDeployment( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiDeployment with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rollbackApiDeployment = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rollbackApiDeployment(request), expectedError); - const actualRequest = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollbackApiDeployment as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollbackApiDeployment with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.rollbackApiDeployment(request), expectedError); - }); - }); - - describe('deleteApiDeploymentRevision', () => { - it('invokes deleteApiDeploymentRevision without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall(expectedResponse); - const [response] = await client.deleteApiDeploymentRevision(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeploymentRevision without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ApiDeployment() - ); - client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApiDeploymentRevision( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeploymentRevision with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApiDeploymentRevision = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteApiDeploymentRevision(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApiDeploymentRevision as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteApiDeploymentRevision with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteApiDeploymentRevision(request), expectedError); - }); - }); - - describe('getArtifact', () => { - it('invokes getArtifact without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.getArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.getArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifact without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.getArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getArtifact( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifact with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifact with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getArtifact(request), expectedError); - }); - }); - - describe('getArtifactContents', () => { - it('invokes getArtifactContents without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getArtifactContents = stubSimpleCall(expectedResponse); - const [response] = await client.getArtifactContents(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifactContents without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.getArtifactContents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getArtifactContents( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifactContents with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getArtifactContents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getArtifactContents(request), expectedError); - const actualRequest = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getArtifactContents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getArtifactContents with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getArtifactContents(request), expectedError); - }); - }); - - describe('createArtifact', () => { - it('invokes createArtifact without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateArtifactRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.createArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.createArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createArtifact without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateArtifactRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.createArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createArtifact( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createArtifact with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateArtifactRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createArtifact with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.CreateArtifactRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createArtifact(request), expectedError); - }); - }); - - describe('replaceArtifact', () => { - it('invokes replaceArtifact without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() - ); - request.artifact ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', ['artifact', 'name']); - request.artifact.name = defaultValue1; - const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.replaceArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.replaceArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceArtifact without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() - ); - request.artifact ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', ['artifact', 'name']); - request.artifact.name = defaultValue1; - const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.Artifact() - ); - client.innerApiCalls.replaceArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.replaceArtifact( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceArtifact with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() - ); - request.artifact ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', ['artifact', 'name']); - request.artifact.name = defaultValue1; - const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.replaceArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceArtifact with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() - ); - request.artifact ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', ['artifact', 'name']); - request.artifact.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.replaceArtifact(request), expectedError); - }); - }); - - describe('deleteArtifact', () => { - it('invokes deleteArtifact without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteArtifact = stubSimpleCall(expectedResponse); - const [response] = await client.deleteArtifact(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteArtifact without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteArtifact = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteArtifact( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteArtifact with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteArtifact = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteArtifact(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteArtifact as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteArtifact with closed client', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteArtifact(request), expectedError); - }); - }); - - describe('listApis', () => { - it('invokes listApis without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - ]; - client.innerApiCalls.listApis = stubSimpleCall(expectedResponse); - const [response] = await client.listApis(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApis without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - ]; - client.innerApiCalls.listApis = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApis( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApi[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApis with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApis = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApis(request), expectedError); - const actualRequest = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApisStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - ]; - client.descriptors.page.listApis.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApisStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.Api[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Api) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApis.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApis, request)); - assert( - (client.descriptors.page.listApis.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApisStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApis.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApisStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.Api[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Api) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApis.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApis, request)); - assert( - (client.descriptors.page.listApis.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApis without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Api()), - ]; - client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApi[] = []; - const iterable = client.listApisAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApis.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApis.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApis with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApis.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApisAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApi[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApis.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApis.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiVersions', () => { - it('invokes listApiVersions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - ]; - client.innerApiCalls.listApiVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listApiVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiVersions without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - ]; - client.innerApiCalls.listApiVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiVersions( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiVersions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiVersionsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - ]; - client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiVersion[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiVersions, request)); - assert( - (client.descriptors.page.listApiVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiVersionsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiVersion[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiVersions, request)); - assert( - (client.descriptors.page.listApiVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiVersions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiVersion()), - ]; - client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiVersion[] = []; - const iterable = client.listApiVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiVersions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiSpecs', () => { - it('invokes listApiSpecs without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.innerApiCalls.listApiSpecs = stubSimpleCall(expectedResponse); - const [response] = await client.listApiSpecs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecs without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.innerApiCalls.listApiSpecs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiSpecs( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecs with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiSpecs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiSpecs(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiSpecsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiSpecs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiSpecs, request)); - assert( - (client.descriptors.page.listApiSpecs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiSpecsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiSpecs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiSpecsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiSpecs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiSpecs, request)); - assert( - (client.descriptors.page.listApiSpecs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiSpecs without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; - const iterable = client.listApiSpecsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiSpecs with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiSpecs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiSpecsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiSpecs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiSpecRevisions', () => { - it('invokes listApiSpecRevisions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.innerApiCalls.listApiSpecRevisions = stubSimpleCall(expectedResponse); - const [response] = await client.listApiSpecRevisions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecRevisions without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.innerApiCalls.listApiSpecRevisions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiSpecRevisions( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiSpec[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecRevisions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiSpecRevisions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiSpecRevisions(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiSpecRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiSpecRevisionsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiSpecRevisionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiSpecRevisions, request)); - assert( - (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiSpecRevisionsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiSpecRevisions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiSpecRevisionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiSpec[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiSpec) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiSpecRevisions, request)); - assert( - (client.descriptors.page.listApiSpecRevisions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiSpecRevisions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiSpec()), - ]; - client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; - const iterable = client.listApiSpecRevisionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiSpecRevisions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiSpecRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiSpecRevisionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiSpec[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiSpecRevisions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiDeployments', () => { - it('invokes listApiDeployments without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.innerApiCalls.listApiDeployments = stubSimpleCall(expectedResponse); - const [response] = await client.listApiDeployments(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeployments without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.innerApiCalls.listApiDeployments = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiDeployments( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeployments with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiDeployments = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiDeployments(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeployments as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeploymentsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiDeployments, request)); - assert( - (client.descriptors.page.listApiDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiDeploymentsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiDeployments.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiDeploymentsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiDeployments.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiDeployments, request)); - assert( - (client.descriptors.page.listApiDeployments.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiDeployments without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; - const iterable = client.listApiDeploymentsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiDeployments with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiDeployments.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiDeploymentsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiDeployments.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listApiDeploymentRevisions', () => { - it('invokes listApiDeploymentRevisions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall(expectedResponse); - const [response] = await client.listApiDeploymentRevisions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeploymentRevisions without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApiDeploymentRevisions( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IApiDeployment[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeploymentRevisions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApiDeploymentRevisions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApiDeploymentRevisions(request), expectedError); - const actualRequest = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApiDeploymentRevisions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listApiDeploymentRevisionsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApiDeploymentRevisionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiDeploymentRevisions, request)); - assert( - (client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listApiDeploymentRevisionsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiDeploymentRevisions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApiDeploymentRevisionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.ApiDeployment[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.ApiDeployment) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApiDeploymentRevisions, request)); - assert( - (client.descriptors.page.listApiDeploymentRevisions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiDeploymentRevisions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.ApiDeployment()), - ]; - client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; - const iterable = client.listApiDeploymentRevisionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApiDeploymentRevisions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listApiDeploymentRevisions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApiDeploymentRevisionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IApiDeployment[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApiDeploymentRevisions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listArtifacts', () => { - it('invokes listArtifacts without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - ]; - client.innerApiCalls.listArtifacts = stubSimpleCall(expectedResponse); - const [response] = await client.listArtifacts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listArtifacts without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - ]; - client.innerApiCalls.listArtifacts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listArtifacts( - request, - (err?: Error|null, result?: protos.google.cloud.apigeeregistry.v1.IArtifact[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listArtifacts with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listArtifacts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listArtifacts(request), expectedError); - const actualRequest = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listArtifacts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listArtifactsStream without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - ]; - client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listArtifactsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.Artifact[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Artifact) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listArtifacts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listArtifacts, request)); - assert( - (client.descriptors.page.listArtifacts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listArtifactsStream with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listArtifacts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listArtifactsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.apigeeregistry.v1.Artifact[] = []; - stream.on('data', (response: protos.google.cloud.apigeeregistry.v1.Artifact) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listArtifacts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listArtifacts, request)); - assert( - (client.descriptors.page.listArtifacts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listArtifacts without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - generateSampleMessage(new protos.google.cloud.apigeeregistry.v1.Artifact()), - ]; - client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.apigeeregistry.v1.IArtifact[] = []; - const iterable = client.listArtifactsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listArtifacts with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.apigeeregistry.v1.ListArtifactsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listArtifacts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listArtifactsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.apigeeregistry.v1.IArtifact[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listArtifacts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('api', () => { - const fakePath = "/rendered/path/api"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiPath', () => { - const result = client.apiPath("projectValue", "locationValue", "apiValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiName', () => { - const result = client.matchProjectFromApiName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiName', () => { - const result = client.matchLocationFromApiName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiName', () => { - const result = client.matchApiFromApiName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiDeployment', () => { - const fakePath = "/rendered/path/apiDeployment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - deployment: "deploymentValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiDeploymentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiDeploymentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiDeploymentPath', () => { - const result = client.apiDeploymentPath("projectValue", "locationValue", "apiValue", "deploymentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiDeploymentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiDeploymentName', () => { - const result = client.matchProjectFromApiDeploymentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiDeploymentName', () => { - const result = client.matchLocationFromApiDeploymentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiDeploymentName', () => { - const result = client.matchApiFromApiDeploymentName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromApiDeploymentName', () => { - const result = client.matchDeploymentFromApiDeploymentName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.apiDeploymentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiSpec', () => { - const fakePath = "/rendered/path/apiSpec"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - spec: "specValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiSpecPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiSpecPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiSpecPath', () => { - const result = client.apiSpecPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiSpecPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiSpecName', () => { - const result = client.matchProjectFromApiSpecName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiSpecName', () => { - const result = client.matchLocationFromApiSpecName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiSpecName', () => { - const result = client.matchApiFromApiSpecName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromApiSpecName', () => { - const result = client.matchVersionFromApiSpecName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpecFromApiSpecName', () => { - const result = client.matchSpecFromApiSpecName(fakePath); - assert.strictEqual(result, "specValue"); - assert((client.pathTemplates.apiSpecPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('apiVersion', () => { - const fakePath = "/rendered/path/apiVersion"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.apiVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.apiVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('apiVersionPath', () => { - const result = client.apiVersionPath("projectValue", "locationValue", "apiValue", "versionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.apiVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApiVersionName', () => { - const result = client.matchProjectFromApiVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApiVersionName', () => { - const result = client.matchLocationFromApiVersionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromApiVersionName', () => { - const result = client.matchApiFromApiVersionName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromApiVersionName', () => { - const result = client.matchVersionFromApiVersionName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.apiVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiArtifactPath', () => { - const result = client.projectLocationApiArtifactPath("projectValue", "locationValue", "apiValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiArtifactName', () => { - const result = client.matchApiFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiDeploymentArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiDeploymentArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - deployment: "deploymentValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiDeploymentArtifactPath', () => { - const result = client.projectLocationApiDeploymentArtifactPath("projectValue", "locationValue", "apiValue", "deploymentValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchApiFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeploymentFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchDeploymentFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "deploymentValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiDeploymentArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiDeploymentArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiDeploymentArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiVersionArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiVersionArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiVersionArtifactPath', () => { - const result = client.projectLocationApiVersionArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchApiFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchVersionFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiVersionArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiVersionArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiVersionArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationApiVersionSpecArtifact', () => { - const fakePath = "/rendered/path/projectLocationApiVersionSpecArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - api: "apiValue", - version: "versionValue", - spec: "specValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationApiVersionSpecArtifactPath', () => { - const result = client.projectLocationApiVersionSpecArtifactPath("projectValue", "locationValue", "apiValue", "versionValue", "specValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchProjectFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchLocationFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApiFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchApiFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "apiValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVersionFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchVersionFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "versionValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpecFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchSpecFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "specValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationApiVersionSpecArtifactName', () => { - const result = client.matchArtifactFromProjectLocationApiVersionSpecArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationApiVersionSpecArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationArtifact', () => { - const fakePath = "/rendered/path/projectLocationArtifact"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - artifact: "artifactValue", - }; - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectLocationArtifactPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationArtifactPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationArtifactPath', () => { - const result = client.projectLocationArtifactPath("projectValue", "locationValue", "artifactValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationArtifactName', () => { - const result = client.matchProjectFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationArtifactName', () => { - const result = client.matchLocationFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchArtifactFromProjectLocationArtifactName', () => { - const result = client.matchArtifactFromProjectLocationArtifactName(fakePath); - assert.strictEqual(result, "artifactValue"); - assert((client.pathTemplates.projectLocationArtifactPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index c94e0fd..0000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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 -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'Provisioning', - filename: './provisioning.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/src/v1/registry_client.ts b/src/v1/registry_client.ts index a4aba42..11b1bd0 100644 --- a/src/v1/registry_client.ts +++ b/src/v1/registry_client.ts @@ -23,7 +23,6 @@ import type { CallOptions, Descriptors, ClientOptions, - GrpcClientOptions, PaginationCallback, GaxCall, IamClient, @@ -67,7 +66,6 @@ export class RegistryClient { iamClient: IamClient; locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; registryStub?: Promise<{[name: string]: Function}>; /** @@ -271,167 +269,6 @@ export class RegistryClient { ), }; - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [ - { - selector: 'google.cloud.location.Locations.GetLocation', - get: '/v1/{name=projects/*/locations/*}', - }, - { - selector: 'google.cloud.location.Locations.ListLocations', - get: '/v1/{name=projects/*}/locations', - }, - { - selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', - get: '/v1/{resource=projects/*/locations/*/apis/*}:getIamPolicy', - additional_bindings: [ - { - get: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/artifacts/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:getIamPolicy', - }, - { - get: '/v1/{resource=projects/*/locations/*/instances/*}:getIamPolicy', - }, - {get: '/v1/{resource=projects/*/locations/*/runtime}:getIamPolicy'}, - ], - }, - { - selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', - post: '/v1/{resource=projects/*/locations/*/apis/*}:setIamPolicy', - body: '*', - additional_bindings: [ - { - post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/artifacts/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/instances/*}:setIamPolicy', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/runtime}:setIamPolicy', - body: '*', - }, - ], - }, - { - selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', - post: '/v1/{resource=projects/*/locations/*/apis/*}:testIamPermissions', - body: '*', - additional_bindings: [ - { - post: '/v1/{resource=projects/*/locations/*/apis/*/deployments/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/artifacts/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/artifacts/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/artifacts/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/apis/*/versions/*/specs/*/artifacts/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/instances/*}:testIamPermissions', - body: '*', - }, - { - post: '/v1/{resource=projects/*/locations/*/runtime}:testIamPermissions', - body: '*', - }, - ], - }, - { - selector: 'google.longrunning.Operations.CancelOperation', - post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', - body: '*', - }, - { - selector: 'google.longrunning.Operations.DeleteOperation', - delete: '/v1/{name=projects/*/locations/*/operations/*}', - }, - { - selector: 'google.longrunning.Operations.GetOperation', - get: '/v1/{name=projects/*/locations/*/operations/*}', - }, - { - selector: 'google.longrunning.Operations.ListOperations', - get: '/v1/{name=projects/*/locations/*}/operations', - }, - ]; - } - this.operationsClient = this._gaxModule - .lro(lroOptions) - .operationsClient(opts); - - this.descriptors.longrunning = {}; - // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.apigeeregistry.v1.Registry', @@ -5118,183 +4955,6 @@ export class RegistryClient { return this.locationsClient.listLocationsAsync(request, options); } - /** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - // -------------------- // -- Path templates -- // -------------------- @@ -6166,7 +5826,6 @@ export class RegistryClient { stub.close(); this.iamClient.close(); this.locationsClient.close(); - this.operationsClient.close(); }); } return Promise.resolve(); diff --git a/test/gapic_provisioning_v1.ts b/test/gapic_provisioning_v1.ts index 328ffe1..a87c8a6 100644 --- a/test/gapic_provisioning_v1.ts +++ b/test/gapic_provisioning_v1.ts @@ -233,7 +233,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('GetInstanceRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetInstanceRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -261,7 +264,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('GetInstanceRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetInstanceRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -305,7 +311,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('GetInstanceRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetInstanceRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -333,7 +342,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('GetInstanceRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetInstanceRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -351,9 +363,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateInstanceRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateInstanceRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -383,9 +396,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateInstanceRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateInstanceRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -436,9 +450,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateInstanceRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateInstanceRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -466,9 +481,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateInstanceRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateInstanceRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -541,9 +557,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteInstanceRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -573,9 +590,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteInstanceRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -626,9 +644,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteInstanceRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -656,9 +675,10 @@ describe('v1.ProvisioningClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteInstanceRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteInstanceRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteInstanceRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); diff --git a/test/gapic_registry_v1.ts b/test/gapic_registry_v1.ts index 9bbe2e9..369b42c 100644 --- a/test/gapic_registry_v1.ts +++ b/test/gapic_registry_v1.ts @@ -25,12 +25,7 @@ import * as registryModule from '../src'; import {PassThrough} from 'stream'; -import { - protobuf, - operationsProtos, - IamProtos, - LocationProtos, -} from 'google-gax'; +import {protobuf, IamProtos, LocationProtos} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects @@ -240,7 +235,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -268,7 +266,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -312,7 +313,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -337,7 +341,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -355,7 +362,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -383,7 +393,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -427,7 +440,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -452,7 +468,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -471,10 +490,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() ); request.api ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiRequest', [ - 'api', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiRequest', + ['api', 'name'] + ); request.api.name = defaultValue1; const expectedHeaderRequestParams = `api.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -503,10 +522,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() ); request.api ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiRequest', [ - 'api', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiRequest', + ['api', 'name'] + ); request.api.name = defaultValue1; const expectedHeaderRequestParams = `api.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -551,10 +570,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() ); request.api ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiRequest', [ - 'api', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiRequest', + ['api', 'name'] + ); request.api.name = defaultValue1; const expectedHeaderRequestParams = `api.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -580,10 +599,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiRequest() ); request.api ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiRequest', [ - 'api', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiRequest', + ['api', 'name'] + ); request.api.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -601,7 +620,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -629,7 +651,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -673,7 +698,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -698,7 +726,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -716,9 +747,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiVersionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiVersionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -746,9 +778,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiVersionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiVersionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -792,9 +825,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiVersionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiVersionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -822,9 +856,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiVersionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiVersionRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -842,9 +877,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiVersionRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -872,9 +908,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiVersionRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -918,9 +955,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiVersionRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -948,9 +986,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiVersionRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiVersionRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -969,10 +1008,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() ); request.apiVersion ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiVersionRequest', [ - 'apiVersion', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', + ['apiVersion', 'name'] + ); request.apiVersion.name = defaultValue1; const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1001,10 +1040,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() ); request.apiVersion ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiVersionRequest', [ - 'apiVersion', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', + ['apiVersion', 'name'] + ); request.apiVersion.name = defaultValue1; const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1049,10 +1088,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() ); request.apiVersion ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiVersionRequest', [ - 'apiVersion', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', + ['apiVersion', 'name'] + ); request.apiVersion.name = defaultValue1; const expectedHeaderRequestParams = `api_version.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1081,10 +1120,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest() ); request.apiVersion ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiVersionRequest', [ - 'apiVersion', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiVersionRequest', + ['apiVersion', 'name'] + ); request.apiVersion.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1102,9 +1141,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiVersionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1132,9 +1172,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiVersionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1178,9 +1219,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiVersionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1208,9 +1250,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiVersionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiVersionRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1228,7 +1271,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiSpecRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1256,7 +1302,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiSpecRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1300,7 +1349,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiSpecRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1328,7 +1380,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiSpecRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1346,9 +1401,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiSpecContentsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1377,9 +1433,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiSpecContentsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1420,9 +1477,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiSpecContentsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1450,9 +1508,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiSpecContentsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiSpecContentsRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1470,9 +1529,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiSpecRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1500,9 +1560,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiSpecRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1546,9 +1607,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiSpecRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1576,9 +1638,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiSpecRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiSpecRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1597,10 +1660,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() ); request.apiSpec ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiSpecRequest', [ - 'apiSpec', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', + ['apiSpec', 'name'] + ); request.apiSpec.name = defaultValue1; const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1629,10 +1692,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() ); request.apiSpec ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiSpecRequest', [ - 'apiSpec', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', + ['apiSpec', 'name'] + ); request.apiSpec.name = defaultValue1; const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1677,10 +1740,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() ); request.apiSpec ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiSpecRequest', [ - 'apiSpec', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', + ['apiSpec', 'name'] + ); request.apiSpec.name = defaultValue1; const expectedHeaderRequestParams = `api_spec.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1709,10 +1772,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest() ); request.apiSpec ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiSpecRequest', [ - 'apiSpec', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiSpecRequest', + ['apiSpec', 'name'] + ); request.apiSpec.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1730,9 +1793,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiSpecRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1760,9 +1824,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiSpecRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1806,9 +1871,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiSpecRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1836,9 +1902,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiSpecRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1856,9 +1923,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() ); - const defaultValue1 = getTypeDefaultValue('TagApiSpecRevisionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1887,9 +1955,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() ); - const defaultValue1 = getTypeDefaultValue('TagApiSpecRevisionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1933,9 +2002,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() ); - const defaultValue1 = getTypeDefaultValue('TagApiSpecRevisionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1963,9 +2033,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest() ); - const defaultValue1 = getTypeDefaultValue('TagApiSpecRevisionRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.TagApiSpecRevisionRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1983,9 +2054,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('RollbackApiSpecRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2013,9 +2085,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('RollbackApiSpecRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2059,9 +2132,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('RollbackApiSpecRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2089,9 +2163,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest() ); - const defaultValue1 = getTypeDefaultValue('RollbackApiSpecRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.RollbackApiSpecRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -2110,7 +2185,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'DeleteApiSpecRevisionRequest', + '.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -2142,7 +2217,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'DeleteApiSpecRevisionRequest', + '.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -2189,7 +2264,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'DeleteApiSpecRevisionRequest', + '.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -2223,7 +2298,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'DeleteApiSpecRevisionRequest', + '.google.cloud.apigeeregistry.v1.DeleteApiSpecRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -2246,9 +2321,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiDeploymentRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2276,9 +2352,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiDeploymentRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2322,9 +2399,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiDeploymentRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2352,9 +2430,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('GetApiDeploymentRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetApiDeploymentRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -2372,9 +2451,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiDeploymentRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2403,9 +2483,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiDeploymentRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2449,9 +2530,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiDeploymentRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2479,9 +2561,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateApiDeploymentRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateApiDeploymentRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -2500,10 +2583,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() ); request.apiDeployment ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiDeploymentRequest', [ - 'apiDeployment', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', + ['apiDeployment', 'name'] + ); request.apiDeployment.name = defaultValue1; const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2533,10 +2616,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() ); request.apiDeployment ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiDeploymentRequest', [ - 'apiDeployment', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', + ['apiDeployment', 'name'] + ); request.apiDeployment.name = defaultValue1; const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2581,10 +2664,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() ); request.apiDeployment ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiDeploymentRequest', [ - 'apiDeployment', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', + ['apiDeployment', 'name'] + ); request.apiDeployment.name = defaultValue1; const expectedHeaderRequestParams = `api_deployment.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2613,10 +2696,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest() ); request.apiDeployment ??= {}; - const defaultValue1 = getTypeDefaultValue('UpdateApiDeploymentRequest', [ - 'apiDeployment', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.UpdateApiDeploymentRequest', + ['apiDeployment', 'name'] + ); request.apiDeployment.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -2634,9 +2717,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiDeploymentRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2665,9 +2749,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiDeploymentRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -2711,9 +2796,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiDeploymentRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -2741,9 +2827,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteApiDeploymentRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -2762,7 +2849,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'TagApiDeploymentRevisionRequest', + '.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -2794,7 +2881,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'TagApiDeploymentRevisionRequest', + '.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -2841,7 +2928,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'TagApiDeploymentRevisionRequest', + '.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -2875,7 +2962,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'TagApiDeploymentRevisionRequest', + '.google.cloud.apigeeregistry.v1.TagApiDeploymentRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -2899,7 +2986,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RollbackApiDeploymentRequest', + '.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name'] ); request.name = defaultValue1; @@ -2931,7 +3018,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RollbackApiDeploymentRequest', + '.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name'] ); request.name = defaultValue1; @@ -2978,7 +3065,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RollbackApiDeploymentRequest', + '.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name'] ); request.name = defaultValue1; @@ -3012,7 +3099,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest() ); const defaultValue1 = getTypeDefaultValue( - 'RollbackApiDeploymentRequest', + '.google.cloud.apigeeregistry.v1.RollbackApiDeploymentRequest', ['name'] ); request.name = defaultValue1; @@ -3036,7 +3123,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'DeleteApiDeploymentRevisionRequest', + '.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -3068,7 +3155,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'DeleteApiDeploymentRevisionRequest', + '.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -3115,7 +3202,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'DeleteApiDeploymentRevisionRequest', + '.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -3149,7 +3236,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest() ); const defaultValue1 = getTypeDefaultValue( - 'DeleteApiDeploymentRevisionRequest', + '.google.cloud.apigeeregistry.v1.DeleteApiDeploymentRevisionRequest', ['name'] ); request.name = defaultValue1; @@ -3172,7 +3259,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('GetArtifactRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetArtifactRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3200,7 +3290,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('GetArtifactRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetArtifactRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3244,7 +3337,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('GetArtifactRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetArtifactRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -3272,7 +3368,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('GetArtifactRequest', ['name']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetArtifactRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -3290,9 +3389,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() ); - const defaultValue1 = getTypeDefaultValue('GetArtifactContentsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3321,9 +3421,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() ); - const defaultValue1 = getTypeDefaultValue('GetArtifactContentsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3364,9 +3465,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() ); - const defaultValue1 = getTypeDefaultValue('GetArtifactContentsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -3394,9 +3496,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest() ); - const defaultValue1 = getTypeDefaultValue('GetArtifactContentsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.GetArtifactContentsRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -3414,9 +3517,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateArtifactRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateArtifactRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3444,9 +3548,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateArtifactRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateArtifactRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3490,9 +3595,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateArtifactRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateArtifactRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -3520,9 +3626,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.CreateArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('CreateArtifactRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.CreateArtifactRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -3541,10 +3648,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() ); request.artifact ??= {}; - const defaultValue1 = getTypeDefaultValue('ReplaceArtifactRequest', [ - 'artifact', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', + ['artifact', 'name'] + ); request.artifact.name = defaultValue1; const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3573,10 +3680,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() ); request.artifact ??= {}; - const defaultValue1 = getTypeDefaultValue('ReplaceArtifactRequest', [ - 'artifact', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', + ['artifact', 'name'] + ); request.artifact.name = defaultValue1; const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3621,10 +3728,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() ); request.artifact ??= {}; - const defaultValue1 = getTypeDefaultValue('ReplaceArtifactRequest', [ - 'artifact', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', + ['artifact', 'name'] + ); request.artifact.name = defaultValue1; const expectedHeaderRequestParams = `artifact.name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -3653,10 +3760,10 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest() ); request.artifact ??= {}; - const defaultValue1 = getTypeDefaultValue('ReplaceArtifactRequest', [ - 'artifact', - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ReplaceArtifactRequest', + ['artifact', 'name'] + ); request.artifact.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -3674,9 +3781,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteArtifactRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3704,9 +3812,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteArtifactRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -3750,9 +3859,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteArtifactRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -3780,9 +3890,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.DeleteArtifactRequest() ); - const defaultValue1 = getTypeDefaultValue('DeleteArtifactRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.DeleteArtifactRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -3800,7 +3911,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApisRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -3830,7 +3944,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApisRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -3876,7 +3993,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApisRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -3901,7 +4021,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApisRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -3952,7 +4075,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApisRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4000,7 +4126,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApisRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4039,7 +4168,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApisRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApisRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApisRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4079,9 +4211,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4117,9 +4250,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4171,9 +4305,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4201,9 +4336,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4261,9 +4397,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4310,9 +4447,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4358,9 +4496,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiVersionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiVersionsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiVersionsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4400,9 +4539,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4438,9 +4578,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4492,9 +4633,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4522,9 +4664,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4581,9 +4724,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4631,9 +4775,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -4679,9 +4824,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4720,9 +4866,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ @@ -4759,9 +4906,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ @@ -4813,9 +4961,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4843,9 +4992,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ @@ -4902,9 +5052,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -4950,9 +5101,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ @@ -4998,9 +5150,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiSpecRevisionsRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiSpecRevisionsRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -5039,9 +5192,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -5078,9 +5232,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -5134,9 +5289,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -5164,9 +5320,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -5224,9 +5381,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -5273,9 +5431,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -5322,9 +5481,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListApiDeploymentsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListApiDeploymentsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -5365,7 +5525,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListApiDeploymentRevisionsRequest', + '.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name'] ); request.name = defaultValue1; @@ -5405,7 +5565,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListApiDeploymentRevisionsRequest', + '.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name'] ); request.name = defaultValue1; @@ -5462,7 +5622,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListApiDeploymentRevisionsRequest', + '.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name'] ); request.name = defaultValue1; @@ -5496,7 +5656,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListApiDeploymentRevisionsRequest', + '.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name'] ); request.name = defaultValue1; @@ -5563,7 +5723,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListApiDeploymentRevisionsRequest', + '.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name'] ); request.name = defaultValue1; @@ -5619,7 +5779,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListApiDeploymentRevisionsRequest', + '.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name'] ); request.name = defaultValue1; @@ -5673,7 +5833,7 @@ describe('v1.RegistryClient', () => { new protos.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListApiDeploymentRevisionsRequest', + '.google.cloud.apigeeregistry.v1.ListApiDeploymentRevisionsRequest', ['name'] ); request.name = defaultValue1; @@ -5719,9 +5879,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListArtifactsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -5757,9 +5918,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListArtifactsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -5811,9 +5973,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListArtifactsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -5841,9 +6004,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListArtifactsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -5900,9 +6064,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListArtifactsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -5948,9 +6113,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListArtifactsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -5996,9 +6162,10 @@ describe('v1.RegistryClient', () => { const request = generateSampleMessage( new protos.google.cloud.apigeeregistry.v1.ListArtifactsRequest() ); - const defaultValue1 = getTypeDefaultValue('ListArtifactsRequest', [ - 'parent', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.apigeeregistry.v1.ListArtifactsRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -6548,311 +6715,6 @@ describe('v1.RegistryClient', () => { ); }); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.getOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.getOperation(request); - }, expectedError); - assert( - (client.operationsClient.getOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = - stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.cancelOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.cancelOperation(request); - }, expectedError); - assert( - (client.operationsClient.cancelOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = - stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.operationsClient.deleteOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.deleteOperation(request); - }, expectedError); - assert( - (client.operationsClient.deleteOperation as SinonStub) - .getCall(0) - .calledWith(request) - ); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = - []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.operationsClient.descriptor.listOperations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new registryModule.v1.RegistryClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = - []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.operationsClient.descriptor.listOperations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request - ); - }); - }); describe('Path templates', () => { describe('api', () => { From 8f04537522a2af545507769008b256b512785834 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Wed, 21 Sep 2022 15:51:16 -0700 Subject: [PATCH 5/6] chore: update repo metadata --- .repo-metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index d080edd..5807bd4 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -2,8 +2,8 @@ "name": "apigeeregistry", "name_pretty": "Apigee Registry API", "product_documentation": "https://cloud.google.com/apigee/docs/api-hub/get-started-registry-api", - "client_documentation": "https://cloud.google.com/nodejs/docs/reference/apigeeregistry/latest", - "issue_tracker": "https://github.com/googleapis/nodejs-video-transcoder/issues", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/apigee-registry/latest", + "issue_tracker": "https://github.com/googleapis/nodejs-apigee-registry/issues", "release_level": "beta", "language": "nodejs", "repo": "googleapis/nodejs-apigee-registry", From 33365e22f68cd7cd6b8512402a1187a100a52008 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 21 Sep 2022 22:52:50 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8dd1af2..b41032a 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-apigee-registry/blob/main/LICENSE) -[client-docs]: https://cloud.google.com/nodejs/docs/reference/apigeeregistry/latest +[client-docs]: https://cloud.google.com/nodejs/docs/reference/apigee-registry/latest [product-docs]: https://cloud.google.com/apigee/docs/api-hub/get-started-registry-api [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project