From 05334d53b7d3cc1d696b8ad36a1024097e5e68f8 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 3 Feb 2022 00:59:45 +0000 Subject: [PATCH 1/2] feat: Add Channel and ChannelConnection resources PiperOrigin-RevId: 425975821 Source-Link: https://github.com/googleapis/googleapis/commit/3766798d71842745506f3d68cf76755610d14345 Source-Link: https://github.com/googleapis/googleapis-gen/commit/0332102d499db3d7d6e69551f2f595a9c08a30d9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDMzMjEwMmQ0OTlkYjNkN2Q2ZTY5NTUxZjJmNTk1YTljMDhhMzBkOSJ9 --- 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 | 64 + .../google/cloud/eventarc/v1/channel.proto | 104 + .../eventarc/v1/channel_connection.proto | 74 + .../google/cloud/eventarc/v1/eventarc.proto | 513 ++++ .../google/cloud/eventarc/v1/trigger.proto | 226 ++ .../generated/v1/eventarc.create_channel.js | 70 + .../v1/eventarc.create_channel_connection.js | 64 + .../generated/v1/eventarc.create_trigger.js | 70 + .../generated/v1/eventarc.delete_channel.js | 60 + .../v1/eventarc.delete_channel_connection.js | 54 + .../generated/v1/eventarc.delete_trigger.js | 70 + .../generated/v1/eventarc.get_channel.js | 53 + .../v1/eventarc.get_channel_connection.js | 53 + .../generated/v1/eventarc.get_trigger.js | 53 + .../v1/eventarc.list_channel_connections.js | 67 + .../generated/v1/eventarc.list_channels.js | 74 + .../generated/v1/eventarc.list_triggers.js | 74 + .../generated/v1/eventarc.update_channel.js | 65 + .../generated/v1/eventarc.update_trigger.js | 70 + owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/eventarc_client.ts | 2204 +++++++++++++++ .../v1/src/v1/eventarc_client_config.json | 82 + .../v1/src/v1/eventarc_proto_list.json | 6 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 175 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + owl-bot-staging/v1/test/gapic_eventarc_v1.ts | 2473 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 39 files changed, 7204 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/eventarc/v1/channel.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel_connection.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/eventarc/v1/eventarc.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/eventarc/v1/trigger.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel_connection.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.create_trigger.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel_connection.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.delete_trigger.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel_connection.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.get_trigger.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.list_channel_connections.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.list_channels.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.list_triggers.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.update_channel.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.update_trigger.js create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/eventarc_client.ts create mode 100644 owl-bot-staging/v1/src/v1/eventarc_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/eventarc_proto_list.json 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/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_eventarc_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..be8e69e --- /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/eventarc', + 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..dd17389 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Eventarc: 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..1cd0604 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/eventarc", + "version": "0.1.0", + "description": "Eventarc client for Node.js", + "repository": "googleapis/nodejs-eventarc", + "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 eventarc", + "eventarc", + "eventarc" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "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": "^2.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^14.18.9", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^2.16.2", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.2", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel.proto b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel.proto new file mode 100644 index 0000000..feb0a6e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel.proto @@ -0,0 +1,104 @@ +// 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.eventarc.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Eventarc.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; +option java_multiple_files = true; +option java_outer_classname = "ChannelProto"; +option java_package = "com.google.cloud.eventarc.v1"; +option php_namespace = "Google\\Cloud\\Eventarc\\V1"; +option ruby_package = "Google::Cloud::Eventarc::V1"; + +// A representation of the Channel resource. +// A Channel is a resource on which event providers publish their events. +// The published events are delivered through the transport associated with the +// channel. Note that a channel is associated with exactly one event provider. +message Channel { + option (google.api.resource) = { + type: "eventarc.googleapis.com/Channel" + pattern: "projects/{project}/locations/{location}/channels/{channel}" + plural: "channels" + singular: "channel" + }; + + // State lists all the possible states of a Channel + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // The PENDING state indicates that a Channel has been created successfully + // and there is a new activation token available for the subscriber to use + // to convey the Channel to the provider in order to create a Connection. + PENDING = 1; + + // The ACTIVE state indicates that a Channel has been successfully + // connected with the event provider. + // An ACTIVE Channel is ready to receive and route events from the + // event provider. + ACTIVE = 2; + + // The INACTIVE state means that the Channel cannot receive events + // permanently. There are two possible cases this state can happen: + // 1. The SaaS provider disconnected from this Channel. + // 2. The Channel activation token has expired but the SaaS provider + // wasn't connected. + // To re-establish a Connection with a provider, the subscriber + // should create a new Channel and give it to the provider. + INACTIVE = 3; + } + + // Required. The resource name of the channel. Must be unique within the location + // on the project and must be in + // `projects/{project}/locations/{location}/channels/{channel_id}` format. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Server assigned unique identifier for the channel. The value is a UUID4 + // string and guaranteed to remain unchanged until the resource is deleted. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last-modified time. + google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The name of the event provider (e.g. Eventarc SaaS partner) associated + // with the channel. This provider will be granted permissions to publish + // events to the channel. Format: + // `projects/{project}/locations/{location}/providers/{provider_id}`. + string provider = 7 [(google.api.field_behavior) = REQUIRED]; + + oneof transport { + // Output only. The name of the Pub/Sub topic created and managed by Eventarc system as + // a transport for the event delivery. Format: + // `projects/{project}/topics/{topic_id}`. + string pubsub_topic = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The state of a Channel. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The activation token for the channel. The token must be used by the + // provider to register the channel for publishing. + string activation_token = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel_connection.proto b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel_connection.proto new file mode 100644 index 0000000..6bafa0d --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel_connection.proto @@ -0,0 +1,74 @@ +// 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.eventarc.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Eventarc.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; +option java_multiple_files = true; +option java_outer_classname = "ChannelConnectionProto"; +option java_package = "com.google.cloud.eventarc.v1"; +option php_namespace = "Google\\Cloud\\Eventarc\\V1"; +option ruby_package = "Google::Cloud::Eventarc::V1"; + +// A representation of the ChannelConnection resource. +// A ChannelConnection is a resource which event providers create during the +// activation process to establish a connection between the provider and the +// subscriber channel. +message ChannelConnection { + option (google.api.resource) = { + type: "eventarc.googleapis.com/ChannelConnection" + pattern: "projects/{project}/locations/{location}/channelConnections/{channel_connection}" + plural: "channelConnections" + singular: "channelConnection" + }; + + // Required. The name of the connection. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Server assigned ID of the resource. + // The server guarantees uniqueness and immutability until deleted. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The name of the connected subscriber Channel. + // This is a weak reference to avoid cross project and cross accounts + // references. This must be in + // `projects/{project}/location/{location}/channels/{channel_id}` format. + string channel = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last-modified time. + google.protobuf.Timestamp update_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. Activation token for the channel. The token will be used + // during the creation of ChannelConnection to bind the channel with the + // provider project. This field will not be stored in the provider resource. + string activation_token = 8 [(google.api.field_behavior) = INPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/eventarc.proto b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/eventarc.proto new file mode 100644 index 0000000..41aa848 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/eventarc.proto @@ -0,0 +1,513 @@ +// 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.eventarc.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/eventarc/v1/channel.proto"; +import "google/cloud/eventarc/v1/channel_connection.proto"; +import "google/cloud/eventarc/v1/trigger.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Eventarc.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; +option java_multiple_files = true; +option java_outer_classname = "EventarcProto"; +option java_package = "com.google.cloud.eventarc.v1"; +option php_namespace = "Google\\Cloud\\Eventarc\\V1"; +option ruby_package = "Google::Cloud::Eventarc::V1"; + +// Eventarc allows users to subscribe to various events that are provided by +// Google Cloud services and forward them to supported destinations. +service Eventarc { + option (google.api.default_host) = "eventarc.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Get a single trigger. + rpc GetTrigger(GetTriggerRequest) returns (Trigger) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/triggers/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List triggers. + rpc ListTriggers(ListTriggersRequest) returns (ListTriggersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/triggers" + }; + option (google.api.method_signature) = "parent"; + } + + // Create a new trigger in a particular project and location. + rpc CreateTrigger(CreateTriggerRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/triggers" + body: "trigger" + }; + option (google.api.method_signature) = "parent,trigger,trigger_id"; + option (google.longrunning.operation_info) = { + response_type: "Trigger" + metadata_type: "OperationMetadata" + }; + } + + // Update a single trigger. + rpc UpdateTrigger(UpdateTriggerRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{trigger.name=projects/*/locations/*/triggers/*}" + body: "trigger" + }; + option (google.api.method_signature) = "trigger,update_mask,allow_missing"; + option (google.longrunning.operation_info) = { + response_type: "Trigger" + metadata_type: "OperationMetadata" + }; + } + + // Delete a single trigger. + rpc DeleteTrigger(DeleteTriggerRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/triggers/*}" + }; + option (google.api.method_signature) = "name,allow_missing"; + option (google.longrunning.operation_info) = { + response_type: "Trigger" + metadata_type: "OperationMetadata" + }; + } + + // Get a single Channel. + rpc GetChannel(GetChannelRequest) returns (Channel) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/channels/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List channels. + rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/channels" + }; + option (google.api.method_signature) = "parent"; + } + + // Create a new channel in a particular project and location. + rpc CreateChannel(CreateChannelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/channels" + body: "channel" + }; + option (google.api.method_signature) = "parent,channel,channel_id"; + option (google.longrunning.operation_info) = { + response_type: "Channel" + metadata_type: "OperationMetadata" + }; + } + + // Update a single channel. + rpc UpdateChannel(UpdateChannelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{channel.name=projects/*/locations/*/channels/*}" + body: "channel" + }; + option (google.api.method_signature) = "channel,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Channel" + metadata_type: "OperationMetadata" + }; + } + + // Delete a single channel. + rpc DeleteChannel(DeleteChannelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/channels/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Channel" + metadata_type: "OperationMetadata" + }; + } + + // Get a single ChannelConnection. + rpc GetChannelConnection(GetChannelConnectionRequest) returns (ChannelConnection) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/channelConnections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List channel connections. + rpc ListChannelConnections(ListChannelConnectionsRequest) returns (ListChannelConnectionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/channelConnections" + }; + option (google.api.method_signature) = "parent"; + } + + // Create a new ChannelConnection in a particular project and location. + rpc CreateChannelConnection(CreateChannelConnectionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/channelConnections" + body: "channel_connection" + }; + option (google.api.method_signature) = "parent,channel_connection,channel_connection_id"; + option (google.longrunning.operation_info) = { + response_type: "ChannelConnection" + metadata_type: "OperationMetadata" + }; + } + + // Delete a single ChannelConnection. + rpc DeleteChannelConnection(DeleteChannelConnectionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/channelConnections/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "ChannelConnection" + metadata_type: "OperationMetadata" + }; + } +} + +// The request message for the GetTrigger method. +message GetTriggerRequest { + // Required. The name of the trigger to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; +} + +// The request message for the ListTriggers method. +message ListTriggersRequest { + // Required. The parent collection to list triggers on. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The maximum number of triggers to return on each page. + // Note: The service may send fewer. + int32 page_size = 2; + + // The page token; provide the value from the `next_page_token` field in a + // previous `ListTriggers` call to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListTriggers` must match + // the call that provided the page token. + string page_token = 3; + + // The sorting order of the resources returned. Value should be a + // comma-separated list of fields. The default sorting order is ascending. To + // specify descending order for a field, append a `desc` suffix; for example: + // `name desc, trigger_id`. + string order_by = 4; +} + +// The response message for the `ListTriggers` method. +message ListTriggersResponse { + // The requested triggers, up to the number specified in `page_size`. + repeated Trigger triggers = 1; + + // A page token that can be sent to ListTriggers to request the next page. + // If this is empty, then there are no more pages. + string next_page_token = 2; + + // Unreachable resources, if any. + repeated string unreachable = 3; +} + +// The request message for the CreateTrigger method. +message CreateTriggerRequest { + // Required. The parent collection in which to add this trigger. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/Trigger" + } + ]; + + // Required. The trigger to create. + Trigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The user-provided ID to be assigned to the trigger. + string trigger_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the UpdateTrigger method. +message UpdateTriggerRequest { + // The trigger to be updated. + Trigger trigger = 1; + + // The fields to be updated; only fields explicitly provided are updated. + // If no field mask is provided, all provided fields in the request are + // updated. To update all fields, provide a field mask of "*". + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the trigger is not found, a new trigger will be + // created. In this situation, `update_mask` is ignored. + bool allow_missing = 3; + + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the DeleteTrigger method. +message DeleteTriggerRequest { + // Required. The name of the trigger to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // If provided, the trigger will only be deleted if the etag matches the + // current etag on the resource. + string etag = 2; + + // If set to true, and the trigger is not found, the request will succeed + // but no action will be taken on the server. + bool allow_missing = 3; + + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the GetChannel method. +message GetChannelRequest { + // Required. The name of the channel to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// The request message for the ListChannels method. +message ListChannelsRequest { + // Required. The parent collection to list channels on. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/Channel" + } + ]; + + // The maximum number of channels to return on each page. + // Note: The service may send fewer. + int32 page_size = 2; + + // The page token; provide the value from the `next_page_token` field in a + // previous `ListChannels` call to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListChannels` must + // match the call that provided the page token. + string page_token = 3; + + // The sorting order of the resources returned. Value should be a + // comma-separated list of fields. The default sorting order is ascending. To + // specify descending order for a field, append a `desc` suffix; for example: + // `name desc, channel_id`. + string order_by = 4; +} + +// The response message for the `ListChannels` method. +message ListChannelsResponse { + // The requested channels, up to the number specified in `page_size`. + repeated Channel channels = 1; + + // A page token that can be sent to ListChannels to request the next page. + // If this is empty, then there are no more pages. + string next_page_token = 2; + + // Unreachable resources, if any. + repeated string unreachable = 3; +} + +// The request message for the CreateChannel method. +message CreateChannelRequest { + // Required. The parent collection in which to add this channel. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/Channel" + } + ]; + + // Required. The channel to create. + Channel channel = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The user-provided ID to be assigned to the channel. + string channel_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the UpdateChannel method. +message UpdateChannelRequest { + // The channel to be updated. + Channel channel = 1; + + // The fields to be updated; only fields explicitly provided are updated. + // If no field mask is provided, all provided fields in the request are + // updated. To update all fields, provide a field mask of "*". + google.protobuf.FieldMask update_mask = 2; + + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the DeleteChannel method. +message DeleteChannelRequest { + // Required. The name of the channel to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; + + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the GetChannelConnection method. +message GetChannelConnectionRequest { + // Required. The name of the channel connection to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/ChannelConnection" + } + ]; +} + +// The request message for the ListChannelConnections method. +message ListChannelConnectionsRequest { + // Required. The parent collection from which to list channel connections. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/ChannelConnection" + } + ]; + + // The maximum number of channel connections to return on each page. + // Note: The service may send fewer responses. + int32 page_size = 2; + + // The page token; provide the value from the `next_page_token` field in a + // previous `ListChannelConnections` call to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListChannelConnetions` + // match the call that provided the page token. + string page_token = 3; +} + +// The response message for the `ListChannelConnections` method. +message ListChannelConnectionsResponse { + // The requested channel connections, up to the number specified in + // `page_size`. + repeated ChannelConnection channel_connections = 1; + + // A page token that can be sent to ListChannelConnections to request the + // next page. + // If this is empty, then there are no more pages. + string next_page_token = 2; + + // Unreachable resources, if any. + repeated string unreachable = 3; +} + +// The request message for the CreateChannelConnection method. +message CreateChannelConnectionRequest { + // Required. The parent collection in which to add this channel connection. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/ChannelConnection" + } + ]; + + // Required. Channel connection to create. + ChannelConnection channel_connection = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The user-provided ID to be assigned to the channel connection. + string channel_connection_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the DeleteChannelConnection method. +message DeleteChannelConnectionRequest { + // Required. The name of the channel connection to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/ChannelConnection" + } + ]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. 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 requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/trigger.proto b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/trigger.proto new file mode 100644 index 0000000..5ba97d5 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/trigger.proto @@ -0,0 +1,226 @@ +// 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.eventarc.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; +option java_multiple_files = true; +option java_outer_classname = "TriggerProto"; +option java_package = "com.google.cloud.eventarc.v1"; +option (google.api.resource_definition) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + pattern: "projects/{project}/locations/{location}/functions/{function}" +}; +option (google.api.resource_definition) = { + type: "iam.googleapis.com/ServiceAccount" + pattern: "projects/{project}/serviceAccounts/{service_account}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "*" +}; + +// A representation of the trigger resource. +message Trigger { + option (google.api.resource) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" + plural: "triggers" + singular: "trigger" + }; + + // Required. The resource name of the trigger. Must be unique within the location of the + // project and must be in + // `projects/{project}/locations/{location}/triggers/{trigger}` format. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Server-assigned unique identifier for the trigger. The value is a UUID4 + // string and guaranteed to remain unchanged until the resource is deleted. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last-modified time. + google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. null The list of filters that applies to event attributes. Only events that + // match all the provided filters are sent to the destination. + repeated EventFilter event_filters = 8 [ + (google.api.field_behavior) = UNORDERED_LIST, + (google.api.field_behavior) = REQUIRED + ]; + + // Optional. The IAM service account email associated with the trigger. The + // service account represents the identity of the trigger. + // + // The principal who calls this API must have the `iam.serviceAccounts.actAs` + // permission in the service account. See + // https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common + // for more information. + // + // For Cloud Run destinations, this service account is used to generate + // identity tokens when invoking the service. See + // https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account + // for information on how to invoke authenticated Cloud Run services. + // To create Audit Log triggers, the service account should also + // have the `roles/eventarc.eventReceiver` IAM role. + string service_account = 9 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + } + ]; + + // Required. Destination specifies where the events should be sent to. + Destination destination = 10 [(google.api.field_behavior) = REQUIRED]; + + // Optional. To deliver messages, Eventarc might use other GCP + // products as a transport intermediary. This field contains a reference to + // that transport intermediary. This information can be used for debugging + // purposes. + Transport transport = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. User labels attached to the triggers that can be used to group resources. + map labels = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. This checksum is computed by the server based on the value of other + // fields, and might be sent only on create requests to ensure that the + // client has an up-to-date value before proceeding. + string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. Currently, only a subset of attributes + // are supported for filtering. + // + // All triggers MUST provide a filter for the 'type' attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a target of an invocation over HTTP. +message Destination { + oneof descriptor { + // Cloud Run fully-managed resource that receives the events. The resource + // should be in the same project as the trigger. + CloudRun cloud_run = 1; + + // The Cloud Function resource name. Only Cloud Functions V2 is supported. + // Format: `projects/{project}/locations/{location}/functions/{function}` + string cloud_function = 2 [(google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + }]; + + // A GKE service capable of receiving events. The service should be running + // in the same project as the trigger. + GKE gke = 3; + } +} + +// Represents the transport intermediaries created for the trigger to +// deliver events. +message Transport { + oneof intermediary { + // The Pub/Sub topic and subscription used by Eventarc as a transport + // intermediary. + Pubsub pubsub = 1; + } +} + +// Represents a Cloud Run destination. +message CloudRun { + // Required. The name of the Cloud Run service being addressed. See + // https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services. + // + // Only services located in the same project as the trigger object + // can be addressed. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "run.googleapis.com/Service" + } + ]; + + // Optional. The relative path on the Cloud Run service the events should be sent to. + // + // The value must conform to the definition of a URI path segment (section 3.3 + // of RFC2396). Examples: "/route", "route", "route/subroute". + string path = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The region the Cloud Run service is deployed in. + string region = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents a GKE destination. +message GKE { + // Required. The name of the cluster the GKE service is running in. The cluster must be + // running in the same project as the trigger being created. + string cluster = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the Google Compute Engine in which the cluster resides, which + // can either be compute zone (for example, us-central1-a) for the zonal + // clusters or region (for example, us-central1) for regional clusters. + string location = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The namespace the GKE service is running in. + string namespace = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Name of the GKE service. + string service = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The relative path on the GKE service the events should be sent to. + // + // The value must conform to the definition of a URI path segment (section 3.3 + // of RFC2396). Examples: "/route", "route", "route/subroute". + string path = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a Pub/Sub transport. +message Pubsub { + // Optional. The name of the Pub/Sub topic created and managed by Eventarc as + // a transport for the event delivery. Format: + // `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`. + // + // You can set an existing topic for triggers of the type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide + // here is not deleted by Eventarc at trigger deletion. + string topic = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The name of the Pub/Sub subscription created and managed by Eventarc + // as a transport for the event delivery. Format: + // `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`. + string subscription = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel.js new file mode 100644 index 0000000..25f12ee --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, channel, channelId, validateOnly) { + // [START eventarc_v1_generated_Eventarc_CreateChannel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent collection in which to add this channel. + */ + // const parent = 'abc123' + /** + * Required. The channel to create. + */ + // const channel = {} + /** + * Required. The user-provided ID to be assigned to the channel. + */ + // const channelId = 'abc123' + /** + * Required. If set, validate the request and preview the review, but do not + * post it. + */ + // const validateOnly = true + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callCreateChannel() { + // Construct request + const request = { + parent, + channel, + channelId, + validateOnly, + }; + + // Run request + const [operation] = await eventarcClient.createChannel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateChannel(); + // [END eventarc_v1_generated_Eventarc_CreateChannel_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/eventarc.create_channel_connection.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel_connection.js new file mode 100644 index 0000000..d3121b5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel_connection.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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, channelConnection, channelConnectionId) { + // [START eventarc_v1_generated_Eventarc_CreateChannelConnection_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent collection in which to add this channel connection. + */ + // const parent = 'abc123' + /** + * Required. Channel connection to create. + */ + // const channelConnection = {} + /** + * Required. The user-provided ID to be assigned to the channel connection. + */ + // const channelConnectionId = 'abc123' + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callCreateChannelConnection() { + // Construct request + const request = { + parent, + channelConnection, + channelConnectionId, + }; + + // Run request + const [operation] = await eventarcClient.createChannelConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateChannelConnection(); + // [END eventarc_v1_generated_Eventarc_CreateChannelConnection_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/eventarc.create_trigger.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.create_trigger.js new file mode 100644 index 0000000..89367ed --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.create_trigger.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, trigger, triggerId, validateOnly) { + // [START eventarc_v1_generated_Eventarc_CreateTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent collection in which to add this trigger. + */ + // const parent = 'abc123' + /** + * Required. The trigger to create. + */ + // const trigger = {} + /** + * Required. The user-provided ID to be assigned to the trigger. + */ + // const triggerId = 'abc123' + /** + * Required. If set, validate the request and preview the review, but do not + * post it. + */ + // const validateOnly = true + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callCreateTrigger() { + // Construct request + const request = { + parent, + trigger, + triggerId, + validateOnly, + }; + + // Run request + const [operation] = await eventarcClient.createTrigger(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateTrigger(); + // [END eventarc_v1_generated_Eventarc_CreateTrigger_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/eventarc.delete_channel.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel.js new file mode 100644 index 0000000..5d39c42 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name, validateOnly) { + // [START eventarc_v1_generated_Eventarc_DeleteChannel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the channel to be deleted. + */ + // const name = 'abc123' + /** + * Required. If set, validate the request and preview the review, but do not + * post it. + */ + // const validateOnly = true + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callDeleteChannel() { + // Construct request + const request = { + name, + validateOnly, + }; + + // Run request + const [operation] = await eventarcClient.deleteChannel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteChannel(); + // [END eventarc_v1_generated_Eventarc_DeleteChannel_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/eventarc.delete_channel_connection.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel_connection.js new file mode 100644 index 0000000..2c44896 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel_connection.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START eventarc_v1_generated_Eventarc_DeleteChannelConnection_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the channel connection to delete. + */ + // const name = 'abc123' + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callDeleteChannelConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await eventarcClient.deleteChannelConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteChannelConnection(); + // [END eventarc_v1_generated_Eventarc_DeleteChannelConnection_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/eventarc.delete_trigger.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_trigger.js new file mode 100644 index 0000000..88055ea --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_trigger.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name, validateOnly) { + // [START eventarc_v1_generated_Eventarc_DeleteTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the trigger to be deleted. + */ + // const name = 'abc123' + /** + * If provided, the trigger will only be deleted if the etag matches the + * current etag on the resource. + */ + // const etag = 'abc123' + /** + * If set to true, and the trigger is not found, the request will succeed + * but no action will be taken on the server. + */ + // const allowMissing = true + /** + * Required. If set, validate the request and preview the review, but do not + * post it. + */ + // const validateOnly = true + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callDeleteTrigger() { + // Construct request + const request = { + name, + validateOnly, + }; + + // Run request + const [operation] = await eventarcClient.deleteTrigger(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteTrigger(); + // [END eventarc_v1_generated_Eventarc_DeleteTrigger_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/eventarc.get_channel.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel.js new file mode 100644 index 0000000..b6bb092 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START eventarc_v1_generated_Eventarc_GetChannel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the channel to get. + */ + // const name = 'abc123' + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callGetChannel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await eventarcClient.getChannel(request); + console.log(response); + } + + callGetChannel(); + // [END eventarc_v1_generated_Eventarc_GetChannel_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/eventarc.get_channel_connection.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel_connection.js new file mode 100644 index 0000000..d19d7a1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel_connection.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START eventarc_v1_generated_Eventarc_GetChannelConnection_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the channel connection to get. + */ + // const name = 'abc123' + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callGetChannelConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await eventarcClient.getChannelConnection(request); + console.log(response); + } + + callGetChannelConnection(); + // [END eventarc_v1_generated_Eventarc_GetChannelConnection_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/eventarc.get_trigger.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.get_trigger.js new file mode 100644 index 0000000..fd643bc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.get_trigger.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START eventarc_v1_generated_Eventarc_GetTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the trigger to get. + */ + // const name = 'abc123' + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callGetTrigger() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await eventarcClient.getTrigger(request); + console.log(response); + } + + callGetTrigger(); + // [END eventarc_v1_generated_Eventarc_GetTrigger_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/eventarc.list_channel_connections.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.list_channel_connections.js new file mode 100644 index 0000000..f97dc60 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.list_channel_connections.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START eventarc_v1_generated_Eventarc_ListChannelConnections_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent collection from which to list channel connections. + */ + // const parent = 'abc123' + /** + * The maximum number of channel connections to return on each page. + * Note: The service may send fewer responses. + */ + // const pageSize = 1234 + /** + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannelConnections` call to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListChannelConnetions` + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callListChannelConnections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await eventarcClient.listChannelConnectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListChannelConnections(); + // [END eventarc_v1_generated_Eventarc_ListChannelConnections_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/eventarc.list_channels.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.list_channels.js new file mode 100644 index 0000000..39aae9a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.list_channels.js @@ -0,0 +1,74 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START eventarc_v1_generated_Eventarc_ListChannels_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent collection to list channels on. + */ + // const parent = 'abc123' + /** + * The maximum number of channels to return on each page. + * Note: The service may send fewer. + */ + // const pageSize = 1234 + /** + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannels` call to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListChannels` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, channel_id`. + */ + // const orderBy = 'abc123' + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callListChannels() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await eventarcClient.listChannelsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListChannels(); + // [END eventarc_v1_generated_Eventarc_ListChannels_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/eventarc.list_triggers.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.list_triggers.js new file mode 100644 index 0000000..ea7d7cb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.list_triggers.js @@ -0,0 +1,74 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START eventarc_v1_generated_Eventarc_ListTriggers_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent collection to list triggers on. + */ + // const parent = 'abc123' + /** + * The maximum number of triggers to return on each page. + * Note: The service may send fewer. + */ + // const pageSize = 1234 + /** + * The page token; provide the value from the `next_page_token` field in a + * previous `ListTriggers` call to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListTriggers` must match + * the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, trigger_id`. + */ + // const orderBy = 'abc123' + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callListTriggers() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await eventarcClient.listTriggersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListTriggers(); + // [END eventarc_v1_generated_Eventarc_ListTriggers_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/eventarc.update_channel.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.update_channel.js new file mode 100644 index 0000000..717ef14 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.update_channel.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(validateOnly) { + // [START eventarc_v1_generated_Eventarc_UpdateChannel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The channel to be updated. + */ + // const channel = {} + /** + * The fields to be updated; only fields explicitly provided are updated. + * If no field mask is provided, all provided fields in the request are + * updated. To update all fields, provide a field mask of "*". + */ + // const updateMask = {} + /** + * Required. If set, validate the request and preview the review, but do not + * post it. + */ + // const validateOnly = true + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callUpdateChannel() { + // Construct request + const request = { + validateOnly, + }; + + // Run request + const [operation] = await eventarcClient.updateChannel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateChannel(); + // [END eventarc_v1_generated_Eventarc_UpdateChannel_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/eventarc.update_trigger.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.update_trigger.js new file mode 100644 index 0000000..8dc6411 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/eventarc.update_trigger.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(validateOnly) { + // [START eventarc_v1_generated_Eventarc_UpdateTrigger_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The trigger to be updated. + */ + // const trigger = {} + /** + * The fields to be updated; only fields explicitly provided are updated. + * If no field mask is provided, all provided fields in the request are + * updated. To update all fields, provide a field mask of "*". + */ + // const updateMask = {} + /** + * If set to true, and the trigger is not found, a new trigger will be + * created. In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + /** + * Required. If set, validate the request and preview the review, but do not + * post it. + */ + // const validateOnly = true + + // Imports the Eventarc library + const {EventarcClient} = require('@google-cloud/eventarc').v1; + + // Instantiates a client + const eventarcClient = new EventarcClient(); + + async function callUpdateTrigger() { + // Construct request + const request = { + validateOnly, + }; + + // Run request + const [operation] = await eventarcClient.updateTrigger(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateTrigger(); + // [END eventarc_v1_generated_Eventarc_UpdateTrigger_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..54f1ed7 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// 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 EventarcClient = v1.EventarcClient; +type EventarcClient = v1.EventarcClient; +export {v1, EventarcClient}; +export default {v1, EventarcClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/eventarc_client.ts b/owl-bot-staging/v1/src/v1/eventarc_client.ts new file mode 100644 index 0000000..3c5e361 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/eventarc_client.ts @@ -0,0 +1,2204 @@ +// 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/eventarc_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './eventarc_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Eventarc allows users to subscribe to various events that are provided by + * Google Cloud services and forward them to supported destinations. + * @class + * @memberof v1 + */ +export class EventarcClient { + 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}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + eventarcStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EventarcClient. + * + * @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/master/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} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EventarcClient; + 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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; + } + + // 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 = { + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + channelConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channelConnections/{channel_connection}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + triggerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/triggers/{trigger}' + ), + }; + + // 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 = { + listTriggers: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'triggers'), + listChannels: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'channels'), + listChannelConnections: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'channelConnections') + }; + + 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. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const createTriggerResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Trigger') as gax.protobuf.Type; + const createTriggerMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; + const updateTriggerResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Trigger') as gax.protobuf.Type; + const updateTriggerMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; + const deleteTriggerResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Trigger') as gax.protobuf.Type; + const deleteTriggerMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; + const createChannelResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Channel') as gax.protobuf.Type; + const createChannelMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; + const updateChannelResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Channel') as gax.protobuf.Type; + const updateChannelMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; + const deleteChannelResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Channel') as gax.protobuf.Type; + const deleteChannelMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; + const createChannelConnectionResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.ChannelConnection') as gax.protobuf.Type; + const createChannelConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; + const deleteChannelConnectionResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.ChannelConnection') as gax.protobuf.Type; + const deleteChannelConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createTrigger: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createTriggerResponse.decode.bind(createTriggerResponse), + createTriggerMetadata.decode.bind(createTriggerMetadata)), + updateTrigger: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateTriggerResponse.decode.bind(updateTriggerResponse), + updateTriggerMetadata.decode.bind(updateTriggerMetadata)), + deleteTrigger: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteTriggerResponse.decode.bind(deleteTriggerResponse), + deleteTriggerMetadata.decode.bind(deleteTriggerMetadata)), + createChannel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createChannelResponse.decode.bind(createChannelResponse), + createChannelMetadata.decode.bind(createChannelMetadata)), + updateChannel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateChannelResponse.decode.bind(updateChannelResponse), + updateChannelMetadata.decode.bind(updateChannelMetadata)), + deleteChannel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteChannelResponse.decode.bind(deleteChannelResponse), + deleteChannelMetadata.decode.bind(deleteChannelMetadata)), + createChannelConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createChannelConnectionResponse.decode.bind(createChannelConnectionResponse), + createChannelConnectionMetadata.decode.bind(createChannelConnectionMetadata)), + deleteChannelConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteChannelConnectionResponse.decode.bind(deleteChannelConnectionResponse), + deleteChannelConnectionMetadata.decode.bind(deleteChannelConnectionMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.eventarc.v1.Eventarc', 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 = gax.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.eventarcStub) { + return this.eventarcStub; + } + + // Put together the "service stub" for + // google.cloud.eventarc.v1.Eventarc. + this.eventarcStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.eventarc.v1.Eventarc') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.eventarc.v1.Eventarc, + 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 eventarcStubMethods = + ['getTrigger', 'listTriggers', 'createTrigger', 'updateTrigger', 'deleteTrigger', 'getChannel', 'listChannels', 'createChannel', 'updateChannel', 'deleteChannel', 'getChannelConnection', 'listChannelConnections', 'createChannelConnection', 'deleteChannelConnection']; + for (const methodName of eventarcStubMethods) { + const callPromise = this.eventarcStub.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] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.eventarcStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'eventarc.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 'eventarc.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 -- + // ------------------- +/** + * Get a single trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the trigger to get. + * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger}. + * 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/eventarc.get_trigger.js + * region_tag:eventarc_v1_generated_Eventarc_GetTrigger_async + */ + getTrigger( + request?: protos.google.cloud.eventarc.v1.IGetTriggerRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.eventarc.v1.ITrigger, + protos.google.cloud.eventarc.v1.IGetTriggerRequest|undefined, {}|undefined + ]>; + getTrigger( + request: protos.google.cloud.eventarc.v1.IGetTriggerRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.eventarc.v1.ITrigger, + protos.google.cloud.eventarc.v1.IGetTriggerRequest|null|undefined, + {}|null|undefined>): void; + getTrigger( + request: protos.google.cloud.eventarc.v1.IGetTriggerRequest, + callback: Callback< + protos.google.cloud.eventarc.v1.ITrigger, + protos.google.cloud.eventarc.v1.IGetTriggerRequest|null|undefined, + {}|null|undefined>): void; + getTrigger( + request?: protos.google.cloud.eventarc.v1.IGetTriggerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.eventarc.v1.ITrigger, + protos.google.cloud.eventarc.v1.IGetTriggerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.eventarc.v1.ITrigger, + protos.google.cloud.eventarc.v1.IGetTriggerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.eventarc.v1.ITrigger, + protos.google.cloud.eventarc.v1.IGetTriggerRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getTrigger(request, options, callback); + } +/** + * Get a single Channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the channel to get. + * @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 [Channel]{@link google.cloud.eventarc.v1.Channel}. + * 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/eventarc.get_channel.js + * region_tag:eventarc_v1_generated_Eventarc_GetChannel_async + */ + getChannel( + request?: protos.google.cloud.eventarc.v1.IGetChannelRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest|undefined, {}|undefined + ]>; + getChannel( + request: protos.google.cloud.eventarc.v1.IGetChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest|null|undefined, + {}|null|undefined>): void; + getChannel( + request: protos.google.cloud.eventarc.v1.IGetChannelRequest, + callback: Callback< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest|null|undefined, + {}|null|undefined>): void; + getChannel( + request?: protos.google.cloud.eventarc.v1.IGetChannelRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getChannel(request, options, callback); + } +/** + * Get a single ChannelConnection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the channel connection to get. + * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. + * 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/eventarc.get_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_GetChannelConnection_async + */ + getChannelConnection( + request?: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|undefined, {}|undefined + ]>; + getChannelConnection( + request: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|null|undefined, + {}|null|undefined>): void; + getChannelConnection( + request: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, + callback: Callback< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|null|undefined, + {}|null|undefined>): void; + getChannelConnection( + request?: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getChannelConnection(request, options, callback); + } + +/** + * Create a new trigger in a particular project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection in which to add this trigger. + * @param {google.cloud.eventarc.v1.Trigger} request.trigger + * Required. The trigger to create. + * @param {string} request.triggerId + * Required. The user-provided ID to be assigned to the trigger. + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. + * @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/eventarc.create_trigger.js + * region_tag:eventarc_v1_generated_Eventarc_CreateTrigger_async + */ + createTrigger( + request?: protos.google.cloud.eventarc.v1.ICreateTriggerRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createTrigger( + request: protos.google.cloud.eventarc.v1.ICreateTriggerRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createTrigger( + request: protos.google.cloud.eventarc.v1.ICreateTriggerRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createTrigger( + request?: protos.google.cloud.eventarc.v1.ICreateTriggerRequest, + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createTrigger(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createTrigger()`. + * @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/eventarc.create_trigger.js + * region_tag:eventarc_v1_generated_Eventarc_CreateTrigger_async + */ + async checkCreateTriggerProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createTrigger, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a single trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.eventarc.v1.Trigger} request.trigger + * The trigger to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The fields to be updated; only fields explicitly provided are updated. + * If no field mask is provided, all provided fields in the request are + * updated. To update all fields, provide a field mask of "*". + * @param {boolean} request.allowMissing + * If set to true, and the trigger is not found, a new trigger will be + * created. In this situation, `update_mask` is ignored. + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. + * @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/eventarc.update_trigger.js + * region_tag:eventarc_v1_generated_Eventarc_UpdateTrigger_async + */ + updateTrigger( + request?: protos.google.cloud.eventarc.v1.IUpdateTriggerRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateTrigger( + request: protos.google.cloud.eventarc.v1.IUpdateTriggerRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateTrigger( + request: protos.google.cloud.eventarc.v1.IUpdateTriggerRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateTrigger( + request?: protos.google.cloud.eventarc.v1.IUpdateTriggerRequest, + 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' + ] = gax.routingHeader.fromParams({ + 'trigger.name': request.trigger!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateTrigger(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateTrigger()`. + * @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/eventarc.update_trigger.js + * region_tag:eventarc_v1_generated_Eventarc_UpdateTrigger_async + */ + async checkUpdateTriggerProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateTrigger, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Delete a single trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the trigger to be deleted. + * @param {string} request.etag + * If provided, the trigger will only be deleted if the etag matches the + * current etag on the resource. + * @param {boolean} request.allowMissing + * If set to true, and the trigger is not found, the request will succeed + * but no action will be taken on the server. + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. + * @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/eventarc.delete_trigger.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteTrigger_async + */ + deleteTrigger( + request?: protos.google.cloud.eventarc.v1.IDeleteTriggerRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteTrigger( + request: protos.google.cloud.eventarc.v1.IDeleteTriggerRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteTrigger( + request: protos.google.cloud.eventarc.v1.IDeleteTriggerRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteTrigger( + request?: protos.google.cloud.eventarc.v1.IDeleteTriggerRequest, + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteTrigger(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteTrigger()`. + * @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/eventarc.delete_trigger.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteTrigger_async + */ + async checkDeleteTriggerProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteTrigger, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Create a new channel in a particular project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection in which to add this channel. + * @param {google.cloud.eventarc.v1.Channel} request.channel + * Required. The channel to create. + * @param {string} request.channelId + * Required. The user-provided ID to be assigned to the channel. + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. + * @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/eventarc.create_channel.js + * region_tag:eventarc_v1_generated_Eventarc_CreateChannel_async + */ + createChannel( + request?: protos.google.cloud.eventarc.v1.ICreateChannelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createChannel( + request: protos.google.cloud.eventarc.v1.ICreateChannelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createChannel( + request: protos.google.cloud.eventarc.v1.ICreateChannelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createChannel( + request?: protos.google.cloud.eventarc.v1.ICreateChannelRequest, + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createChannel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createChannel()`. + * @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/eventarc.create_channel.js + * region_tag:eventarc_v1_generated_Eventarc_CreateChannel_async + */ + async checkCreateChannelProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createChannel, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Update a single channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.eventarc.v1.Channel} request.channel + * The channel to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The fields to be updated; only fields explicitly provided are updated. + * If no field mask is provided, all provided fields in the request are + * updated. To update all fields, provide a field mask of "*". + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. + * @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/eventarc.update_channel.js + * region_tag:eventarc_v1_generated_Eventarc_UpdateChannel_async + */ + updateChannel( + request?: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateChannel( + request: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateChannel( + request: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateChannel( + request?: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, + 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' + ] = gax.routingHeader.fromParams({ + 'channel.name': request.channel!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateChannel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateChannel()`. + * @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/eventarc.update_channel.js + * region_tag:eventarc_v1_generated_Eventarc_UpdateChannel_async + */ + async checkUpdateChannelProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateChannel, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Delete a single channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the channel to be deleted. + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. + * @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/eventarc.delete_channel.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteChannel_async + */ + deleteChannel( + request?: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteChannel( + request: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteChannel( + request: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteChannel( + request?: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteChannel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteChannel()`. + * @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/eventarc.delete_channel.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteChannel_async + */ + async checkDeleteChannelProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteChannel, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Create a new ChannelConnection in a particular project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection in which to add this channel connection. + * @param {google.cloud.eventarc.v1.ChannelConnection} request.channelConnection + * Required. Channel connection to create. + * @param {string} request.channelConnectionId + * Required. The user-provided ID to be assigned to the channel connection. + * @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/eventarc.create_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_CreateChannelConnection_async + */ + createChannelConnection( + request?: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createChannelConnection( + request: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createChannelConnection( + request: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createChannelConnection( + request?: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createChannelConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createChannelConnection()`. + * @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/eventarc.create_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_CreateChannelConnection_async + */ + async checkCreateChannelConnectionProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createChannelConnection, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Delete a single ChannelConnection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the channel connection to delete. + * @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/eventarc.delete_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteChannelConnection_async + */ + deleteChannelConnection( + request?: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteChannelConnection( + request: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteChannelConnection( + request: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteChannelConnection( + request?: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteChannelConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteChannelConnection()`. + * @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/eventarc.delete_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteChannelConnection_async + */ + async checkDeleteChannelConnectionProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteChannelConnection, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * List triggers. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection to list triggers on. + * @param {number} request.pageSize + * The maximum number of triggers to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListTriggers` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTriggers` must match + * the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, trigger_id`. + * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger}. + * 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 `listTriggersAsync()` + * 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. + */ + listTriggers( + request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.eventarc.v1.ITrigger[], + protos.google.cloud.eventarc.v1.IListTriggersRequest|null, + protos.google.cloud.eventarc.v1.IListTriggersResponse + ]>; + listTriggers( + request: protos.google.cloud.eventarc.v1.IListTriggersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListTriggersRequest, + protos.google.cloud.eventarc.v1.IListTriggersResponse|null|undefined, + protos.google.cloud.eventarc.v1.ITrigger>): void; + listTriggers( + request: protos.google.cloud.eventarc.v1.IListTriggersRequest, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListTriggersRequest, + protos.google.cloud.eventarc.v1.IListTriggersResponse|null|undefined, + protos.google.cloud.eventarc.v1.ITrigger>): void; + listTriggers( + request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.eventarc.v1.IListTriggersRequest, + protos.google.cloud.eventarc.v1.IListTriggersResponse|null|undefined, + protos.google.cloud.eventarc.v1.ITrigger>, + callback?: PaginationCallback< + protos.google.cloud.eventarc.v1.IListTriggersRequest, + protos.google.cloud.eventarc.v1.IListTriggersResponse|null|undefined, + protos.google.cloud.eventarc.v1.ITrigger>): + Promise<[ + protos.google.cloud.eventarc.v1.ITrigger[], + protos.google.cloud.eventarc.v1.IListTriggersRequest|null, + protos.google.cloud.eventarc.v1.IListTriggersResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listTriggers(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 collection to list triggers on. + * @param {number} request.pageSize + * The maximum number of triggers to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListTriggers` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTriggers` must match + * the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, trigger_id`. + * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger} 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 `listTriggersAsync()` + * 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. + */ + listTriggersStream( + request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTriggers.createStream( + this.innerApiCalls.listTriggers as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listTriggers`, 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 collection to list triggers on. + * @param {number} request.pageSize + * The maximum number of triggers to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListTriggers` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTriggers` must match + * the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, trigger_id`. + * @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 + * [Trigger]{@link google.cloud.eventarc.v1.Trigger}. 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/eventarc.list_triggers.js + * region_tag:eventarc_v1_generated_Eventarc_ListTriggers_async + */ + listTriggersAsync( + request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTriggers.asyncIterate( + this.innerApiCalls['listTriggers'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List channels. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection to list channels on. + * @param {number} request.pageSize + * The maximum number of channels to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannels` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannels` must + * match the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, channel_id`. + * @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 [Channel]{@link google.cloud.eventarc.v1.Channel}. + * 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 `listChannelsAsync()` + * 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. + */ + listChannels( + request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.eventarc.v1.IChannel[], + protos.google.cloud.eventarc.v1.IListChannelsRequest|null, + protos.google.cloud.eventarc.v1.IListChannelsResponse + ]>; + listChannels( + request: protos.google.cloud.eventarc.v1.IListChannelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelsRequest, + protos.google.cloud.eventarc.v1.IListChannelsResponse|null|undefined, + protos.google.cloud.eventarc.v1.IChannel>): void; + listChannels( + request: protos.google.cloud.eventarc.v1.IListChannelsRequest, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelsRequest, + protos.google.cloud.eventarc.v1.IListChannelsResponse|null|undefined, + protos.google.cloud.eventarc.v1.IChannel>): void; + listChannels( + request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelsRequest, + protos.google.cloud.eventarc.v1.IListChannelsResponse|null|undefined, + protos.google.cloud.eventarc.v1.IChannel>, + callback?: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelsRequest, + protos.google.cloud.eventarc.v1.IListChannelsResponse|null|undefined, + protos.google.cloud.eventarc.v1.IChannel>): + Promise<[ + protos.google.cloud.eventarc.v1.IChannel[], + protos.google.cloud.eventarc.v1.IListChannelsRequest|null, + protos.google.cloud.eventarc.v1.IListChannelsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listChannels(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 collection to list channels on. + * @param {number} request.pageSize + * The maximum number of channels to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannels` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannels` must + * match the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, channel_id`. + * @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 [Channel]{@link google.cloud.eventarc.v1.Channel} 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 `listChannelsAsync()` + * 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. + */ + listChannelsStream( + request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listChannels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listChannels.createStream( + this.innerApiCalls.listChannels as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listChannels`, 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 collection to list channels on. + * @param {number} request.pageSize + * The maximum number of channels to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannels` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannels` must + * match the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, channel_id`. + * @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 + * [Channel]{@link google.cloud.eventarc.v1.Channel}. 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/eventarc.list_channels.js + * region_tag:eventarc_v1_generated_Eventarc_ListChannels_async + */ + listChannelsAsync( + request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listChannels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listChannels.asyncIterate( + this.innerApiCalls['listChannels'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List channel connections. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection from which to list channel connections. + * @param {number} request.pageSize + * The maximum number of channel connections to return on each page. + * Note: The service may send fewer responses. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannelConnections` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannelConnetions` + * match the call that provided the page token. + * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. + * 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 `listChannelConnectionsAsync()` + * 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. + */ + listChannelConnections( + request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.eventarc.v1.IChannelConnection[], + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest|null, + protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse + ]>; + listChannelConnections( + request: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse|null|undefined, + protos.google.cloud.eventarc.v1.IChannelConnection>): void; + listChannelConnections( + request: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse|null|undefined, + protos.google.cloud.eventarc.v1.IChannelConnection>): void; + listChannelConnections( + request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse|null|undefined, + protos.google.cloud.eventarc.v1.IChannelConnection>, + callback?: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse|null|undefined, + protos.google.cloud.eventarc.v1.IChannelConnection>): + Promise<[ + protos.google.cloud.eventarc.v1.IChannelConnection[], + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest|null, + protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listChannelConnections(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 collection from which to list channel connections. + * @param {number} request.pageSize + * The maximum number of channel connections to return on each page. + * Note: The service may send fewer responses. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannelConnections` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannelConnetions` + * match the call that provided the page token. + * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection} 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 `listChannelConnectionsAsync()` + * 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. + */ + listChannelConnectionsStream( + request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listChannelConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listChannelConnections.createStream( + this.innerApiCalls.listChannelConnections as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listChannelConnections`, 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 collection from which to list channel connections. + * @param {number} request.pageSize + * The maximum number of channel connections to return on each page. + * Note: The service may send fewer responses. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannelConnections` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannelConnetions` + * match the call that provided the 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 + * [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. 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/eventarc.list_channel_connections.js + * region_tag:eventarc_v1_generated_Eventarc_ListChannelConnections_async + */ + listChannelConnectionsAsync( + request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listChannelConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listChannelConnections.asyncIterate( + this.innerApiCalls['listChannelConnections'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project:string,location:string,channel:string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified channelConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel_connection + * @returns {string} Resource name string. + */ + channelConnectionPath(project:string,location:string,channelConnection:string) { + return this.pathTemplates.channelConnectionPathTemplate.render({ + project: project, + location: location, + channel_connection: channelConnection, + }); + } + + /** + * Parse the project from ChannelConnection resource. + * + * @param {string} channelConnectionName + * A fully-qualified path representing ChannelConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelConnectionName(channelConnectionName: string) { + return this.pathTemplates.channelConnectionPathTemplate.match(channelConnectionName).project; + } + + /** + * Parse the location from ChannelConnection resource. + * + * @param {string} channelConnectionName + * A fully-qualified path representing ChannelConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelConnectionName(channelConnectionName: string) { + return this.pathTemplates.channelConnectionPathTemplate.match(channelConnectionName).location; + } + + /** + * Parse the channel_connection from ChannelConnection resource. + * + * @param {string} channelConnectionName + * A fully-qualified path representing ChannelConnection resource. + * @returns {string} A string representing the channel_connection. + */ + matchChannelConnectionFromChannelConnectionName(channelConnectionName: string) { + return this.pathTemplates.channelConnectionPathTemplate.match(channelConnectionName).channel_connection; + } + + /** + * 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 trigger resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} trigger + * @returns {string} Resource name string. + */ + triggerPath(project:string,location:string,trigger:string) { + return this.pathTemplates.triggerPathTemplate.render({ + project: project, + location: location, + trigger: trigger, + }); + } + + /** + * Parse the project from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).project; + } + + /** + * Parse the location from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).location; + } + + /** + * Parse the trigger from Trigger resource. + * + * @param {string} triggerName + * A fully-qualified path representing Trigger resource. + * @returns {string} A string representing the trigger. + */ + matchTriggerFromTriggerName(triggerName: string) { + return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; + } + + /** + * 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 { + this.initialize(); + if (!this._terminated) { + return this.eventarcStub!.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/eventarc_client_config.json b/owl-bot-staging/v1/src/v1/eventarc_client_config.json new file mode 100644 index 0000000..656b6b2 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/eventarc_client_config.json @@ -0,0 +1,82 @@ +{ + "interfaces": { + "google.cloud.eventarc.v1.Eventarc": { + "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": { + "GetTrigger": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListTriggers": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateTrigger": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateTrigger": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteTrigger": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetChannel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListChannels": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateChannel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateChannel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteChannel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetChannelConnection": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListChannelConnections": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateChannelConnection": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteChannelConnection": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/eventarc_proto_list.json b/owl-bot-staging/v1/src/v1/eventarc_proto_list.json new file mode 100644 index 0000000..bc82a79 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/eventarc_proto_list.json @@ -0,0 +1,6 @@ +[ + "../../protos/google/cloud/eventarc/v1/channel.proto", + "../../protos/google/cloud/eventarc/v1/channel_connection.proto", + "../../protos/google/cloud/eventarc/v1/eventarc.proto", + "../../protos/google/cloud/eventarc/v1/trigger.proto" +] 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..95b183d --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,175 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.eventarc.v1", + "libraryPackage": "@google-cloud/eventarc", + "services": { + "Eventarc": { + "clients": { + "grpc": { + "libraryClient": "EventarcClient", + "rpcs": { + "GetTrigger": { + "methods": [ + "getTrigger" + ] + }, + "GetChannel": { + "methods": [ + "getChannel" + ] + }, + "GetChannelConnection": { + "methods": [ + "getChannelConnection" + ] + }, + "CreateTrigger": { + "methods": [ + "createTrigger" + ] + }, + "UpdateTrigger": { + "methods": [ + "updateTrigger" + ] + }, + "DeleteTrigger": { + "methods": [ + "deleteTrigger" + ] + }, + "CreateChannel": { + "methods": [ + "createChannel" + ] + }, + "UpdateChannel": { + "methods": [ + "updateChannel" + ] + }, + "DeleteChannel": { + "methods": [ + "deleteChannel" + ] + }, + "CreateChannelConnection": { + "methods": [ + "createChannelConnection" + ] + }, + "DeleteChannelConnection": { + "methods": [ + "deleteChannelConnection" + ] + }, + "ListTriggers": { + "methods": [ + "listTriggers", + "listTriggersStream", + "listTriggersAsync" + ] + }, + "ListChannels": { + "methods": [ + "listChannels", + "listChannelsStream", + "listChannelsAsync" + ] + }, + "ListChannelConnections": { + "methods": [ + "listChannelConnections", + "listChannelConnectionsStream", + "listChannelConnectionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EventarcClient", + "rpcs": { + "GetTrigger": { + "methods": [ + "getTrigger" + ] + }, + "GetChannel": { + "methods": [ + "getChannel" + ] + }, + "GetChannelConnection": { + "methods": [ + "getChannelConnection" + ] + }, + "CreateTrigger": { + "methods": [ + "createTrigger" + ] + }, + "UpdateTrigger": { + "methods": [ + "updateTrigger" + ] + }, + "DeleteTrigger": { + "methods": [ + "deleteTrigger" + ] + }, + "CreateChannel": { + "methods": [ + "createChannel" + ] + }, + "UpdateChannel": { + "methods": [ + "updateChannel" + ] + }, + "DeleteChannel": { + "methods": [ + "deleteChannel" + ] + }, + "CreateChannelConnection": { + "methods": [ + "createChannelConnection" + ] + }, + "DeleteChannelConnection": { + "methods": [ + "deleteChannelConnection" + ] + }, + "ListTriggers": { + "methods": [ + "listTriggers", + "listTriggersStream", + "listTriggersAsync" + ] + }, + "ListChannels": { + "methods": [ + "listChannels", + "listChannelsStream", + "listChannelsAsync" + ] + }, + "ListChannelConnections": { + "methods": [ + "listChannelConnections", + "listChannelConnectionsStream", + "listChannelConnectionsAsync" + ] + } + } + } + } + } + } +} 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..8f9bb91 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// 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 {EventarcClient} from './eventarc_client'; 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..92505d9 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const eventarc = require('@google-cloud/eventarc'); + +function main() { + const eventarcClient = new eventarc.EventarcClient(); +} + +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..4346b31 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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 {EventarcClient} from '@google-cloud/eventarc'; + +// check that the client class type name can be used +function doStuffWithEventarcClient(client: EventarcClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const eventarcClient = new EventarcClient(); + doStuffWithEventarcClient(eventarcClient); +} + +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..8ec4522 --- /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_eventarc_v1.ts b/owl-bot-staging/v1/test/gapic_eventarc_v1.ts new file mode 100644 index 0000000..0e0dc49 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_eventarc_v1.ts @@ -0,0 +1,2473 @@ +// 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 eventarcModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +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 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.EventarcClient', () => { + it('has servicePath', () => { + const servicePath = eventarcModule.v1.EventarcClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = eventarcModule.v1.EventarcClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = eventarcModule.v1.EventarcClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new eventarcModule.v1.EventarcClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new eventarcModule.v1.EventarcClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.eventarcStub, undefined); + await client.initialize(); + assert(client.eventarcStub); + }); + + it('has close method', () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new eventarcModule.v1.EventarcClient({ + 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 eventarcModule.v1.EventarcClient({ + 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('getTrigger', () => { + it('invokes getTrigger without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetTriggerRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()); + client.innerApiCalls.getTrigger = stubSimpleCall(expectedResponse); + const [response] = await client.getTrigger(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getTrigger without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetTriggerRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()); + client.innerApiCalls.getTrigger = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTrigger( + request, + (err?: Error|null, result?: protos.google.cloud.eventarc.v1.ITrigger|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getTrigger with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetTriggerRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getTrigger = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getTrigger(request), expectedError); + assert((client.innerApiCalls.getTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getChannel', () => { + it('invokes getChannel without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()); + client.innerApiCalls.getChannel = stubSimpleCall(expectedResponse); + const [response] = await client.getChannel(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getChannel without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()); + client.innerApiCalls.getChannel = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getChannel( + request, + (err?: Error|null, result?: protos.google.cloud.eventarc.v1.IChannel|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getChannel with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getChannel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getChannel(request), expectedError); + assert((client.innerApiCalls.getChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getChannelConnection', () => { + it('invokes getChannelConnection without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()); + client.innerApiCalls.getChannelConnection = stubSimpleCall(expectedResponse); + const [response] = await client.getChannelConnection(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getChannelConnection without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()); + client.innerApiCalls.getChannelConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getChannelConnection( + request, + (err?: Error|null, result?: protos.google.cloud.eventarc.v1.IChannelConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getChannelConnection with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getChannelConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getChannelConnection(request), expectedError); + assert((client.innerApiCalls.getChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createTrigger', () => { + it('invokes createTrigger without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateTriggerRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createTrigger = stubLongRunningCall(expectedResponse); + const [operation] = await client.createTrigger(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTrigger without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateTriggerRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createTrigger = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTrigger( + 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); + assert((client.innerApiCalls.createTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createTrigger with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateTriggerRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTrigger = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createTrigger(request), expectedError); + assert((client.innerApiCalls.createTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createTrigger with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateTriggerRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTrigger = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createTrigger(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateTriggerProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateTriggerProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateTriggerProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateTriggerProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateTrigger', () => { + it('invokes updateTrigger without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateTriggerRequest()); + request.trigger = {}; + request.trigger.name = ''; + const expectedHeaderRequestParams = "trigger.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateTrigger = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateTrigger(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateTrigger without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateTriggerRequest()); + request.trigger = {}; + request.trigger.name = ''; + const expectedHeaderRequestParams = "trigger.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateTrigger = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTrigger( + 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); + assert((client.innerApiCalls.updateTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateTrigger with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateTriggerRequest()); + request.trigger = {}; + request.trigger.name = ''; + const expectedHeaderRequestParams = "trigger.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTrigger = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateTrigger(request), expectedError); + assert((client.innerApiCalls.updateTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateTrigger with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateTriggerRequest()); + request.trigger = {}; + request.trigger.name = ''; + const expectedHeaderRequestParams = "trigger.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTrigger = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateTrigger(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateTriggerProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkUpdateTriggerProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateTriggerProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkUpdateTriggerProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteTrigger', () => { + it('invokes deleteTrigger without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteTriggerRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteTrigger = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteTrigger(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteTrigger without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteTriggerRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteTrigger = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTrigger( + 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); + assert((client.innerApiCalls.deleteTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteTrigger with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteTriggerRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTrigger = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteTrigger(request), expectedError); + assert((client.innerApiCalls.deleteTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteTrigger with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteTriggerRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTrigger = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteTrigger(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteTrigger as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteTriggerProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteTriggerProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteTriggerProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteTriggerProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createChannel', () => { + it('invokes createChannel without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createChannel = stubLongRunningCall(expectedResponse); + const [operation] = await client.createChannel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createChannel without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createChannel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createChannel( + 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); + assert((client.innerApiCalls.createChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createChannel with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createChannel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createChannel(request), expectedError); + assert((client.innerApiCalls.createChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createChannel with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createChannel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createChannel(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateChannelProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateChannelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateChannelProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateChannelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateChannel', () => { + it('invokes updateChannel without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateChannelRequest()); + request.channel = {}; + request.channel.name = ''; + const expectedHeaderRequestParams = "channel.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateChannel = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateChannel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateChannel without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateChannelRequest()); + request.channel = {}; + request.channel.name = ''; + const expectedHeaderRequestParams = "channel.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateChannel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateChannel( + 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); + assert((client.innerApiCalls.updateChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateChannel with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateChannelRequest()); + request.channel = {}; + request.channel.name = ''; + const expectedHeaderRequestParams = "channel.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateChannel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateChannel(request), expectedError); + assert((client.innerApiCalls.updateChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateChannel with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateChannelRequest()); + request.channel = {}; + request.channel.name = ''; + const expectedHeaderRequestParams = "channel.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateChannel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateChannel(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateChannelProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkUpdateChannelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateChannelProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkUpdateChannelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteChannel', () => { + it('invokes deleteChannel without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteChannel = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteChannel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteChannel without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteChannel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteChannel( + 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); + assert((client.innerApiCalls.deleteChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteChannel with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteChannel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteChannel(request), expectedError); + assert((client.innerApiCalls.deleteChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteChannel with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteChannel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteChannel(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteChannel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteChannelProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteChannelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteChannelProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteChannelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createChannelConnection', () => { + it('invokes createChannelConnection without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createChannelConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.createChannelConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createChannelConnection without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createChannelConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createChannelConnection( + 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); + assert((client.innerApiCalls.createChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createChannelConnection with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createChannelConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createChannelConnection(request), expectedError); + assert((client.innerApiCalls.createChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createChannelConnection with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createChannelConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createChannelConnection(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateChannelConnectionProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateChannelConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateChannelConnectionProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateChannelConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteChannelConnection', () => { + it('invokes deleteChannelConnection without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteChannelConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteChannelConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteChannelConnection without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteChannelConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteChannelConnection( + 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); + assert((client.innerApiCalls.deleteChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteChannelConnection with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteChannelConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteChannelConnection(request), expectedError); + assert((client.innerApiCalls.deleteChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteChannelConnection with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteChannelConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteChannelConnection(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteChannelConnection as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteChannelConnectionProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteChannelConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteChannelConnectionProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteChannelConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listTriggers', () => { + it('invokes listTriggers without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + ]; + client.innerApiCalls.listTriggers = stubSimpleCall(expectedResponse); + const [response] = await client.listTriggers(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTriggers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTriggers without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + ]; + client.innerApiCalls.listTriggers = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTriggers( + request, + (err?: Error|null, result?: protos.google.cloud.eventarc.v1.ITrigger[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listTriggers as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listTriggers with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listTriggers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listTriggers(request), expectedError); + assert((client.innerApiCalls.listTriggers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listTriggersStream without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + ]; + client.descriptors.page.listTriggers.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.Trigger[] = []; + stream.on('data', (response: protos.google.cloud.eventarc.v1.Trigger) => { + 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.listTriggers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTriggers, request)); + assert.strictEqual( + (client.descriptors.page.listTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listTriggersStream with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listTriggers.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.Trigger[] = []; + stream.on('data', (response: protos.google.cloud.eventarc.v1.Trigger) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listTriggers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listTriggers, request)); + assert.strictEqual( + (client.descriptors.page.listTriggers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTriggers without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + ]; + client.descriptors.page.listTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.eventarc.v1.ITrigger[] = []; + const iterable = client.listTriggersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTriggers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTriggers with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTriggersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.eventarc.v1.ITrigger[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTriggers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listTriggers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listChannels', () => { + it('invokes listChannels without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + ]; + client.innerApiCalls.listChannels = stubSimpleCall(expectedResponse); + const [response] = await client.listChannels(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listChannels as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listChannels without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + ]; + client.innerApiCalls.listChannels = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listChannels( + request, + (err?: Error|null, result?: protos.google.cloud.eventarc.v1.IChannel[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listChannels as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listChannels with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listChannels = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listChannels(request), expectedError); + assert((client.innerApiCalls.listChannels as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listChannelsStream without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + ]; + client.descriptors.page.listChannels.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listChannelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.Channel[] = []; + stream.on('data', (response: protos.google.cloud.eventarc.v1.Channel) => { + 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.listChannels.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listChannels, request)); + assert.strictEqual( + (client.descriptors.page.listChannels.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listChannelsStream with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listChannels.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listChannelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.Channel[] = []; + stream.on('data', (response: protos.google.cloud.eventarc.v1.Channel) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listChannels.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listChannels, request)); + assert.strictEqual( + (client.descriptors.page.listChannels.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listChannels without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + ]; + client.descriptors.page.listChannels.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.eventarc.v1.IChannel[] = []; + const iterable = client.listChannelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listChannels.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listChannels.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listChannels with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listChannels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listChannelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.eventarc.v1.IChannel[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listChannels.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listChannels.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listChannelConnections', () => { + it('invokes listChannelConnections without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + ]; + client.innerApiCalls.listChannelConnections = stubSimpleCall(expectedResponse); + const [response] = await client.listChannelConnections(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listChannelConnections as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listChannelConnections without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + ]; + client.innerApiCalls.listChannelConnections = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listChannelConnections( + request, + (err?: Error|null, result?: protos.google.cloud.eventarc.v1.IChannelConnection[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listChannelConnections as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listChannelConnections with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listChannelConnections = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listChannelConnections(request), expectedError); + assert((client.innerApiCalls.listChannelConnections as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listChannelConnectionsStream without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + ]; + client.descriptors.page.listChannelConnections.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listChannelConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.ChannelConnection[] = []; + stream.on('data', (response: protos.google.cloud.eventarc.v1.ChannelConnection) => { + 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.listChannelConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listChannelConnections, request)); + assert.strictEqual( + (client.descriptors.page.listChannelConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listChannelConnectionsStream with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listChannelConnections.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listChannelConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.ChannelConnection[] = []; + stream.on('data', (response: protos.google.cloud.eventarc.v1.ChannelConnection) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listChannelConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listChannelConnections, request)); + assert.strictEqual( + (client.descriptors.page.listChannelConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listChannelConnections without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), + ]; + client.descriptors.page.listChannelConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.eventarc.v1.IChannelConnection[] = []; + const iterable = client.listChannelConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listChannelConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listChannelConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listChannelConnections with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listChannelConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listChannelConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.eventarc.v1.IChannelConnection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listChannelConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listChannelConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('channel', () => { + const fakePath = "/rendered/path/channel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + channel: "channelValue", + }; + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.channelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath("projectValue", "locationValue", "channelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, "channelValue"); + assert((client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('channelConnection', () => { + const fakePath = "/rendered/path/channelConnection"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + channel_connection: "channelConnectionValue", + }; + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelConnectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.channelConnectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('channelConnectionPath', () => { + const result = client.channelConnectionPath("projectValue", "locationValue", "channelConnectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.channelConnectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromChannelConnectionName', () => { + const result = client.matchProjectFromChannelConnectionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.channelConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromChannelConnectionName', () => { + const result = client.matchLocationFromChannelConnectionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.channelConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchChannelConnectionFromChannelConnectionName', () => { + const result = client.matchChannelConnectionFromChannelConnectionName(fakePath); + assert.strictEqual(result, "channelConnectionValue"); + assert((client.pathTemplates.channelConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new eventarcModule.v1.EventarcClient({ + 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 eventarcModule.v1.EventarcClient({ + 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('trigger', () => { + const fakePath = "/rendered/path/trigger"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + trigger: "triggerValue", + }; + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.triggerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.triggerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('triggerPath', () => { + const result = client.triggerPath("projectValue", "locationValue", "triggerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.triggerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTriggerName', () => { + const result = client.matchProjectFromTriggerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromTriggerName', () => { + const result = client.matchLocationFromTriggerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTriggerFromTriggerName', () => { + const result = client.matchTriggerFromTriggerName(fakePath); + assert.strictEqual(result, "triggerValue"); + assert((client.pathTemplates.triggerPathTemplate.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..5064b66 --- /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: 'Eventarc', + filename: './eventarc.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 edbdff6bef56b7e14c5868a67b2d44e1acdd97b6 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 3 Feb 2022 01:01:36 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= 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 | 64 - .../google/cloud/eventarc/v1/eventarc.proto | 513 -- .../google/cloud/eventarc/v1/trigger.proto | 226 - .../generated/v1/eventarc.create_trigger.js | 70 - .../generated/v1/eventarc.delete_trigger.js | 70 - .../generated/v1/eventarc.get_trigger.js | 53 - .../generated/v1/eventarc.list_triggers.js | 74 - .../generated/v1/eventarc.update_trigger.js | 70 - owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/eventarc_client.ts | 2204 ------- .../v1/src/v1/eventarc_client_config.json | 82 - .../v1/src/v1/eventarc_proto_list.json | 6 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 175 - owl-bot-staging/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - owl-bot-staging/v1/test/gapic_eventarc_v1.ts | 2473 -------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - .../google/cloud/eventarc/v1/channel.proto | 0 .../eventarc/v1/channel_connection.proto | 0 .../google/cloud/eventarc/v1/eventarc.proto | 298 +- protos/google/cloud/eventarc/v1/trigger.proto | 124 +- protos/protos.d.ts | 2365 ++++++- protos/protos.js | 5590 ++++++++++++++--- protos/protos.json | 759 ++- .../generated/v1/eventarc.create_channel.js | 0 .../v1/eventarc.create_channel_connection.js | 0 .../generated/v1/eventarc.create_trigger.js | 2 +- .../generated/v1/eventarc.delete_channel.js | 0 .../v1/eventarc.delete_channel_connection.js | 0 .../generated/v1/eventarc.delete_trigger.js | 2 +- .../generated/v1/eventarc.get_channel.js | 0 .../v1/eventarc.get_channel_connection.js | 0 .../v1/eventarc.list_channel_connections.js | 0 .../generated/v1/eventarc.list_channels.js | 0 .../generated/v1/eventarc.list_triggers.js | 6 +- .../generated/v1/eventarc.update_channel.js | 0 .../generated/v1/eventarc.update_trigger.js | 6 +- src/v1/eventarc_client.ts | 1719 ++++- src/v1/eventarc_client_config.json | 36 + src/v1/eventarc_proto_list.json | 2 + src/v1/gapic_metadata.json | 98 + test/gapic_eventarc_v1.ts | 2124 ++++++- 53 files changed, 11644 insertions(+), 7953 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/eventarc/v1/eventarc.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/eventarc/v1/trigger.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.create_trigger.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.delete_trigger.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.get_trigger.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.list_triggers.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/eventarc.update_trigger.js delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/eventarc_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/eventarc_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/eventarc_proto_list.json 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/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_eventarc_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js rename {owl-bot-staging/v1/protos => protos}/google/cloud/eventarc/v1/channel.proto (100%) rename {owl-bot-staging/v1/protos => protos}/google/cloud/eventarc/v1/channel_connection.proto (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.create_channel.js (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.create_channel_connection.js (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.delete_channel.js (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.delete_channel_connection.js (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.get_channel.js (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.get_channel_connection.js (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.list_channel_connections.js (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.list_channels.js (100%) rename {owl-bot-staging/v1/samples => samples}/generated/v1/eventarc.update_channel.js (100%) 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 be8e69e..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/eventarc', - 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 dd17389..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Eventarc: 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 1cd0604..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/eventarc", - "version": "0.1.0", - "description": "Eventarc client for Node.js", - "repository": "googleapis/nodejs-eventarc", - "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 eventarc", - "eventarc", - "eventarc" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "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": "^2.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^14.18.9", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^2.16.2", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.2", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/eventarc.proto b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/eventarc.proto deleted file mode 100644 index 41aa848..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/eventarc.proto +++ /dev/null @@ -1,513 +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.eventarc.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/eventarc/v1/channel.proto"; -import "google/cloud/eventarc/v1/channel_connection.proto"; -import "google/cloud/eventarc/v1/trigger.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Eventarc.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; -option java_multiple_files = true; -option java_outer_classname = "EventarcProto"; -option java_package = "com.google.cloud.eventarc.v1"; -option php_namespace = "Google\\Cloud\\Eventarc\\V1"; -option ruby_package = "Google::Cloud::Eventarc::V1"; - -// Eventarc allows users to subscribe to various events that are provided by -// Google Cloud services and forward them to supported destinations. -service Eventarc { - option (google.api.default_host) = "eventarc.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Get a single trigger. - rpc GetTrigger(GetTriggerRequest) returns (Trigger) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/triggers/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List triggers. - rpc ListTriggers(ListTriggersRequest) returns (ListTriggersResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/triggers" - }; - option (google.api.method_signature) = "parent"; - } - - // Create a new trigger in a particular project and location. - rpc CreateTrigger(CreateTriggerRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/triggers" - body: "trigger" - }; - option (google.api.method_signature) = "parent,trigger,trigger_id"; - option (google.longrunning.operation_info) = { - response_type: "Trigger" - metadata_type: "OperationMetadata" - }; - } - - // Update a single trigger. - rpc UpdateTrigger(UpdateTriggerRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{trigger.name=projects/*/locations/*/triggers/*}" - body: "trigger" - }; - option (google.api.method_signature) = "trigger,update_mask,allow_missing"; - option (google.longrunning.operation_info) = { - response_type: "Trigger" - metadata_type: "OperationMetadata" - }; - } - - // Delete a single trigger. - rpc DeleteTrigger(DeleteTriggerRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/triggers/*}" - }; - option (google.api.method_signature) = "name,allow_missing"; - option (google.longrunning.operation_info) = { - response_type: "Trigger" - metadata_type: "OperationMetadata" - }; - } - - // Get a single Channel. - rpc GetChannel(GetChannelRequest) returns (Channel) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/channels/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List channels. - rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/channels" - }; - option (google.api.method_signature) = "parent"; - } - - // Create a new channel in a particular project and location. - rpc CreateChannel(CreateChannelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/channels" - body: "channel" - }; - option (google.api.method_signature) = "parent,channel,channel_id"; - option (google.longrunning.operation_info) = { - response_type: "Channel" - metadata_type: "OperationMetadata" - }; - } - - // Update a single channel. - rpc UpdateChannel(UpdateChannelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{channel.name=projects/*/locations/*/channels/*}" - body: "channel" - }; - option (google.api.method_signature) = "channel,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Channel" - metadata_type: "OperationMetadata" - }; - } - - // Delete a single channel. - rpc DeleteChannel(DeleteChannelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/channels/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "Channel" - metadata_type: "OperationMetadata" - }; - } - - // Get a single ChannelConnection. - rpc GetChannelConnection(GetChannelConnectionRequest) returns (ChannelConnection) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/channelConnections/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List channel connections. - rpc ListChannelConnections(ListChannelConnectionsRequest) returns (ListChannelConnectionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/channelConnections" - }; - option (google.api.method_signature) = "parent"; - } - - // Create a new ChannelConnection in a particular project and location. - rpc CreateChannelConnection(CreateChannelConnectionRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/channelConnections" - body: "channel_connection" - }; - option (google.api.method_signature) = "parent,channel_connection,channel_connection_id"; - option (google.longrunning.operation_info) = { - response_type: "ChannelConnection" - metadata_type: "OperationMetadata" - }; - } - - // Delete a single ChannelConnection. - rpc DeleteChannelConnection(DeleteChannelConnectionRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/channelConnections/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "ChannelConnection" - metadata_type: "OperationMetadata" - }; - } -} - -// The request message for the GetTrigger method. -message GetTriggerRequest { - // Required. The name of the trigger to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Trigger" - } - ]; -} - -// The request message for the ListTriggers method. -message ListTriggersRequest { - // Required. The parent collection to list triggers on. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "eventarc.googleapis.com/Trigger" - } - ]; - - // The maximum number of triggers to return on each page. - // Note: The service may send fewer. - int32 page_size = 2; - - // The page token; provide the value from the `next_page_token` field in a - // previous `ListTriggers` call to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListTriggers` must match - // the call that provided the page token. - string page_token = 3; - - // The sorting order of the resources returned. Value should be a - // comma-separated list of fields. The default sorting order is ascending. To - // specify descending order for a field, append a `desc` suffix; for example: - // `name desc, trigger_id`. - string order_by = 4; -} - -// The response message for the `ListTriggers` method. -message ListTriggersResponse { - // The requested triggers, up to the number specified in `page_size`. - repeated Trigger triggers = 1; - - // A page token that can be sent to ListTriggers to request the next page. - // If this is empty, then there are no more pages. - string next_page_token = 2; - - // Unreachable resources, if any. - repeated string unreachable = 3; -} - -// The request message for the CreateTrigger method. -message CreateTriggerRequest { - // Required. The parent collection in which to add this trigger. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "eventarc.googleapis.com/Trigger" - } - ]; - - // Required. The trigger to create. - Trigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The user-provided ID to be assigned to the trigger. - string trigger_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. If set, validate the request and preview the review, but do not - // post it. - bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for the UpdateTrigger method. -message UpdateTriggerRequest { - // The trigger to be updated. - Trigger trigger = 1; - - // The fields to be updated; only fields explicitly provided are updated. - // If no field mask is provided, all provided fields in the request are - // updated. To update all fields, provide a field mask of "*". - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the trigger is not found, a new trigger will be - // created. In this situation, `update_mask` is ignored. - bool allow_missing = 3; - - // Required. If set, validate the request and preview the review, but do not - // post it. - bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for the DeleteTrigger method. -message DeleteTriggerRequest { - // Required. The name of the trigger to be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Trigger" - } - ]; - - // If provided, the trigger will only be deleted if the etag matches the - // current etag on the resource. - string etag = 2; - - // If set to true, and the trigger is not found, the request will succeed - // but no action will be taken on the server. - bool allow_missing = 3; - - // Required. If set, validate the request and preview the review, but do not - // post it. - bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for the GetChannel method. -message GetChannelRequest { - // Required. The name of the channel to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Channel" - } - ]; -} - -// The request message for the ListChannels method. -message ListChannelsRequest { - // Required. The parent collection to list channels on. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "eventarc.googleapis.com/Channel" - } - ]; - - // The maximum number of channels to return on each page. - // Note: The service may send fewer. - int32 page_size = 2; - - // The page token; provide the value from the `next_page_token` field in a - // previous `ListChannels` call to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListChannels` must - // match the call that provided the page token. - string page_token = 3; - - // The sorting order of the resources returned. Value should be a - // comma-separated list of fields. The default sorting order is ascending. To - // specify descending order for a field, append a `desc` suffix; for example: - // `name desc, channel_id`. - string order_by = 4; -} - -// The response message for the `ListChannels` method. -message ListChannelsResponse { - // The requested channels, up to the number specified in `page_size`. - repeated Channel channels = 1; - - // A page token that can be sent to ListChannels to request the next page. - // If this is empty, then there are no more pages. - string next_page_token = 2; - - // Unreachable resources, if any. - repeated string unreachable = 3; -} - -// The request message for the CreateChannel method. -message CreateChannelRequest { - // Required. The parent collection in which to add this channel. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "eventarc.googleapis.com/Channel" - } - ]; - - // Required. The channel to create. - Channel channel = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The user-provided ID to be assigned to the channel. - string channel_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. If set, validate the request and preview the review, but do not - // post it. - bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for the UpdateChannel method. -message UpdateChannelRequest { - // The channel to be updated. - Channel channel = 1; - - // The fields to be updated; only fields explicitly provided are updated. - // If no field mask is provided, all provided fields in the request are - // updated. To update all fields, provide a field mask of "*". - google.protobuf.FieldMask update_mask = 2; - - // Required. If set, validate the request and preview the review, but do not - // post it. - bool validate_only = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for the DeleteChannel method. -message DeleteChannelRequest { - // Required. The name of the channel to be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/Channel" - } - ]; - - // Required. If set, validate the request and preview the review, but do not - // post it. - bool validate_only = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for the GetChannelConnection method. -message GetChannelConnectionRequest { - // Required. The name of the channel connection to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/ChannelConnection" - } - ]; -} - -// The request message for the ListChannelConnections method. -message ListChannelConnectionsRequest { - // Required. The parent collection from which to list channel connections. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "eventarc.googleapis.com/ChannelConnection" - } - ]; - - // The maximum number of channel connections to return on each page. - // Note: The service may send fewer responses. - int32 page_size = 2; - - // The page token; provide the value from the `next_page_token` field in a - // previous `ListChannelConnections` call to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListChannelConnetions` - // match the call that provided the page token. - string page_token = 3; -} - -// The response message for the `ListChannelConnections` method. -message ListChannelConnectionsResponse { - // The requested channel connections, up to the number specified in - // `page_size`. - repeated ChannelConnection channel_connections = 1; - - // A page token that can be sent to ListChannelConnections to request the - // next page. - // If this is empty, then there are no more pages. - string next_page_token = 2; - - // Unreachable resources, if any. - repeated string unreachable = 3; -} - -// The request message for the CreateChannelConnection method. -message CreateChannelConnectionRequest { - // Required. The parent collection in which to add this channel connection. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "eventarc.googleapis.com/ChannelConnection" - } - ]; - - // Required. Channel connection to create. - ChannelConnection channel_connection = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The user-provided ID to be assigned to the channel connection. - string channel_connection_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The request message for the DeleteChannelConnection method. -message DeleteChannelConnectionRequest { - // Required. The name of the channel connection to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "eventarc.googleapis.com/ChannelConnection" - } - ]; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. 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 requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/trigger.proto b/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/trigger.proto deleted file mode 100644 index 5ba97d5..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/trigger.proto +++ /dev/null @@ -1,226 +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.eventarc.v1; - -import "google/api/annotations.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; -option java_multiple_files = true; -option java_outer_classname = "TriggerProto"; -option java_package = "com.google.cloud.eventarc.v1"; -option (google.api.resource_definition) = { - type: "cloudfunctions.googleapis.com/CloudFunction" - pattern: "projects/{project}/locations/{location}/functions/{function}" -}; -option (google.api.resource_definition) = { - type: "iam.googleapis.com/ServiceAccount" - pattern: "projects/{project}/serviceAccounts/{service_account}" -}; -option (google.api.resource_definition) = { - type: "run.googleapis.com/Service" - pattern: "*" -}; - -// A representation of the trigger resource. -message Trigger { - option (google.api.resource) = { - type: "eventarc.googleapis.com/Trigger" - pattern: "projects/{project}/locations/{location}/triggers/{trigger}" - plural: "triggers" - singular: "trigger" - }; - - // Required. The resource name of the trigger. Must be unique within the location of the - // project and must be in - // `projects/{project}/locations/{location}/triggers/{trigger}` format. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Server-assigned unique identifier for the trigger. The value is a UUID4 - // string and guaranteed to remain unchanged until the resource is deleted. - string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation time. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last-modified time. - google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. null The list of filters that applies to event attributes. Only events that - // match all the provided filters are sent to the destination. - repeated EventFilter event_filters = 8 [ - (google.api.field_behavior) = UNORDERED_LIST, - (google.api.field_behavior) = REQUIRED - ]; - - // Optional. The IAM service account email associated with the trigger. The - // service account represents the identity of the trigger. - // - // The principal who calls this API must have the `iam.serviceAccounts.actAs` - // permission in the service account. See - // https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common - // for more information. - // - // For Cloud Run destinations, this service account is used to generate - // identity tokens when invoking the service. See - // https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account - // for information on how to invoke authenticated Cloud Run services. - // To create Audit Log triggers, the service account should also - // have the `roles/eventarc.eventReceiver` IAM role. - string service_account = 9 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "iam.googleapis.com/ServiceAccount" - } - ]; - - // Required. Destination specifies where the events should be sent to. - Destination destination = 10 [(google.api.field_behavior) = REQUIRED]; - - // Optional. To deliver messages, Eventarc might use other GCP - // products as a transport intermediary. This field contains a reference to - // that transport intermediary. This information can be used for debugging - // purposes. - Transport transport = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. User labels attached to the triggers that can be used to group resources. - map labels = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the channel associated with the trigger in - // `projects/{project}/locations/{location}/channels/{channel}` format. - // You must provide a channel to receive events from Eventarc SaaS partners. - string channel = 13 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. This checksum is computed by the server based on the value of other - // fields, and might be sent only on create requests to ensure that the - // client has an up-to-date value before proceeding. - string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Filters events based on exact matches on the CloudEvents attributes. -message EventFilter { - // Required. The name of a CloudEvents attribute. Currently, only a subset of attributes - // are supported for filtering. - // - // All triggers MUST provide a filter for the 'type' attribute. - string attribute = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The value for the attribute. - string value = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The operator used for matching the events with the value of the - // filter. If not specified, only events that have an exact key-value pair - // specified in the filter are matched. The only allowed value is - // `match-path-pattern`. - string operator = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a target of an invocation over HTTP. -message Destination { - oneof descriptor { - // Cloud Run fully-managed resource that receives the events. The resource - // should be in the same project as the trigger. - CloudRun cloud_run = 1; - - // The Cloud Function resource name. Only Cloud Functions V2 is supported. - // Format: `projects/{project}/locations/{location}/functions/{function}` - string cloud_function = 2 [(google.api.resource_reference) = { - type: "cloudfunctions.googleapis.com/CloudFunction" - }]; - - // A GKE service capable of receiving events. The service should be running - // in the same project as the trigger. - GKE gke = 3; - } -} - -// Represents the transport intermediaries created for the trigger to -// deliver events. -message Transport { - oneof intermediary { - // The Pub/Sub topic and subscription used by Eventarc as a transport - // intermediary. - Pubsub pubsub = 1; - } -} - -// Represents a Cloud Run destination. -message CloudRun { - // Required. The name of the Cloud Run service being addressed. See - // https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services. - // - // Only services located in the same project as the trigger object - // can be addressed. - string service = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "run.googleapis.com/Service" - } - ]; - - // Optional. The relative path on the Cloud Run service the events should be sent to. - // - // The value must conform to the definition of a URI path segment (section 3.3 - // of RFC2396). Examples: "/route", "route", "route/subroute". - string path = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The region the Cloud Run service is deployed in. - string region = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Represents a GKE destination. -message GKE { - // Required. The name of the cluster the GKE service is running in. The cluster must be - // running in the same project as the trigger being created. - string cluster = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the Google Compute Engine in which the cluster resides, which - // can either be compute zone (for example, us-central1-a) for the zonal - // clusters or region (for example, us-central1) for regional clusters. - string location = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The namespace the GKE service is running in. - string namespace = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Name of the GKE service. - string service = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The relative path on the GKE service the events should be sent to. - // - // The value must conform to the definition of a URI path segment (section 3.3 - // of RFC2396). Examples: "/route", "route", "route/subroute". - string path = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a Pub/Sub transport. -message Pubsub { - // Optional. The name of the Pub/Sub topic created and managed by Eventarc as - // a transport for the event delivery. Format: - // `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`. - // - // You can set an existing topic for triggers of the type - // `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide - // here is not deleted by Eventarc at trigger deletion. - string topic = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The name of the Pub/Sub subscription created and managed by Eventarc - // as a transport for the event delivery. Format: - // `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`. - string subscription = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.create_trigger.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.create_trigger.js deleted file mode 100644 index 89367ed..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/eventarc.create_trigger.js +++ /dev/null @@ -1,70 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, trigger, triggerId, validateOnly) { - // [START eventarc_v1_generated_Eventarc_CreateTrigger_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent collection in which to add this trigger. - */ - // const parent = 'abc123' - /** - * Required. The trigger to create. - */ - // const trigger = {} - /** - * Required. The user-provided ID to be assigned to the trigger. - */ - // const triggerId = 'abc123' - /** - * Required. If set, validate the request and preview the review, but do not - * post it. - */ - // const validateOnly = true - - // Imports the Eventarc library - const {EventarcClient} = require('@google-cloud/eventarc').v1; - - // Instantiates a client - const eventarcClient = new EventarcClient(); - - async function callCreateTrigger() { - // Construct request - const request = { - parent, - trigger, - triggerId, - validateOnly, - }; - - // Run request - const [operation] = await eventarcClient.createTrigger(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateTrigger(); - // [END eventarc_v1_generated_Eventarc_CreateTrigger_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/eventarc.delete_trigger.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_trigger.js deleted file mode 100644 index 88055ea..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_trigger.js +++ /dev/null @@ -1,70 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name, validateOnly) { - // [START eventarc_v1_generated_Eventarc_DeleteTrigger_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the trigger to be deleted. - */ - // const name = 'abc123' - /** - * If provided, the trigger will only be deleted if the etag matches the - * current etag on the resource. - */ - // const etag = 'abc123' - /** - * If set to true, and the trigger is not found, the request will succeed - * but no action will be taken on the server. - */ - // const allowMissing = true - /** - * Required. If set, validate the request and preview the review, but do not - * post it. - */ - // const validateOnly = true - - // Imports the Eventarc library - const {EventarcClient} = require('@google-cloud/eventarc').v1; - - // Instantiates a client - const eventarcClient = new EventarcClient(); - - async function callDeleteTrigger() { - // Construct request - const request = { - name, - validateOnly, - }; - - // Run request - const [operation] = await eventarcClient.deleteTrigger(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteTrigger(); - // [END eventarc_v1_generated_Eventarc_DeleteTrigger_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/eventarc.get_trigger.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.get_trigger.js deleted file mode 100644 index fd643bc..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/eventarc.get_trigger.js +++ /dev/null @@ -1,53 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START eventarc_v1_generated_Eventarc_GetTrigger_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the trigger to get. - */ - // const name = 'abc123' - - // Imports the Eventarc library - const {EventarcClient} = require('@google-cloud/eventarc').v1; - - // Instantiates a client - const eventarcClient = new EventarcClient(); - - async function callGetTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await eventarcClient.getTrigger(request); - console.log(response); - } - - callGetTrigger(); - // [END eventarc_v1_generated_Eventarc_GetTrigger_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/eventarc.list_triggers.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.list_triggers.js deleted file mode 100644 index ea7d7cb..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/eventarc.list_triggers.js +++ /dev/null @@ -1,74 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START eventarc_v1_generated_Eventarc_ListTriggers_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent collection to list triggers on. - */ - // const parent = 'abc123' - /** - * The maximum number of triggers to return on each page. - * Note: The service may send fewer. - */ - // const pageSize = 1234 - /** - * The page token; provide the value from the `next_page_token` field in a - * previous `ListTriggers` call to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListTriggers` must match - * the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * The sorting order of the resources returned. Value should be a - * comma-separated list of fields. The default sorting order is ascending. To - * specify descending order for a field, append a `desc` suffix; for example: - * `name desc, trigger_id`. - */ - // const orderBy = 'abc123' - - // Imports the Eventarc library - const {EventarcClient} = require('@google-cloud/eventarc').v1; - - // Instantiates a client - const eventarcClient = new EventarcClient(); - - async function callListTriggers() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await eventarcClient.listTriggersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTriggers(); - // [END eventarc_v1_generated_Eventarc_ListTriggers_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/eventarc.update_trigger.js b/owl-bot-staging/v1/samples/generated/v1/eventarc.update_trigger.js deleted file mode 100644 index 8dc6411..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/eventarc.update_trigger.js +++ /dev/null @@ -1,70 +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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(validateOnly) { - // [START eventarc_v1_generated_Eventarc_UpdateTrigger_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The trigger to be updated. - */ - // const trigger = {} - /** - * The fields to be updated; only fields explicitly provided are updated. - * If no field mask is provided, all provided fields in the request are - * updated. To update all fields, provide a field mask of "*". - */ - // const updateMask = {} - /** - * If set to true, and the trigger is not found, a new trigger will be - * created. In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - /** - * Required. If set, validate the request and preview the review, but do not - * post it. - */ - // const validateOnly = true - - // Imports the Eventarc library - const {EventarcClient} = require('@google-cloud/eventarc').v1; - - // Instantiates a client - const eventarcClient = new EventarcClient(); - - async function callUpdateTrigger() { - // Construct request - const request = { - validateOnly, - }; - - // Run request - const [operation] = await eventarcClient.updateTrigger(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateTrigger(); - // [END eventarc_v1_generated_Eventarc_UpdateTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 54f1ed7..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +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 EventarcClient = v1.EventarcClient; -type EventarcClient = v1.EventarcClient; -export {v1, EventarcClient}; -export default {v1, EventarcClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/eventarc_client.ts b/owl-bot-staging/v1/src/v1/eventarc_client.ts deleted file mode 100644 index 3c5e361..0000000 --- a/owl-bot-staging/v1/src/v1/eventarc_client.ts +++ /dev/null @@ -1,2204 +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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/eventarc_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './eventarc_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Eventarc allows users to subscribe to various events that are provided by - * Google Cloud services and forward them to supported destinations. - * @class - * @memberof v1 - */ -export class EventarcClient { - 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}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - eventarcStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EventarcClient. - * - * @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/master/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} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EventarcClient; - 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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; - } - - // 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 = { - channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/channels/{channel}' - ), - channelConnectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/channelConnections/{channel_connection}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - triggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/triggers/{trigger}' - ), - }; - - // 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 = { - listTriggers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'triggers'), - listChannels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'channels'), - listChannelConnections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'channelConnections') - }; - - 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. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const createTriggerResponse = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.Trigger') as gax.protobuf.Type; - const createTriggerMetadata = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; - const updateTriggerResponse = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.Trigger') as gax.protobuf.Type; - const updateTriggerMetadata = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; - const deleteTriggerResponse = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.Trigger') as gax.protobuf.Type; - const deleteTriggerMetadata = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; - const createChannelResponse = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.Channel') as gax.protobuf.Type; - const createChannelMetadata = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; - const updateChannelResponse = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.Channel') as gax.protobuf.Type; - const updateChannelMetadata = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; - const deleteChannelResponse = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.Channel') as gax.protobuf.Type; - const deleteChannelMetadata = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; - const createChannelConnectionResponse = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.ChannelConnection') as gax.protobuf.Type; - const createChannelConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; - const deleteChannelConnectionResponse = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.ChannelConnection') as gax.protobuf.Type; - const deleteChannelConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.eventarc.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createTrigger: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createTriggerResponse.decode.bind(createTriggerResponse), - createTriggerMetadata.decode.bind(createTriggerMetadata)), - updateTrigger: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateTriggerResponse.decode.bind(updateTriggerResponse), - updateTriggerMetadata.decode.bind(updateTriggerMetadata)), - deleteTrigger: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteTriggerResponse.decode.bind(deleteTriggerResponse), - deleteTriggerMetadata.decode.bind(deleteTriggerMetadata)), - createChannel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createChannelResponse.decode.bind(createChannelResponse), - createChannelMetadata.decode.bind(createChannelMetadata)), - updateChannel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateChannelResponse.decode.bind(updateChannelResponse), - updateChannelMetadata.decode.bind(updateChannelMetadata)), - deleteChannel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteChannelResponse.decode.bind(deleteChannelResponse), - deleteChannelMetadata.decode.bind(deleteChannelMetadata)), - createChannelConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createChannelConnectionResponse.decode.bind(createChannelConnectionResponse), - createChannelConnectionMetadata.decode.bind(createChannelConnectionMetadata)), - deleteChannelConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteChannelConnectionResponse.decode.bind(deleteChannelConnectionResponse), - deleteChannelConnectionMetadata.decode.bind(deleteChannelConnectionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.eventarc.v1.Eventarc', 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 = gax.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.eventarcStub) { - return this.eventarcStub; - } - - // Put together the "service stub" for - // google.cloud.eventarc.v1.Eventarc. - this.eventarcStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.eventarc.v1.Eventarc') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.eventarc.v1.Eventarc, - 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 eventarcStubMethods = - ['getTrigger', 'listTriggers', 'createTrigger', 'updateTrigger', 'deleteTrigger', 'getChannel', 'listChannels', 'createChannel', 'updateChannel', 'deleteChannel', 'getChannelConnection', 'listChannelConnections', 'createChannelConnection', 'deleteChannelConnection']; - for (const methodName of eventarcStubMethods) { - const callPromise = this.eventarcStub.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] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.eventarcStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'eventarc.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 'eventarc.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 -- - // ------------------- -/** - * Get a single trigger. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the trigger to get. - * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger}. - * 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/eventarc.get_trigger.js - * region_tag:eventarc_v1_generated_Eventarc_GetTrigger_async - */ - getTrigger( - request?: protos.google.cloud.eventarc.v1.IGetTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.eventarc.v1.ITrigger, - protos.google.cloud.eventarc.v1.IGetTriggerRequest|undefined, {}|undefined - ]>; - getTrigger( - request: protos.google.cloud.eventarc.v1.IGetTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.eventarc.v1.ITrigger, - protos.google.cloud.eventarc.v1.IGetTriggerRequest|null|undefined, - {}|null|undefined>): void; - getTrigger( - request: protos.google.cloud.eventarc.v1.IGetTriggerRequest, - callback: Callback< - protos.google.cloud.eventarc.v1.ITrigger, - protos.google.cloud.eventarc.v1.IGetTriggerRequest|null|undefined, - {}|null|undefined>): void; - getTrigger( - request?: protos.google.cloud.eventarc.v1.IGetTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.eventarc.v1.ITrigger, - protos.google.cloud.eventarc.v1.IGetTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.eventarc.v1.ITrigger, - protos.google.cloud.eventarc.v1.IGetTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.eventarc.v1.ITrigger, - protos.google.cloud.eventarc.v1.IGetTriggerRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getTrigger(request, options, callback); - } -/** - * Get a single Channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the channel to get. - * @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 [Channel]{@link google.cloud.eventarc.v1.Channel}. - * 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/eventarc.get_channel.js - * region_tag:eventarc_v1_generated_Eventarc_GetChannel_async - */ - getChannel( - request?: protos.google.cloud.eventarc.v1.IGetChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.eventarc.v1.IChannel, - protos.google.cloud.eventarc.v1.IGetChannelRequest|undefined, {}|undefined - ]>; - getChannel( - request: protos.google.cloud.eventarc.v1.IGetChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.eventarc.v1.IChannel, - protos.google.cloud.eventarc.v1.IGetChannelRequest|null|undefined, - {}|null|undefined>): void; - getChannel( - request: protos.google.cloud.eventarc.v1.IGetChannelRequest, - callback: Callback< - protos.google.cloud.eventarc.v1.IChannel, - protos.google.cloud.eventarc.v1.IGetChannelRequest|null|undefined, - {}|null|undefined>): void; - getChannel( - request?: protos.google.cloud.eventarc.v1.IGetChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.eventarc.v1.IChannel, - protos.google.cloud.eventarc.v1.IGetChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.eventarc.v1.IChannel, - protos.google.cloud.eventarc.v1.IGetChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.eventarc.v1.IChannel, - protos.google.cloud.eventarc.v1.IGetChannelRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getChannel(request, options, callback); - } -/** - * Get a single ChannelConnection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the channel connection to get. - * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. - * 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/eventarc.get_channel_connection.js - * region_tag:eventarc_v1_generated_Eventarc_GetChannelConnection_async - */ - getChannelConnection( - request?: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.eventarc.v1.IChannelConnection, - protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|undefined, {}|undefined - ]>; - getChannelConnection( - request: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.eventarc.v1.IChannelConnection, - protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|null|undefined, - {}|null|undefined>): void; - getChannelConnection( - request: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, - callback: Callback< - protos.google.cloud.eventarc.v1.IChannelConnection, - protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|null|undefined, - {}|null|undefined>): void; - getChannelConnection( - request?: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.eventarc.v1.IChannelConnection, - protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.eventarc.v1.IChannelConnection, - protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.eventarc.v1.IChannelConnection, - protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getChannelConnection(request, options, callback); - } - -/** - * Create a new trigger in a particular project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent collection in which to add this trigger. - * @param {google.cloud.eventarc.v1.Trigger} request.trigger - * Required. The trigger to create. - * @param {string} request.triggerId - * Required. The user-provided ID to be assigned to the trigger. - * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not - * post it. - * @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/eventarc.create_trigger.js - * region_tag:eventarc_v1_generated_Eventarc_CreateTrigger_async - */ - createTrigger( - request?: protos.google.cloud.eventarc.v1.ICreateTriggerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createTrigger( - request: protos.google.cloud.eventarc.v1.ICreateTriggerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createTrigger( - request: protos.google.cloud.eventarc.v1.ICreateTriggerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createTrigger( - request?: protos.google.cloud.eventarc.v1.ICreateTriggerRequest, - 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createTrigger(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createTrigger()`. - * @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/eventarc.create_trigger.js - * region_tag:eventarc_v1_generated_Eventarc_CreateTrigger_async - */ - async checkCreateTriggerProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createTrigger, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a single trigger. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.eventarc.v1.Trigger} request.trigger - * The trigger to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * The fields to be updated; only fields explicitly provided are updated. - * If no field mask is provided, all provided fields in the request are - * updated. To update all fields, provide a field mask of "*". - * @param {boolean} request.allowMissing - * If set to true, and the trigger is not found, a new trigger will be - * created. In this situation, `update_mask` is ignored. - * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not - * post it. - * @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/eventarc.update_trigger.js - * region_tag:eventarc_v1_generated_Eventarc_UpdateTrigger_async - */ - updateTrigger( - request?: protos.google.cloud.eventarc.v1.IUpdateTriggerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateTrigger( - request: protos.google.cloud.eventarc.v1.IUpdateTriggerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateTrigger( - request: protos.google.cloud.eventarc.v1.IUpdateTriggerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateTrigger( - request?: protos.google.cloud.eventarc.v1.IUpdateTriggerRequest, - 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' - ] = gax.routingHeader.fromParams({ - 'trigger.name': request.trigger!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateTrigger(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateTrigger()`. - * @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/eventarc.update_trigger.js - * region_tag:eventarc_v1_generated_Eventarc_UpdateTrigger_async - */ - async checkUpdateTriggerProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateTrigger, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Delete a single trigger. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the trigger to be deleted. - * @param {string} request.etag - * If provided, the trigger will only be deleted if the etag matches the - * current etag on the resource. - * @param {boolean} request.allowMissing - * If set to true, and the trigger is not found, the request will succeed - * but no action will be taken on the server. - * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not - * post it. - * @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/eventarc.delete_trigger.js - * region_tag:eventarc_v1_generated_Eventarc_DeleteTrigger_async - */ - deleteTrigger( - request?: protos.google.cloud.eventarc.v1.IDeleteTriggerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteTrigger( - request: protos.google.cloud.eventarc.v1.IDeleteTriggerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteTrigger( - request: protos.google.cloud.eventarc.v1.IDeleteTriggerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteTrigger( - request?: protos.google.cloud.eventarc.v1.IDeleteTriggerRequest, - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteTrigger(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteTrigger()`. - * @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/eventarc.delete_trigger.js - * region_tag:eventarc_v1_generated_Eventarc_DeleteTrigger_async - */ - async checkDeleteTriggerProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteTrigger, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Create a new channel in a particular project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent collection in which to add this channel. - * @param {google.cloud.eventarc.v1.Channel} request.channel - * Required. The channel to create. - * @param {string} request.channelId - * Required. The user-provided ID to be assigned to the channel. - * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not - * post it. - * @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/eventarc.create_channel.js - * region_tag:eventarc_v1_generated_Eventarc_CreateChannel_async - */ - createChannel( - request?: protos.google.cloud.eventarc.v1.ICreateChannelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createChannel( - request: protos.google.cloud.eventarc.v1.ICreateChannelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createChannel( - request: protos.google.cloud.eventarc.v1.ICreateChannelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createChannel( - request?: protos.google.cloud.eventarc.v1.ICreateChannelRequest, - 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createChannel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createChannel()`. - * @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/eventarc.create_channel.js - * region_tag:eventarc_v1_generated_Eventarc_CreateChannel_async - */ - async checkCreateChannelProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createChannel, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Update a single channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.eventarc.v1.Channel} request.channel - * The channel to be updated. - * @param {google.protobuf.FieldMask} request.updateMask - * The fields to be updated; only fields explicitly provided are updated. - * If no field mask is provided, all provided fields in the request are - * updated. To update all fields, provide a field mask of "*". - * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not - * post it. - * @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/eventarc.update_channel.js - * region_tag:eventarc_v1_generated_Eventarc_UpdateChannel_async - */ - updateChannel( - request?: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateChannel( - request: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateChannel( - request: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateChannel( - request?: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, - 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' - ] = gax.routingHeader.fromParams({ - 'channel.name': request.channel!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateChannel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateChannel()`. - * @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/eventarc.update_channel.js - * region_tag:eventarc_v1_generated_Eventarc_UpdateChannel_async - */ - async checkUpdateChannelProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateChannel, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Delete a single channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the channel to be deleted. - * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not - * post it. - * @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/eventarc.delete_channel.js - * region_tag:eventarc_v1_generated_Eventarc_DeleteChannel_async - */ - deleteChannel( - request?: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteChannel( - request: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteChannel( - request: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteChannel( - request?: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteChannel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteChannel()`. - * @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/eventarc.delete_channel.js - * region_tag:eventarc_v1_generated_Eventarc_DeleteChannel_async - */ - async checkDeleteChannelProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteChannel, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Create a new ChannelConnection in a particular project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent collection in which to add this channel connection. - * @param {google.cloud.eventarc.v1.ChannelConnection} request.channelConnection - * Required. Channel connection to create. - * @param {string} request.channelConnectionId - * Required. The user-provided ID to be assigned to the channel connection. - * @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/eventarc.create_channel_connection.js - * region_tag:eventarc_v1_generated_Eventarc_CreateChannelConnection_async - */ - createChannelConnection( - request?: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createChannelConnection( - request: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createChannelConnection( - request: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createChannelConnection( - request?: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, - 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createChannelConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createChannelConnection()`. - * @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/eventarc.create_channel_connection.js - * region_tag:eventarc_v1_generated_Eventarc_CreateChannelConnection_async - */ - async checkCreateChannelConnectionProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createChannelConnection, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Delete a single ChannelConnection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the channel connection to delete. - * @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/eventarc.delete_channel_connection.js - * region_tag:eventarc_v1_generated_Eventarc_DeleteChannelConnection_async - */ - deleteChannelConnection( - request?: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteChannelConnection( - request: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteChannelConnection( - request: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteChannelConnection( - request?: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteChannelConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteChannelConnection()`. - * @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/eventarc.delete_channel_connection.js - * region_tag:eventarc_v1_generated_Eventarc_DeleteChannelConnection_async - */ - async checkDeleteChannelConnectionProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteChannelConnection, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * List triggers. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent collection to list triggers on. - * @param {number} request.pageSize - * The maximum number of triggers to return on each page. - * Note: The service may send fewer. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListTriggers` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListTriggers` must match - * the call that provided the page token. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a - * comma-separated list of fields. The default sorting order is ascending. To - * specify descending order for a field, append a `desc` suffix; for example: - * `name desc, trigger_id`. - * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger}. - * 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 `listTriggersAsync()` - * 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. - */ - listTriggers( - request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.eventarc.v1.ITrigger[], - protos.google.cloud.eventarc.v1.IListTriggersRequest|null, - protos.google.cloud.eventarc.v1.IListTriggersResponse - ]>; - listTriggers( - request: protos.google.cloud.eventarc.v1.IListTriggersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.eventarc.v1.IListTriggersRequest, - protos.google.cloud.eventarc.v1.IListTriggersResponse|null|undefined, - protos.google.cloud.eventarc.v1.ITrigger>): void; - listTriggers( - request: protos.google.cloud.eventarc.v1.IListTriggersRequest, - callback: PaginationCallback< - protos.google.cloud.eventarc.v1.IListTriggersRequest, - protos.google.cloud.eventarc.v1.IListTriggersResponse|null|undefined, - protos.google.cloud.eventarc.v1.ITrigger>): void; - listTriggers( - request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.eventarc.v1.IListTriggersRequest, - protos.google.cloud.eventarc.v1.IListTriggersResponse|null|undefined, - protos.google.cloud.eventarc.v1.ITrigger>, - callback?: PaginationCallback< - protos.google.cloud.eventarc.v1.IListTriggersRequest, - protos.google.cloud.eventarc.v1.IListTriggersResponse|null|undefined, - protos.google.cloud.eventarc.v1.ITrigger>): - Promise<[ - protos.google.cloud.eventarc.v1.ITrigger[], - protos.google.cloud.eventarc.v1.IListTriggersRequest|null, - protos.google.cloud.eventarc.v1.IListTriggersResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listTriggers(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 collection to list triggers on. - * @param {number} request.pageSize - * The maximum number of triggers to return on each page. - * Note: The service may send fewer. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListTriggers` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListTriggers` must match - * the call that provided the page token. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a - * comma-separated list of fields. The default sorting order is ascending. To - * specify descending order for a field, append a `desc` suffix; for example: - * `name desc, trigger_id`. - * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger} 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 `listTriggersAsync()` - * 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. - */ - listTriggersStream( - request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTriggers.createStream( - this.innerApiCalls.listTriggers as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTriggers`, 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 collection to list triggers on. - * @param {number} request.pageSize - * The maximum number of triggers to return on each page. - * Note: The service may send fewer. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListTriggers` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListTriggers` must match - * the call that provided the page token. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a - * comma-separated list of fields. The default sorting order is ascending. To - * specify descending order for a field, append a `desc` suffix; for example: - * `name desc, trigger_id`. - * @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 - * [Trigger]{@link google.cloud.eventarc.v1.Trigger}. 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/eventarc.list_triggers.js - * region_tag:eventarc_v1_generated_Eventarc_ListTriggers_async - */ - listTriggersAsync( - request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listTriggers.asyncIterate( - this.innerApiCalls['listTriggers'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * List channels. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent collection to list channels on. - * @param {number} request.pageSize - * The maximum number of channels to return on each page. - * Note: The service may send fewer. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListChannels` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListChannels` must - * match the call that provided the page token. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a - * comma-separated list of fields. The default sorting order is ascending. To - * specify descending order for a field, append a `desc` suffix; for example: - * `name desc, channel_id`. - * @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 [Channel]{@link google.cloud.eventarc.v1.Channel}. - * 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 `listChannelsAsync()` - * 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. - */ - listChannels( - request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.eventarc.v1.IChannel[], - protos.google.cloud.eventarc.v1.IListChannelsRequest|null, - protos.google.cloud.eventarc.v1.IListChannelsResponse - ]>; - listChannels( - request: protos.google.cloud.eventarc.v1.IListChannelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.eventarc.v1.IListChannelsRequest, - protos.google.cloud.eventarc.v1.IListChannelsResponse|null|undefined, - protos.google.cloud.eventarc.v1.IChannel>): void; - listChannels( - request: protos.google.cloud.eventarc.v1.IListChannelsRequest, - callback: PaginationCallback< - protos.google.cloud.eventarc.v1.IListChannelsRequest, - protos.google.cloud.eventarc.v1.IListChannelsResponse|null|undefined, - protos.google.cloud.eventarc.v1.IChannel>): void; - listChannels( - request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.eventarc.v1.IListChannelsRequest, - protos.google.cloud.eventarc.v1.IListChannelsResponse|null|undefined, - protos.google.cloud.eventarc.v1.IChannel>, - callback?: PaginationCallback< - protos.google.cloud.eventarc.v1.IListChannelsRequest, - protos.google.cloud.eventarc.v1.IListChannelsResponse|null|undefined, - protos.google.cloud.eventarc.v1.IChannel>): - Promise<[ - protos.google.cloud.eventarc.v1.IChannel[], - protos.google.cloud.eventarc.v1.IListChannelsRequest|null, - protos.google.cloud.eventarc.v1.IListChannelsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listChannels(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 collection to list channels on. - * @param {number} request.pageSize - * The maximum number of channels to return on each page. - * Note: The service may send fewer. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListChannels` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListChannels` must - * match the call that provided the page token. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a - * comma-separated list of fields. The default sorting order is ascending. To - * specify descending order for a field, append a `desc` suffix; for example: - * `name desc, channel_id`. - * @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 [Channel]{@link google.cloud.eventarc.v1.Channel} 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 `listChannelsAsync()` - * 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. - */ - listChannelsStream( - request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listChannels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listChannels.createStream( - this.innerApiCalls.listChannels as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listChannels`, 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 collection to list channels on. - * @param {number} request.pageSize - * The maximum number of channels to return on each page. - * Note: The service may send fewer. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListChannels` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListChannels` must - * match the call that provided the page token. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a - * comma-separated list of fields. The default sorting order is ascending. To - * specify descending order for a field, append a `desc` suffix; for example: - * `name desc, channel_id`. - * @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 - * [Channel]{@link google.cloud.eventarc.v1.Channel}. 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/eventarc.list_channels.js - * region_tag:eventarc_v1_generated_Eventarc_ListChannels_async - */ - listChannelsAsync( - request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listChannels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listChannels.asyncIterate( - this.innerApiCalls['listChannels'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * List channel connections. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent collection from which to list channel connections. - * @param {number} request.pageSize - * The maximum number of channel connections to return on each page. - * Note: The service may send fewer responses. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListChannelConnections` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListChannelConnetions` - * match the call that provided the page token. - * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. - * 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 `listChannelConnectionsAsync()` - * 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. - */ - listChannelConnections( - request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.eventarc.v1.IChannelConnection[], - protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest|null, - protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse - ]>; - listChannelConnections( - request: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse|null|undefined, - protos.google.cloud.eventarc.v1.IChannelConnection>): void; - listChannelConnections( - request: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - callback: PaginationCallback< - protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse|null|undefined, - protos.google.cloud.eventarc.v1.IChannelConnection>): void; - listChannelConnections( - request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse|null|undefined, - protos.google.cloud.eventarc.v1.IChannelConnection>, - callback?: PaginationCallback< - protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse|null|undefined, - protos.google.cloud.eventarc.v1.IChannelConnection>): - Promise<[ - protos.google.cloud.eventarc.v1.IChannelConnection[], - protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest|null, - protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listChannelConnections(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 collection from which to list channel connections. - * @param {number} request.pageSize - * The maximum number of channel connections to return on each page. - * Note: The service may send fewer responses. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListChannelConnections` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListChannelConnetions` - * match the call that provided the page token. - * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection} 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 `listChannelConnectionsAsync()` - * 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. - */ - listChannelConnectionsStream( - request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listChannelConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listChannelConnections.createStream( - this.innerApiCalls.listChannelConnections as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listChannelConnections`, 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 collection from which to list channel connections. - * @param {number} request.pageSize - * The maximum number of channel connections to return on each page. - * Note: The service may send fewer responses. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListChannelConnections` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListChannelConnetions` - * match the call that provided the 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 - * [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. 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/eventarc.list_channel_connections.js - * region_tag:eventarc_v1_generated_Eventarc_ListChannelConnections_async - */ - listChannelConnectionsAsync( - request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listChannelConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listChannelConnections.asyncIterate( - this.innerApiCalls['listChannelConnections'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified channel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} channel - * @returns {string} Resource name string. - */ - channelPath(project:string,location:string,channel:string) { - return this.pathTemplates.channelPathTemplate.render({ - project: project, - location: location, - channel: channel, - }); - } - - /** - * Parse the project from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).project; - } - - /** - * Parse the location from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the location. - */ - matchLocationFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).location; - } - - /** - * Parse the channel from Channel resource. - * - * @param {string} channelName - * A fully-qualified path representing Channel resource. - * @returns {string} A string representing the channel. - */ - matchChannelFromChannelName(channelName: string) { - return this.pathTemplates.channelPathTemplate.match(channelName).channel; - } - - /** - * Return a fully-qualified channelConnection resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} channel_connection - * @returns {string} Resource name string. - */ - channelConnectionPath(project:string,location:string,channelConnection:string) { - return this.pathTemplates.channelConnectionPathTemplate.render({ - project: project, - location: location, - channel_connection: channelConnection, - }); - } - - /** - * Parse the project from ChannelConnection resource. - * - * @param {string} channelConnectionName - * A fully-qualified path representing ChannelConnection resource. - * @returns {string} A string representing the project. - */ - matchProjectFromChannelConnectionName(channelConnectionName: string) { - return this.pathTemplates.channelConnectionPathTemplate.match(channelConnectionName).project; - } - - /** - * Parse the location from ChannelConnection resource. - * - * @param {string} channelConnectionName - * A fully-qualified path representing ChannelConnection resource. - * @returns {string} A string representing the location. - */ - matchLocationFromChannelConnectionName(channelConnectionName: string) { - return this.pathTemplates.channelConnectionPathTemplate.match(channelConnectionName).location; - } - - /** - * Parse the channel_connection from ChannelConnection resource. - * - * @param {string} channelConnectionName - * A fully-qualified path representing ChannelConnection resource. - * @returns {string} A string representing the channel_connection. - */ - matchChannelConnectionFromChannelConnectionName(channelConnectionName: string) { - return this.pathTemplates.channelConnectionPathTemplate.match(channelConnectionName).channel_connection; - } - - /** - * 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 trigger resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} trigger - * @returns {string} Resource name string. - */ - triggerPath(project:string,location:string,trigger:string) { - return this.pathTemplates.triggerPathTemplate.render({ - project: project, - location: location, - trigger: trigger, - }); - } - - /** - * Parse the project from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).project; - } - - /** - * Parse the location from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).location; - } - - /** - * Parse the trigger from Trigger resource. - * - * @param {string} triggerName - * A fully-qualified path representing Trigger resource. - * @returns {string} A string representing the trigger. - */ - matchTriggerFromTriggerName(triggerName: string) { - return this.pathTemplates.triggerPathTemplate.match(triggerName).trigger; - } - - /** - * 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 { - this.initialize(); - if (!this._terminated) { - return this.eventarcStub!.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/eventarc_client_config.json b/owl-bot-staging/v1/src/v1/eventarc_client_config.json deleted file mode 100644 index 656b6b2..0000000 --- a/owl-bot-staging/v1/src/v1/eventarc_client_config.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "interfaces": { - "google.cloud.eventarc.v1.Eventarc": { - "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": { - "GetTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTriggers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListChannels": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetChannelConnection": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListChannelConnections": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateChannelConnection": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteChannelConnection": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/eventarc_proto_list.json b/owl-bot-staging/v1/src/v1/eventarc_proto_list.json deleted file mode 100644 index bc82a79..0000000 --- a/owl-bot-staging/v1/src/v1/eventarc_proto_list.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - "../../protos/google/cloud/eventarc/v1/channel.proto", - "../../protos/google/cloud/eventarc/v1/channel_connection.proto", - "../../protos/google/cloud/eventarc/v1/eventarc.proto", - "../../protos/google/cloud/eventarc/v1/trigger.proto" -] 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 95b183d..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.eventarc.v1", - "libraryPackage": "@google-cloud/eventarc", - "services": { - "Eventarc": { - "clients": { - "grpc": { - "libraryClient": "EventarcClient", - "rpcs": { - "GetTrigger": { - "methods": [ - "getTrigger" - ] - }, - "GetChannel": { - "methods": [ - "getChannel" - ] - }, - "GetChannelConnection": { - "methods": [ - "getChannelConnection" - ] - }, - "CreateTrigger": { - "methods": [ - "createTrigger" - ] - }, - "UpdateTrigger": { - "methods": [ - "updateTrigger" - ] - }, - "DeleteTrigger": { - "methods": [ - "deleteTrigger" - ] - }, - "CreateChannel": { - "methods": [ - "createChannel" - ] - }, - "UpdateChannel": { - "methods": [ - "updateChannel" - ] - }, - "DeleteChannel": { - "methods": [ - "deleteChannel" - ] - }, - "CreateChannelConnection": { - "methods": [ - "createChannelConnection" - ] - }, - "DeleteChannelConnection": { - "methods": [ - "deleteChannelConnection" - ] - }, - "ListTriggers": { - "methods": [ - "listTriggers", - "listTriggersStream", - "listTriggersAsync" - ] - }, - "ListChannels": { - "methods": [ - "listChannels", - "listChannelsStream", - "listChannelsAsync" - ] - }, - "ListChannelConnections": { - "methods": [ - "listChannelConnections", - "listChannelConnectionsStream", - "listChannelConnectionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "EventarcClient", - "rpcs": { - "GetTrigger": { - "methods": [ - "getTrigger" - ] - }, - "GetChannel": { - "methods": [ - "getChannel" - ] - }, - "GetChannelConnection": { - "methods": [ - "getChannelConnection" - ] - }, - "CreateTrigger": { - "methods": [ - "createTrigger" - ] - }, - "UpdateTrigger": { - "methods": [ - "updateTrigger" - ] - }, - "DeleteTrigger": { - "methods": [ - "deleteTrigger" - ] - }, - "CreateChannel": { - "methods": [ - "createChannel" - ] - }, - "UpdateChannel": { - "methods": [ - "updateChannel" - ] - }, - "DeleteChannel": { - "methods": [ - "deleteChannel" - ] - }, - "CreateChannelConnection": { - "methods": [ - "createChannelConnection" - ] - }, - "DeleteChannelConnection": { - "methods": [ - "deleteChannelConnection" - ] - }, - "ListTriggers": { - "methods": [ - "listTriggers", - "listTriggersStream", - "listTriggersAsync" - ] - }, - "ListChannels": { - "methods": [ - "listChannels", - "listChannelsStream", - "listChannelsAsync" - ] - }, - "ListChannelConnections": { - "methods": [ - "listChannelConnections", - "listChannelConnectionsStream", - "listChannelConnectionsAsync" - ] - } - } - } - } - } - } -} 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 8f9bb91..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +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 {EventarcClient} from './eventarc_client'; 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 92505d9..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const eventarc = require('@google-cloud/eventarc'); - -function main() { - const eventarcClient = new eventarc.EventarcClient(); -} - -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 4346b31..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +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 {EventarcClient} from '@google-cloud/eventarc'; - -// check that the client class type name can be used -function doStuffWithEventarcClient(client: EventarcClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const eventarcClient = new EventarcClient(); - doStuffWithEventarcClient(eventarcClient); -} - -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 8ec4522..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_eventarc_v1.ts b/owl-bot-staging/v1/test/gapic_eventarc_v1.ts deleted file mode 100644 index 0e0dc49..0000000 --- a/owl-bot-staging/v1/test/gapic_eventarc_v1.ts +++ /dev/null @@ -1,2473 +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 eventarcModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -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 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.EventarcClient', () => { - it('has servicePath', () => { - const servicePath = eventarcModule.v1.EventarcClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = eventarcModule.v1.EventarcClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = eventarcModule.v1.EventarcClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new eventarcModule.v1.EventarcClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new eventarcModule.v1.EventarcClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.eventarcStub, undefined); - await client.initialize(); - assert(client.eventarcStub); - }); - - it('has close method', () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new eventarcModule.v1.EventarcClient({ - 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 eventarcModule.v1.EventarcClient({ - 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('getTrigger', () => { - it('invokes getTrigger without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetTriggerRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()); - client.innerApiCalls.getTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.getTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getTrigger without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetTriggerRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()); - client.innerApiCalls.getTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTrigger( - request, - (err?: Error|null, result?: protos.google.cloud.eventarc.v1.ITrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getTrigger with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetTriggerRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTrigger(request), expectedError); - assert((client.innerApiCalls.getTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getChannel', () => { - it('invokes getChannel without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()); - client.innerApiCalls.getChannel = stubSimpleCall(expectedResponse); - const [response] = await client.getChannel(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getChannel without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()); - client.innerApiCalls.getChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getChannel( - request, - (err?: Error|null, result?: protos.google.cloud.eventarc.v1.IChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getChannel with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getChannel(request), expectedError); - assert((client.innerApiCalls.getChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getChannelConnection', () => { - it('invokes getChannelConnection without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()); - client.innerApiCalls.getChannelConnection = stubSimpleCall(expectedResponse); - const [response] = await client.getChannelConnection(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getChannelConnection without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()); - client.innerApiCalls.getChannelConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getChannelConnection( - request, - (err?: Error|null, result?: protos.google.cloud.eventarc.v1.IChannelConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getChannelConnection with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getChannelConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getChannelConnection(request), expectedError); - assert((client.innerApiCalls.getChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createTrigger', () => { - it('invokes createTrigger without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateTriggerRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createTrigger = stubLongRunningCall(expectedResponse); - const [operation] = await client.createTrigger(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createTrigger without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateTriggerRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createTrigger = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTrigger( - 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); - assert((client.innerApiCalls.createTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createTrigger with call error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateTriggerRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createTrigger = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createTrigger(request), expectedError); - assert((client.innerApiCalls.createTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createTrigger with LRO error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateTriggerRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createTrigger = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createTrigger(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateTriggerProgress without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkCreateTriggerProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateTriggerProgress with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkCreateTriggerProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateTrigger', () => { - it('invokes updateTrigger without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateTriggerRequest()); - request.trigger = {}; - request.trigger.name = ''; - const expectedHeaderRequestParams = "trigger.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateTrigger = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateTrigger(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateTrigger without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateTriggerRequest()); - request.trigger = {}; - request.trigger.name = ''; - const expectedHeaderRequestParams = "trigger.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateTrigger = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTrigger( - 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); - assert((client.innerApiCalls.updateTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateTrigger with call error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateTriggerRequest()); - request.trigger = {}; - request.trigger.name = ''; - const expectedHeaderRequestParams = "trigger.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTrigger = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateTrigger(request), expectedError); - assert((client.innerApiCalls.updateTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateTrigger with LRO error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateTriggerRequest()); - request.trigger = {}; - request.trigger.name = ''; - const expectedHeaderRequestParams = "trigger.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTrigger = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateTrigger(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateTriggerProgress without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkUpdateTriggerProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateTriggerProgress with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkUpdateTriggerProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteTrigger', () => { - it('invokes deleteTrigger without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteTriggerRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteTrigger = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteTrigger(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteTrigger without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteTriggerRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteTrigger = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTrigger( - 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); - assert((client.innerApiCalls.deleteTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteTrigger with call error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteTriggerRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTrigger = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteTrigger(request), expectedError); - assert((client.innerApiCalls.deleteTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteTrigger with LRO error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteTriggerRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTrigger = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteTrigger(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteTrigger as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteTriggerProgress without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkDeleteTriggerProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteTriggerProgress with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkDeleteTriggerProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createChannel', () => { - it('invokes createChannel without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createChannel = stubLongRunningCall(expectedResponse); - const [operation] = await client.createChannel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createChannel without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createChannel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createChannel( - 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); - assert((client.innerApiCalls.createChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createChannel with call error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createChannel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createChannel(request), expectedError); - assert((client.innerApiCalls.createChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createChannel with LRO error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createChannel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createChannel(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateChannelProgress without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkCreateChannelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateChannelProgress with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkCreateChannelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateChannel', () => { - it('invokes updateChannel without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateChannelRequest()); - request.channel = {}; - request.channel.name = ''; - const expectedHeaderRequestParams = "channel.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateChannel = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateChannel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateChannel without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateChannelRequest()); - request.channel = {}; - request.channel.name = ''; - const expectedHeaderRequestParams = "channel.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateChannel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateChannel( - 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); - assert((client.innerApiCalls.updateChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateChannel with call error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateChannelRequest()); - request.channel = {}; - request.channel.name = ''; - const expectedHeaderRequestParams = "channel.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateChannel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateChannel(request), expectedError); - assert((client.innerApiCalls.updateChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateChannel with LRO error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.UpdateChannelRequest()); - request.channel = {}; - request.channel.name = ''; - const expectedHeaderRequestParams = "channel.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateChannel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateChannel(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateChannelProgress without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkUpdateChannelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateChannelProgress with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkUpdateChannelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteChannel', () => { - it('invokes deleteChannel without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteChannel = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteChannel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteChannel without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteChannel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteChannel( - 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); - assert((client.innerApiCalls.deleteChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteChannel with call error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteChannel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteChannel(request), expectedError); - assert((client.innerApiCalls.deleteChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteChannel with LRO error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteChannel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteChannel(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteChannel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteChannelProgress without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkDeleteChannelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteChannelProgress with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkDeleteChannelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createChannelConnection', () => { - it('invokes createChannelConnection without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createChannelConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.createChannelConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createChannelConnection without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createChannelConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createChannelConnection( - 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); - assert((client.innerApiCalls.createChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createChannelConnection with call error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createChannelConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createChannelConnection(request), expectedError); - assert((client.innerApiCalls.createChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createChannelConnection with LRO error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createChannelConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createChannelConnection(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateChannelConnectionProgress without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkCreateChannelConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateChannelConnectionProgress with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkCreateChannelConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteChannelConnection', () => { - it('invokes deleteChannelConnection without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteChannelConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteChannelConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteChannelConnection without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteChannelConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteChannelConnection( - 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); - assert((client.innerApiCalls.deleteChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteChannelConnection with call error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteChannelConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteChannelConnection(request), expectedError); - assert((client.innerApiCalls.deleteChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteChannelConnection with LRO error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteChannelConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteChannelConnection(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteChannelConnection as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteChannelConnectionProgress without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkDeleteChannelConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteChannelConnectionProgress with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - 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.checkDeleteChannelConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listTriggers', () => { - it('invokes listTriggers without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - ]; - client.innerApiCalls.listTriggers = stubSimpleCall(expectedResponse); - const [response] = await client.listTriggers(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listTriggers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listTriggers without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - ]; - client.innerApiCalls.listTriggers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTriggers( - request, - (err?: Error|null, result?: protos.google.cloud.eventarc.v1.ITrigger[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listTriggers as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listTriggers with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listTriggers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTriggers(request), expectedError); - assert((client.innerApiCalls.listTriggers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listTriggersStream without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - ]; - client.descriptors.page.listTriggers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.eventarc.v1.Trigger[] = []; - stream.on('data', (response: protos.google.cloud.eventarc.v1.Trigger) => { - 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.listTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTriggers, request)); - assert.strictEqual( - (client.descriptors.page.listTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listTriggersStream with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listTriggers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.eventarc.v1.Trigger[] = []; - stream.on('data', (response: protos.google.cloud.eventarc.v1.Trigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTriggers, request)); - assert.strictEqual( - (client.descriptors.page.listTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listTriggers without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - ]; - client.descriptors.page.listTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.eventarc.v1.ITrigger[] = []; - const iterable = client.listTriggersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listTriggers with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListTriggersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTriggersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.eventarc.v1.ITrigger[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listChannels', () => { - it('invokes listChannels without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - ]; - client.innerApiCalls.listChannels = stubSimpleCall(expectedResponse); - const [response] = await client.listChannels(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listChannels as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listChannels without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - ]; - client.innerApiCalls.listChannels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listChannels( - request, - (err?: Error|null, result?: protos.google.cloud.eventarc.v1.IChannel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listChannels as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listChannels with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listChannels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listChannels(request), expectedError); - assert((client.innerApiCalls.listChannels as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listChannelsStream without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - ]; - client.descriptors.page.listChannels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listChannelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.eventarc.v1.Channel[] = []; - stream.on('data', (response: protos.google.cloud.eventarc.v1.Channel) => { - 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.listChannels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listChannels, request)); - assert.strictEqual( - (client.descriptors.page.listChannels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listChannelsStream with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listChannels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listChannelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.eventarc.v1.Channel[] = []; - stream.on('data', (response: protos.google.cloud.eventarc.v1.Channel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listChannels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listChannels, request)); - assert.strictEqual( - (client.descriptors.page.listChannels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listChannels without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), - ]; - client.descriptors.page.listChannels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.eventarc.v1.IChannel[] = []; - const iterable = client.listChannelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listChannels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listChannels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listChannels with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listChannels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listChannelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.eventarc.v1.IChannel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listChannels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listChannels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listChannelConnections', () => { - it('invokes listChannelConnections without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - ]; - client.innerApiCalls.listChannelConnections = stubSimpleCall(expectedResponse); - const [response] = await client.listChannelConnections(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listChannelConnections as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listChannelConnections without error using callback', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - ]; - client.innerApiCalls.listChannelConnections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listChannelConnections( - request, - (err?: Error|null, result?: protos.google.cloud.eventarc.v1.IChannelConnection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listChannelConnections as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listChannelConnections with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listChannelConnections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listChannelConnections(request), expectedError); - assert((client.innerApiCalls.listChannelConnections as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listChannelConnectionsStream without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - ]; - client.descriptors.page.listChannelConnections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listChannelConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.eventarc.v1.ChannelConnection[] = []; - stream.on('data', (response: protos.google.cloud.eventarc.v1.ChannelConnection) => { - 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.listChannelConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listChannelConnections, request)); - assert.strictEqual( - (client.descriptors.page.listChannelConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listChannelConnectionsStream with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listChannelConnections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listChannelConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.eventarc.v1.ChannelConnection[] = []; - stream.on('data', (response: protos.google.cloud.eventarc.v1.ChannelConnection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listChannelConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listChannelConnections, request)); - assert.strictEqual( - (client.descriptors.page.listChannelConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listChannelConnections without error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.ChannelConnection()), - ]; - client.descriptors.page.listChannelConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.eventarc.v1.IChannelConnection[] = []; - const iterable = client.listChannelConnectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listChannelConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listChannelConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listChannelConnections with error', async () => { - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listChannelConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listChannelConnectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.eventarc.v1.IChannelConnection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listChannelConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listChannelConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('channel', () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - channel: "channelValue", - }; - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('channelConnection', () => { - const fakePath = "/rendered/path/channelConnection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - channel_connection: "channelConnectionValue", - }; - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.channelConnectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelConnectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelConnectionPath', () => { - const result = client.channelConnectionPath("projectValue", "locationValue", "channelConnectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelConnectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelConnectionName', () => { - const result = client.matchProjectFromChannelConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelConnectionName', () => { - const result = client.matchLocationFromChannelConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelConnectionFromChannelConnectionName', () => { - const result = client.matchChannelConnectionFromChannelConnectionName(fakePath); - assert.strictEqual(result, "channelConnectionValue"); - assert((client.pathTemplates.channelConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new eventarcModule.v1.EventarcClient({ - 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 eventarcModule.v1.EventarcClient({ - 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('trigger', () => { - const fakePath = "/rendered/path/trigger"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - trigger: "triggerValue", - }; - const client = new eventarcModule.v1.EventarcClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.triggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.triggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('triggerPath', () => { - const result = client.triggerPath("projectValue", "locationValue", "triggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.triggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTriggerName', () => { - const result = client.matchProjectFromTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTriggerName', () => { - const result = client.matchLocationFromTriggerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.triggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTriggerFromTriggerName', () => { - const result = client.matchTriggerFromTriggerName(fakePath); - assert.strictEqual(result, "triggerValue"); - assert((client.pathTemplates.triggerPathTemplate.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 5064b66..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: 'Eventarc', - filename: './eventarc.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/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel.proto b/protos/google/cloud/eventarc/v1/channel.proto similarity index 100% rename from owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel.proto rename to protos/google/cloud/eventarc/v1/channel.proto diff --git a/owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel_connection.proto b/protos/google/cloud/eventarc/v1/channel_connection.proto similarity index 100% rename from owl-bot-staging/v1/protos/google/cloud/eventarc/v1/channel_connection.proto rename to protos/google/cloud/eventarc/v1/channel_connection.proto diff --git a/protos/google/cloud/eventarc/v1/eventarc.proto b/protos/google/cloud/eventarc/v1/eventarc.proto index e91e265..41aa848 100644 --- a/protos/google/cloud/eventarc/v1/eventarc.proto +++ b/protos/google/cloud/eventarc/v1/eventarc.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,16 +20,18 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/eventarc/v1/channel.proto"; +import "google/cloud/eventarc/v1/channel_connection.proto"; import "google/cloud/eventarc/v1/trigger.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; +option csharp_namespace = "Google.Cloud.Eventarc.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; option java_multiple_files = true; option java_outer_classname = "EventarcProto"; option java_package = "com.google.cloud.eventarc.v1"; -option csharp_namespace = "Google.Cloud.Eventarc.V1"; option php_namespace = "Google\\Cloud\\Eventarc\\V1"; option ruby_package = "Google::Cloud::Eventarc::V1"; @@ -92,6 +94,101 @@ service Eventarc { metadata_type: "OperationMetadata" }; } + + // Get a single Channel. + rpc GetChannel(GetChannelRequest) returns (Channel) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/channels/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List channels. + rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/channels" + }; + option (google.api.method_signature) = "parent"; + } + + // Create a new channel in a particular project and location. + rpc CreateChannel(CreateChannelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/channels" + body: "channel" + }; + option (google.api.method_signature) = "parent,channel,channel_id"; + option (google.longrunning.operation_info) = { + response_type: "Channel" + metadata_type: "OperationMetadata" + }; + } + + // Update a single channel. + rpc UpdateChannel(UpdateChannelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{channel.name=projects/*/locations/*/channels/*}" + body: "channel" + }; + option (google.api.method_signature) = "channel,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Channel" + metadata_type: "OperationMetadata" + }; + } + + // Delete a single channel. + rpc DeleteChannel(DeleteChannelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/channels/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Channel" + metadata_type: "OperationMetadata" + }; + } + + // Get a single ChannelConnection. + rpc GetChannelConnection(GetChannelConnectionRequest) returns (ChannelConnection) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/channelConnections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List channel connections. + rpc ListChannelConnections(ListChannelConnectionsRequest) returns (ListChannelConnectionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/channelConnections" + }; + option (google.api.method_signature) = "parent"; + } + + // Create a new ChannelConnection in a particular project and location. + rpc CreateChannelConnection(CreateChannelConnectionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/channelConnections" + body: "channel_connection" + }; + option (google.api.method_signature) = "parent,channel_connection,channel_connection_id"; + option (google.longrunning.operation_info) = { + response_type: "ChannelConnection" + metadata_type: "OperationMetadata" + }; + } + + // Delete a single ChannelConnection. + rpc DeleteChannelConnection(DeleteChannelConnectionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/channelConnections/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "ChannelConnection" + metadata_type: "OperationMetadata" + }; + } } // The request message for the GetTrigger method. @@ -126,14 +223,14 @@ message ListTriggersRequest { // the call that provided the page token. string page_token = 3; - // The sorting order of the resources returned. Value should be a comma - // separated list of fields. The default sorting oder is ascending. To specify - // descending order for a field, append a ` desc` suffix; for example: + // The sorting order of the resources returned. Value should be a + // comma-separated list of fields. The default sorting order is ascending. To + // specify descending order for a field, append a `desc` suffix; for example: // `name desc, trigger_id`. string order_by = 4; } -// The response message for the ListTriggers method. +// The response message for the `ListTriggers` method. message ListTriggersResponse { // The requested triggers, up to the number specified in `page_size`. repeated Trigger triggers = 1; @@ -162,7 +259,7 @@ message CreateTriggerRequest { // Required. The user-provided ID to be assigned to the trigger. string trigger_id = 3 [(google.api.field_behavior) = REQUIRED]; - // Required. If set, validate the request and preview the review, but do not actually + // Required. If set, validate the request and preview the review, but do not // post it. bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; } @@ -172,8 +269,8 @@ message UpdateTriggerRequest { // The trigger to be updated. Trigger trigger = 1; - // The fields to be updated; only fields explicitly provided will be updated. - // If no field mask is provided, all provided fields in the request will be + // The fields to be updated; only fields explicitly provided are updated. + // If no field mask is provided, all provided fields in the request are // updated. To update all fields, provide a field mask of "*". google.protobuf.FieldMask update_mask = 2; @@ -181,7 +278,7 @@ message UpdateTriggerRequest { // created. In this situation, `update_mask` is ignored. bool allow_missing = 3; - // Required. If set, validate the request and preview the review, but do not actually + // Required. If set, validate the request and preview the review, but do not // post it. bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; } @@ -204,11 +301,190 @@ message DeleteTriggerRequest { // but no action will be taken on the server. bool allow_missing = 3; - // Required. If set, validate the request and preview the review, but do not actually + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the GetChannel method. +message GetChannelRequest { + // Required. The name of the channel to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; +} + +// The request message for the ListChannels method. +message ListChannelsRequest { + // Required. The parent collection to list channels on. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/Channel" + } + ]; + + // The maximum number of channels to return on each page. + // Note: The service may send fewer. + int32 page_size = 2; + + // The page token; provide the value from the `next_page_token` field in a + // previous `ListChannels` call to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListChannels` must + // match the call that provided the page token. + string page_token = 3; + + // The sorting order of the resources returned. Value should be a + // comma-separated list of fields. The default sorting order is ascending. To + // specify descending order for a field, append a `desc` suffix; for example: + // `name desc, channel_id`. + string order_by = 4; +} + +// The response message for the `ListChannels` method. +message ListChannelsResponse { + // The requested channels, up to the number specified in `page_size`. + repeated Channel channels = 1; + + // A page token that can be sent to ListChannels to request the next page. + // If this is empty, then there are no more pages. + string next_page_token = 2; + + // Unreachable resources, if any. + repeated string unreachable = 3; +} + +// The request message for the CreateChannel method. +message CreateChannelRequest { + // Required. The parent collection in which to add this channel. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/Channel" + } + ]; + + // Required. The channel to create. + Channel channel = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The user-provided ID to be assigned to the channel. + string channel_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. If set, validate the request and preview the review, but do not // post it. bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; } +// The request message for the UpdateChannel method. +message UpdateChannelRequest { + // The channel to be updated. + Channel channel = 1; + + // The fields to be updated; only fields explicitly provided are updated. + // If no field mask is provided, all provided fields in the request are + // updated. To update all fields, provide a field mask of "*". + google.protobuf.FieldMask update_mask = 2; + + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the DeleteChannel method. +message DeleteChannelRequest { + // Required. The name of the channel to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Channel" + } + ]; + + // Required. If set, validate the request and preview the review, but do not + // post it. + bool validate_only = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the GetChannelConnection method. +message GetChannelConnectionRequest { + // Required. The name of the channel connection to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/ChannelConnection" + } + ]; +} + +// The request message for the ListChannelConnections method. +message ListChannelConnectionsRequest { + // Required. The parent collection from which to list channel connections. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/ChannelConnection" + } + ]; + + // The maximum number of channel connections to return on each page. + // Note: The service may send fewer responses. + int32 page_size = 2; + + // The page token; provide the value from the `next_page_token` field in a + // previous `ListChannelConnections` call to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListChannelConnetions` + // match the call that provided the page token. + string page_token = 3; +} + +// The response message for the `ListChannelConnections` method. +message ListChannelConnectionsResponse { + // The requested channel connections, up to the number specified in + // `page_size`. + repeated ChannelConnection channel_connections = 1; + + // A page token that can be sent to ListChannelConnections to request the + // next page. + // If this is empty, then there are no more pages. + string next_page_token = 2; + + // Unreachable resources, if any. + repeated string unreachable = 3; +} + +// The request message for the CreateChannelConnection method. +message CreateChannelConnectionRequest { + // Required. The parent collection in which to add this channel connection. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/ChannelConnection" + } + ]; + + // Required. Channel connection to create. + ChannelConnection channel_connection = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The user-provided ID to be assigned to the channel connection. + string channel_connection_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the DeleteChannelConnection method. +message DeleteChannelConnectionRequest { + // Required. The name of the channel connection to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/ChannelConnection" + } + ]; +} + // Represents the metadata of the long-running operation. message OperationMetadata { // Output only. The time the operation was created. diff --git a/protos/google/cloud/eventarc/v1/trigger.proto b/protos/google/cloud/eventarc/v1/trigger.proto index 6ec85a7..5ba97d5 100644 --- a/protos/google/cloud/eventarc/v1/trigger.proto +++ b/protos/google/cloud/eventarc/v1/trigger.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -47,26 +47,23 @@ message Trigger { singular: "trigger" }; - // Required. The resource name of the trigger. Must be unique within the - // location on the project and must be in + // Required. The resource name of the trigger. Must be unique within the location of the + // project and must be in // `projects/{project}/locations/{location}/triggers/{trigger}` format. string name = 1 [(google.api.field_behavior) = REQUIRED]; - // Output only. Server assigned unique identifier for the trigger. The value - // is a UUID4 string and guaranteed to remain unchanged until the resource is - // deleted. + // Output only. Server-assigned unique identifier for the trigger. The value is a UUID4 + // string and guaranteed to remain unchanged until the resource is deleted. string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The creation time. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The last-modified time. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Required. null The list of filters that applies to event attributes. Only - // events that match all the provided filters will be sent to the destination. + // Required. null The list of filters that applies to event attributes. Only events that + // match all the provided filters are sent to the destination. repeated EventFilter event_filters = 8 [ (google.api.field_behavior) = UNORDERED_LIST, (google.api.field_behavior) = REQUIRED @@ -75,7 +72,7 @@ message Trigger { // Optional. The IAM service account email associated with the trigger. The // service account represents the identity of the trigger. // - // The principal who calls this API must have `iam.serviceAccounts.actAs` + // The principal who calls this API must have the `iam.serviceAccounts.actAs` // permission in the service account. See // https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common // for more information. @@ -84,8 +81,8 @@ message Trigger { // identity tokens when invoking the service. See // https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account // for information on how to invoke authenticated Cloud Run services. - // In order to create Audit Log triggers, the service account should also - // have `roles/eventarc.eventReceiver` IAM role. + // To create Audit Log triggers, the service account should also + // have the `roles/eventarc.eventReceiver` IAM role. string service_account = 9 [ (google.api.field_behavior) = OPTIONAL, (google.api.resource_reference) = { @@ -96,48 +93,68 @@ message Trigger { // Required. Destination specifies where the events should be sent to. Destination destination = 10 [(google.api.field_behavior) = REQUIRED]; - // Optional. In order to deliver messages, Eventarc may use other GCP - // products as transport intermediary. This field contains a reference to that - // transport intermediary. This information can be used for debugging + // Optional. To deliver messages, Eventarc might use other GCP + // products as a transport intermediary. This field contains a reference to + // that transport intermediary. This information can be used for debugging // purposes. Transport transport = 11 [(google.api.field_behavior) = OPTIONAL]; - // Optional. User labels attached to the triggers that can be used to group - // resources. + // Optional. User labels attached to the triggers that can be used to group resources. map labels = 12 [(google.api.field_behavior) = OPTIONAL]; - // Output only. This checksum is computed by the server based on the value of - // other fields, and may be sent only on create requests to ensure the client - // has an up-to-date value before proceeding. + // Optional. The name of the channel associated with the trigger in + // `projects/{project}/locations/{location}/channels/{channel}` format. + // You must provide a channel to receive events from Eventarc SaaS partners. + string channel = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. This checksum is computed by the server based on the value of other + // fields, and might be sent only on create requests to ensure that the + // client has an up-to-date value before proceeding. string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Filters events based on exact matches on the CloudEvents attributes. message EventFilter { - // Required. The name of a CloudEvents attribute. Currently, only a subset of - // attributes are supported for filtering. + // Required. The name of a CloudEvents attribute. Currently, only a subset of attributes + // are supported for filtering. // // All triggers MUST provide a filter for the 'type' attribute. string attribute = 1 [(google.api.field_behavior) = REQUIRED]; // Required. The value for the attribute. string value = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The operator used for matching the events with the value of the + // filter. If not specified, only events that have an exact key-value pair + // specified in the filter are matched. The only allowed value is + // `match-path-pattern`. + string operator = 3 [(google.api.field_behavior) = OPTIONAL]; } // Represents a target of an invocation over HTTP. message Destination { oneof descriptor { - // Cloud Run fully-managed service that receives the events. The service - // should be running in the same project of the trigger. + // Cloud Run fully-managed resource that receives the events. The resource + // should be in the same project as the trigger. CloudRun cloud_run = 1; + + // The Cloud Function resource name. Only Cloud Functions V2 is supported. + // Format: `projects/{project}/locations/{location}/functions/{function}` + string cloud_function = 2 [(google.api.resource_reference) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + }]; + + // A GKE service capable of receiving events. The service should be running + // in the same project as the trigger. + GKE gke = 3; } } -// Represents the transport intermediaries created for the trigger in order to +// Represents the transport intermediaries created for the trigger to // deliver events. message Transport { oneof intermediary { - // The Pub/Sub topic and subscription used by Eventarc as delivery + // The Pub/Sub topic and subscription used by Eventarc as a transport // intermediary. Pubsub pubsub = 1; } @@ -148,17 +165,18 @@ message CloudRun { // Required. The name of the Cloud Run service being addressed. See // https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services. // - // Only services located in the same project of the trigger object + // Only services located in the same project as the trigger object // can be addressed. string service = 1 [ (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "run.googleapis.com/Service" } + (google.api.resource_reference) = { + type: "run.googleapis.com/Service" + } ]; - // Optional. The relative path on the Cloud Run service the events should be - // sent to. + // Optional. The relative path on the Cloud Run service the events should be sent to. // - // The value must conform to the definition of URI path segment (section 3.3 + // The value must conform to the definition of a URI path segment (section 3.3 // of RFC2396). Examples: "/route", "route", "route/subroute". string path = 2 [(google.api.field_behavior) = OPTIONAL]; @@ -166,19 +184,43 @@ message CloudRun { string region = 3 [(google.api.field_behavior) = REQUIRED]; } +// Represents a GKE destination. +message GKE { + // Required. The name of the cluster the GKE service is running in. The cluster must be + // running in the same project as the trigger being created. + string cluster = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The name of the Google Compute Engine in which the cluster resides, which + // can either be compute zone (for example, us-central1-a) for the zonal + // clusters or region (for example, us-central1) for regional clusters. + string location = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The namespace the GKE service is running in. + string namespace = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Name of the GKE service. + string service = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The relative path on the GKE service the events should be sent to. + // + // The value must conform to the definition of a URI path segment (section 3.3 + // of RFC2396). Examples: "/route", "route", "route/subroute". + string path = 5 [(google.api.field_behavior) = OPTIONAL]; +} + // Represents a Pub/Sub transport. message Pubsub { - // Optional. The name of the Pub/Sub topic created and managed by Eventarc - // system as a transport for the event delivery. Format: + // Optional. The name of the Pub/Sub topic created and managed by Eventarc as + // a transport for the event delivery. Format: // `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`. // - // You may set an existing topic for triggers of the type - // `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide - // here will not be deleted by Eventarc at trigger deletion. + // You can set an existing topic for triggers of the type + // `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide + // here is not deleted by Eventarc at trigger deletion. string topic = 1 [(google.api.field_behavior) = OPTIONAL]; - // Output only. The name of the Pub/Sub subscription created and managed by - // Eventarc system as a transport for the event delivery. Format: + // Output only. The name of the Pub/Sub subscription created and managed by Eventarc + // as a transport for the event delivery. Format: // `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`. string subscription = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 316e449..2a60a75 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -26,754 +26,2301 @@ export namespace google { /** Namespace v1. */ namespace v1 { + /** Properties of a Channel. */ + interface IChannel { + + /** Channel name */ + name?: (string|null); + + /** Channel uid */ + uid?: (string|null); + + /** Channel createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Channel updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Channel provider */ + provider?: (string|null); + + /** Channel pubsubTopic */ + pubsubTopic?: (string|null); + + /** Channel state */ + state?: (google.cloud.eventarc.v1.Channel.State|keyof typeof google.cloud.eventarc.v1.Channel.State|null); + + /** Channel activationToken */ + activationToken?: (string|null); + } + + /** Represents a Channel. */ + class Channel implements IChannel { + + /** + * Constructs a new Channel. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IChannel); + + /** Channel name. */ + public name: string; + + /** Channel uid. */ + public uid: string; + + /** Channel createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Channel updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Channel provider. */ + public provider: string; + + /** Channel pubsubTopic. */ + public pubsubTopic?: (string|null); + + /** Channel state. */ + public state: (google.cloud.eventarc.v1.Channel.State|keyof typeof google.cloud.eventarc.v1.Channel.State); + + /** Channel activationToken. */ + public activationToken: string; + + /** Channel transport. */ + public transport?: "pubsubTopic"; + + /** + * Creates a new Channel instance using the specified properties. + * @param [properties] Properties to set + * @returns Channel instance + */ + public static create(properties?: google.cloud.eventarc.v1.IChannel): google.cloud.eventarc.v1.Channel; + + /** + * Encodes the specified Channel message. Does not implicitly {@link google.cloud.eventarc.v1.Channel.verify|verify} messages. + * @param message Channel message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IChannel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Channel message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.Channel.verify|verify} messages. + * @param message Channel message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IChannel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Channel message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Channel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.Channel; + + /** + * Decodes a Channel message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Channel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.Channel; + + /** + * Verifies a Channel message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Channel message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Channel + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.Channel; + + /** + * Creates a plain object from a Channel message. Also converts values to other types if specified. + * @param message Channel + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.Channel, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Channel to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Channel { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + PENDING = 1, + ACTIVE = 2, + INACTIVE = 3 + } + } + + /** Properties of a ChannelConnection. */ + interface IChannelConnection { + + /** ChannelConnection name */ + name?: (string|null); + + /** ChannelConnection uid */ + uid?: (string|null); + + /** ChannelConnection channel */ + channel?: (string|null); + + /** ChannelConnection createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ChannelConnection updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ChannelConnection activationToken */ + activationToken?: (string|null); + } + + /** Represents a ChannelConnection. */ + class ChannelConnection implements IChannelConnection { + + /** + * Constructs a new ChannelConnection. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IChannelConnection); + + /** ChannelConnection name. */ + public name: string; + + /** ChannelConnection uid. */ + public uid: string; + + /** ChannelConnection channel. */ + public channel: string; + + /** ChannelConnection createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ChannelConnection updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ChannelConnection activationToken. */ + public activationToken: string; + + /** + * Creates a new ChannelConnection instance using the specified properties. + * @param [properties] Properties to set + * @returns ChannelConnection instance + */ + public static create(properties?: google.cloud.eventarc.v1.IChannelConnection): google.cloud.eventarc.v1.ChannelConnection; + + /** + * Encodes the specified ChannelConnection message. Does not implicitly {@link google.cloud.eventarc.v1.ChannelConnection.verify|verify} messages. + * @param message ChannelConnection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IChannelConnection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChannelConnection message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ChannelConnection.verify|verify} messages. + * @param message ChannelConnection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IChannelConnection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChannelConnection message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChannelConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ChannelConnection; + + /** + * Decodes a ChannelConnection message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChannelConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ChannelConnection; + + /** + * Verifies a ChannelConnection message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ChannelConnection message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChannelConnection + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ChannelConnection; + + /** + * Creates a plain object from a ChannelConnection message. Also converts values to other types if specified. + * @param message ChannelConnection + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.ChannelConnection, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChannelConnection to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents an Eventarc */ class Eventarc extends $protobuf.rpc.Service { /** - * Constructs a new Eventarc service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited + * Constructs a new Eventarc service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Eventarc service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Eventarc; + + /** + * Calls GetTrigger. + * @param request GetTriggerRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Trigger + */ + public getTrigger(request: google.cloud.eventarc.v1.IGetTriggerRequest, callback: google.cloud.eventarc.v1.Eventarc.GetTriggerCallback): void; + + /** + * Calls GetTrigger. + * @param request GetTriggerRequest message or plain object + * @returns Promise + */ + public getTrigger(request: google.cloud.eventarc.v1.IGetTriggerRequest): Promise; + + /** + * Calls ListTriggers. + * @param request ListTriggersRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListTriggersResponse + */ + public listTriggers(request: google.cloud.eventarc.v1.IListTriggersRequest, callback: google.cloud.eventarc.v1.Eventarc.ListTriggersCallback): void; + + /** + * Calls ListTriggers. + * @param request ListTriggersRequest message or plain object + * @returns Promise + */ + public listTriggers(request: google.cloud.eventarc.v1.IListTriggersRequest): Promise; + + /** + * Calls CreateTrigger. + * @param request CreateTriggerRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createTrigger(request: google.cloud.eventarc.v1.ICreateTriggerRequest, callback: google.cloud.eventarc.v1.Eventarc.CreateTriggerCallback): void; + + /** + * Calls CreateTrigger. + * @param request CreateTriggerRequest message or plain object + * @returns Promise + */ + public createTrigger(request: google.cloud.eventarc.v1.ICreateTriggerRequest): Promise; + + /** + * Calls UpdateTrigger. + * @param request UpdateTriggerRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateTrigger(request: google.cloud.eventarc.v1.IUpdateTriggerRequest, callback: google.cloud.eventarc.v1.Eventarc.UpdateTriggerCallback): void; + + /** + * Calls UpdateTrigger. + * @param request UpdateTriggerRequest message or plain object + * @returns Promise + */ + public updateTrigger(request: google.cloud.eventarc.v1.IUpdateTriggerRequest): Promise; + + /** + * Calls DeleteTrigger. + * @param request DeleteTriggerRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteTrigger(request: google.cloud.eventarc.v1.IDeleteTriggerRequest, callback: google.cloud.eventarc.v1.Eventarc.DeleteTriggerCallback): void; + + /** + * Calls DeleteTrigger. + * @param request DeleteTriggerRequest message or plain object + * @returns Promise + */ + public deleteTrigger(request: google.cloud.eventarc.v1.IDeleteTriggerRequest): Promise; + + /** + * Calls GetChannel. + * @param request GetChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Channel + */ + public getChannel(request: google.cloud.eventarc.v1.IGetChannelRequest, callback: google.cloud.eventarc.v1.Eventarc.GetChannelCallback): void; + + /** + * Calls GetChannel. + * @param request GetChannelRequest message or plain object + * @returns Promise + */ + public getChannel(request: google.cloud.eventarc.v1.IGetChannelRequest): Promise; + + /** + * Calls ListChannels. + * @param request ListChannelsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListChannelsResponse + */ + public listChannels(request: google.cloud.eventarc.v1.IListChannelsRequest, callback: google.cloud.eventarc.v1.Eventarc.ListChannelsCallback): void; + + /** + * Calls ListChannels. + * @param request ListChannelsRequest message or plain object + * @returns Promise + */ + public listChannels(request: google.cloud.eventarc.v1.IListChannelsRequest): Promise; + + /** + * Calls CreateChannel. + * @param request CreateChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createChannel(request: google.cloud.eventarc.v1.ICreateChannelRequest, callback: google.cloud.eventarc.v1.Eventarc.CreateChannelCallback): void; + + /** + * Calls CreateChannel. + * @param request CreateChannelRequest message or plain object + * @returns Promise + */ + public createChannel(request: google.cloud.eventarc.v1.ICreateChannelRequest): Promise; + + /** + * Calls UpdateChannel. + * @param request UpdateChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateChannel(request: google.cloud.eventarc.v1.IUpdateChannelRequest, callback: google.cloud.eventarc.v1.Eventarc.UpdateChannelCallback): void; + + /** + * Calls UpdateChannel. + * @param request UpdateChannelRequest message or plain object + * @returns Promise + */ + public updateChannel(request: google.cloud.eventarc.v1.IUpdateChannelRequest): Promise; + + /** + * Calls DeleteChannel. + * @param request DeleteChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteChannel(request: google.cloud.eventarc.v1.IDeleteChannelRequest, callback: google.cloud.eventarc.v1.Eventarc.DeleteChannelCallback): void; + + /** + * Calls DeleteChannel. + * @param request DeleteChannelRequest message or plain object + * @returns Promise + */ + public deleteChannel(request: google.cloud.eventarc.v1.IDeleteChannelRequest): Promise; + + /** + * Calls GetChannelConnection. + * @param request GetChannelConnectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ChannelConnection + */ + public getChannelConnection(request: google.cloud.eventarc.v1.IGetChannelConnectionRequest, callback: google.cloud.eventarc.v1.Eventarc.GetChannelConnectionCallback): void; + + /** + * Calls GetChannelConnection. + * @param request GetChannelConnectionRequest message or plain object + * @returns Promise + */ + public getChannelConnection(request: google.cloud.eventarc.v1.IGetChannelConnectionRequest): Promise; + + /** + * Calls ListChannelConnections. + * @param request ListChannelConnectionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListChannelConnectionsResponse + */ + public listChannelConnections(request: google.cloud.eventarc.v1.IListChannelConnectionsRequest, callback: google.cloud.eventarc.v1.Eventarc.ListChannelConnectionsCallback): void; + + /** + * Calls ListChannelConnections. + * @param request ListChannelConnectionsRequest message or plain object + * @returns Promise + */ + public listChannelConnections(request: google.cloud.eventarc.v1.IListChannelConnectionsRequest): Promise; + + /** + * Calls CreateChannelConnection. + * @param request CreateChannelConnectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createChannelConnection(request: google.cloud.eventarc.v1.ICreateChannelConnectionRequest, callback: google.cloud.eventarc.v1.Eventarc.CreateChannelConnectionCallback): void; + + /** + * Calls CreateChannelConnection. + * @param request CreateChannelConnectionRequest message or plain object + * @returns Promise + */ + public createChannelConnection(request: google.cloud.eventarc.v1.ICreateChannelConnectionRequest): Promise; + + /** + * Calls DeleteChannelConnection. + * @param request DeleteChannelConnectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteChannelConnection(request: google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, callback: google.cloud.eventarc.v1.Eventarc.DeleteChannelConnectionCallback): void; + + /** + * Calls DeleteChannelConnection. + * @param request DeleteChannelConnectionRequest message or plain object + * @returns Promise + */ + public deleteChannelConnection(request: google.cloud.eventarc.v1.IDeleteChannelConnectionRequest): Promise; + } + + namespace Eventarc { + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#getTrigger}. + * @param error Error, if any + * @param [response] Trigger + */ + type GetTriggerCallback = (error: (Error|null), response?: google.cloud.eventarc.v1.Trigger) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#listTriggers}. + * @param error Error, if any + * @param [response] ListTriggersResponse + */ + type ListTriggersCallback = (error: (Error|null), response?: google.cloud.eventarc.v1.ListTriggersResponse) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#createTrigger}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateTriggerCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#updateTrigger}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateTriggerCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#deleteTrigger}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteTriggerCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#getChannel}. + * @param error Error, if any + * @param [response] Channel + */ + type GetChannelCallback = (error: (Error|null), response?: google.cloud.eventarc.v1.Channel) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#listChannels}. + * @param error Error, if any + * @param [response] ListChannelsResponse + */ + type ListChannelsCallback = (error: (Error|null), response?: google.cloud.eventarc.v1.ListChannelsResponse) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#createChannel}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateChannelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#updateChannel}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateChannelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#deleteChannel}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteChannelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#getChannelConnection}. + * @param error Error, if any + * @param [response] ChannelConnection + */ + type GetChannelConnectionCallback = (error: (Error|null), response?: google.cloud.eventarc.v1.ChannelConnection) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#listChannelConnections}. + * @param error Error, if any + * @param [response] ListChannelConnectionsResponse + */ + type ListChannelConnectionsCallback = (error: (Error|null), response?: google.cloud.eventarc.v1.ListChannelConnectionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#createChannelConnection}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateChannelConnectionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#deleteChannelConnection}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteChannelConnectionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a GetTriggerRequest. */ + interface IGetTriggerRequest { + + /** GetTriggerRequest name */ + name?: (string|null); + } + + /** Represents a GetTriggerRequest. */ + class GetTriggerRequest implements IGetTriggerRequest { + + /** + * Constructs a new GetTriggerRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IGetTriggerRequest); + + /** GetTriggerRequest name. */ + public name: string; + + /** + * Creates a new GetTriggerRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetTriggerRequest instance + */ + public static create(properties?: google.cloud.eventarc.v1.IGetTriggerRequest): google.cloud.eventarc.v1.GetTriggerRequest; + + /** + * Encodes the specified GetTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.GetTriggerRequest.verify|verify} messages. + * @param message GetTriggerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IGetTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GetTriggerRequest.verify|verify} messages. + * @param message GetTriggerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IGetTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetTriggerRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.GetTriggerRequest; + + /** + * Decodes a GetTriggerRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.GetTriggerRequest; + + /** + * Verifies a GetTriggerRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetTriggerRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.GetTriggerRequest; + + /** + * Creates a plain object from a GetTriggerRequest message. Also converts values to other types if specified. + * @param message GetTriggerRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.GetTriggerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetTriggerRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListTriggersRequest. */ + interface IListTriggersRequest { + + /** ListTriggersRequest parent */ + parent?: (string|null); + + /** ListTriggersRequest pageSize */ + pageSize?: (number|null); + + /** ListTriggersRequest pageToken */ + pageToken?: (string|null); + + /** ListTriggersRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListTriggersRequest. */ + class ListTriggersRequest implements IListTriggersRequest { + + /** + * Constructs a new ListTriggersRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IListTriggersRequest); + + /** ListTriggersRequest parent. */ + public parent: string; + + /** ListTriggersRequest pageSize. */ + public pageSize: number; + + /** ListTriggersRequest pageToken. */ + public pageToken: string; + + /** ListTriggersRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListTriggersRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListTriggersRequest instance + */ + public static create(properties?: google.cloud.eventarc.v1.IListTriggersRequest): google.cloud.eventarc.v1.ListTriggersRequest; + + /** + * Encodes the specified ListTriggersRequest message. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersRequest.verify|verify} messages. + * @param message ListTriggersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IListTriggersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListTriggersRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersRequest.verify|verify} messages. + * @param message ListTriggersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IListTriggersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListTriggersRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListTriggersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ListTriggersRequest; + + /** + * Decodes a ListTriggersRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListTriggersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ListTriggersRequest; + + /** + * Verifies a ListTriggersRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListTriggersRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListTriggersRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ListTriggersRequest; + + /** + * Creates a plain object from a ListTriggersRequest message. Also converts values to other types if specified. + * @param message ListTriggersRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.ListTriggersRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListTriggersRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListTriggersResponse. */ + interface IListTriggersResponse { + + /** ListTriggersResponse triggers */ + triggers?: (google.cloud.eventarc.v1.ITrigger[]|null); + + /** ListTriggersResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListTriggersResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListTriggersResponse. */ + class ListTriggersResponse implements IListTriggersResponse { + + /** + * Constructs a new ListTriggersResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IListTriggersResponse); + + /** ListTriggersResponse triggers. */ + public triggers: google.cloud.eventarc.v1.ITrigger[]; + + /** ListTriggersResponse nextPageToken. */ + public nextPageToken: string; + + /** ListTriggersResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListTriggersResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListTriggersResponse instance + */ + public static create(properties?: google.cloud.eventarc.v1.IListTriggersResponse): google.cloud.eventarc.v1.ListTriggersResponse; + + /** + * Encodes the specified ListTriggersResponse message. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersResponse.verify|verify} messages. + * @param message ListTriggersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IListTriggersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListTriggersResponse message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersResponse.verify|verify} messages. + * @param message ListTriggersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IListTriggersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListTriggersResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListTriggersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ListTriggersResponse; + + /** + * Decodes a ListTriggersResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListTriggersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ListTriggersResponse; + + /** + * Verifies a ListTriggersResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListTriggersResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListTriggersResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ListTriggersResponse; + + /** + * Creates a plain object from a ListTriggersResponse message. Also converts values to other types if specified. + * @param message ListTriggersResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.ListTriggersResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListTriggersResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateTriggerRequest. */ + interface ICreateTriggerRequest { + + /** CreateTriggerRequest parent */ + parent?: (string|null); + + /** CreateTriggerRequest trigger */ + trigger?: (google.cloud.eventarc.v1.ITrigger|null); + + /** CreateTriggerRequest triggerId */ + triggerId?: (string|null); + + /** CreateTriggerRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a CreateTriggerRequest. */ + class CreateTriggerRequest implements ICreateTriggerRequest { + + /** + * Constructs a new CreateTriggerRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.ICreateTriggerRequest); + + /** CreateTriggerRequest parent. */ + public parent: string; + + /** CreateTriggerRequest trigger. */ + public trigger?: (google.cloud.eventarc.v1.ITrigger|null); + + /** CreateTriggerRequest triggerId. */ + public triggerId: string; + + /** CreateTriggerRequest validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new CreateTriggerRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateTriggerRequest instance + */ + public static create(properties?: google.cloud.eventarc.v1.ICreateTriggerRequest): google.cloud.eventarc.v1.CreateTriggerRequest; + + /** + * Encodes the specified CreateTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.CreateTriggerRequest.verify|verify} messages. + * @param message CreateTriggerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.ICreateTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.CreateTriggerRequest.verify|verify} messages. + * @param message CreateTriggerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.ICreateTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateTriggerRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.CreateTriggerRequest; + + /** + * Decodes a CreateTriggerRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.CreateTriggerRequest; + + /** + * Verifies a CreateTriggerRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateTriggerRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.CreateTriggerRequest; + + /** + * Creates a plain object from a CreateTriggerRequest message. Also converts values to other types if specified. + * @param message CreateTriggerRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.CreateTriggerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateTriggerRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateTriggerRequest. */ + interface IUpdateTriggerRequest { + + /** UpdateTriggerRequest trigger */ + trigger?: (google.cloud.eventarc.v1.ITrigger|null); + + /** UpdateTriggerRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateTriggerRequest allowMissing */ + allowMissing?: (boolean|null); + + /** UpdateTriggerRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents an UpdateTriggerRequest. */ + class UpdateTriggerRequest implements IUpdateTriggerRequest { + + /** + * Constructs a new UpdateTriggerRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IUpdateTriggerRequest); + + /** UpdateTriggerRequest trigger. */ + public trigger?: (google.cloud.eventarc.v1.ITrigger|null); + + /** UpdateTriggerRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateTriggerRequest allowMissing. */ + public allowMissing: boolean; + + /** UpdateTriggerRequest validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new UpdateTriggerRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateTriggerRequest instance + */ + public static create(properties?: google.cloud.eventarc.v1.IUpdateTriggerRequest): google.cloud.eventarc.v1.UpdateTriggerRequest; + + /** + * Encodes the specified UpdateTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.UpdateTriggerRequest.verify|verify} messages. + * @param message UpdateTriggerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IUpdateTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.UpdateTriggerRequest.verify|verify} messages. + * @param message UpdateTriggerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IUpdateTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateTriggerRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.UpdateTriggerRequest; + + /** + * Decodes an UpdateTriggerRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.UpdateTriggerRequest; + + /** + * Verifies an UpdateTriggerRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateTriggerRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.UpdateTriggerRequest; + + /** + * Creates a plain object from an UpdateTriggerRequest message. Also converts values to other types if specified. + * @param message UpdateTriggerRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.UpdateTriggerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateTriggerRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteTriggerRequest. */ + interface IDeleteTriggerRequest { + + /** DeleteTriggerRequest name */ + name?: (string|null); + + /** DeleteTriggerRequest etag */ + etag?: (string|null); + + /** DeleteTriggerRequest allowMissing */ + allowMissing?: (boolean|null); + + /** DeleteTriggerRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a DeleteTriggerRequest. */ + class DeleteTriggerRequest implements IDeleteTriggerRequest { + + /** + * Constructs a new DeleteTriggerRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IDeleteTriggerRequest); + + /** DeleteTriggerRequest name. */ + public name: string; + + /** DeleteTriggerRequest etag. */ + public etag: string; + + /** DeleteTriggerRequest allowMissing. */ + public allowMissing: boolean; + + /** DeleteTriggerRequest validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new DeleteTriggerRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteTriggerRequest instance + */ + public static create(properties?: google.cloud.eventarc.v1.IDeleteTriggerRequest): google.cloud.eventarc.v1.DeleteTriggerRequest; + + /** + * Encodes the specified DeleteTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.DeleteTriggerRequest.verify|verify} messages. + * @param message DeleteTriggerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IDeleteTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.DeleteTriggerRequest.verify|verify} messages. + * @param message DeleteTriggerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IDeleteTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteTriggerRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.DeleteTriggerRequest; + + /** + * Decodes a DeleteTriggerRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.DeleteTriggerRequest; + + /** + * Verifies a DeleteTriggerRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteTriggerRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.DeleteTriggerRequest; + + /** + * Creates a plain object from a DeleteTriggerRequest message. Also converts values to other types if specified. + * @param message DeleteTriggerRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.DeleteTriggerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteTriggerRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetChannelRequest. */ + interface IGetChannelRequest { + + /** GetChannelRequest name */ + name?: (string|null); + } + + /** Represents a GetChannelRequest. */ + class GetChannelRequest implements IGetChannelRequest { + + /** + * Constructs a new GetChannelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IGetChannelRequest); + + /** GetChannelRequest name. */ + public name: string; + + /** + * Creates a new GetChannelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetChannelRequest instance + */ + public static create(properties?: google.cloud.eventarc.v1.IGetChannelRequest): google.cloud.eventarc.v1.GetChannelRequest; + + /** + * Encodes the specified GetChannelRequest message. Does not implicitly {@link google.cloud.eventarc.v1.GetChannelRequest.verify|verify} messages. + * @param message GetChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IGetChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetChannelRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GetChannelRequest.verify|verify} messages. + * @param message GetChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IGetChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetChannelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.GetChannelRequest; + + /** + * Decodes a GetChannelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.GetChannelRequest; + + /** + * Verifies a GetChannelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetChannelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetChannelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.GetChannelRequest; + + /** + * Creates a plain object from a GetChannelRequest message. Also converts values to other types if specified. + * @param message GetChannelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.GetChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetChannelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListChannelsRequest. */ + interface IListChannelsRequest { + + /** ListChannelsRequest parent */ + parent?: (string|null); + + /** ListChannelsRequest pageSize */ + pageSize?: (number|null); + + /** ListChannelsRequest pageToken */ + pageToken?: (string|null); + + /** ListChannelsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListChannelsRequest. */ + class ListChannelsRequest implements IListChannelsRequest { + + /** + * Constructs a new ListChannelsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IListChannelsRequest); + + /** ListChannelsRequest parent. */ + public parent: string; + + /** ListChannelsRequest pageSize. */ + public pageSize: number; + + /** ListChannelsRequest pageToken. */ + public pageToken: string; + + /** ListChannelsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListChannelsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListChannelsRequest instance + */ + public static create(properties?: google.cloud.eventarc.v1.IListChannelsRequest): google.cloud.eventarc.v1.ListChannelsRequest; + + /** + * Encodes the specified ListChannelsRequest message. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelsRequest.verify|verify} messages. + * @param message ListChannelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IListChannelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListChannelsRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelsRequest.verify|verify} messages. + * @param message ListChannelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IListChannelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListChannelsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ListChannelsRequest; + + /** + * Decodes a ListChannelsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ListChannelsRequest; + + /** + * Verifies a ListChannelsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListChannelsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListChannelsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ListChannelsRequest; + + /** + * Creates a plain object from a ListChannelsRequest message. Also converts values to other types if specified. + * @param message ListChannelsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.ListChannelsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListChannelsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListChannelsResponse. */ + interface IListChannelsResponse { + + /** ListChannelsResponse channels */ + channels?: (google.cloud.eventarc.v1.IChannel[]|null); + + /** ListChannelsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListChannelsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListChannelsResponse. */ + class ListChannelsResponse implements IListChannelsResponse { + + /** + * Constructs a new ListChannelsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IListChannelsResponse); + + /** ListChannelsResponse channels. */ + public channels: google.cloud.eventarc.v1.IChannel[]; + + /** ListChannelsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListChannelsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListChannelsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListChannelsResponse instance + */ + public static create(properties?: google.cloud.eventarc.v1.IListChannelsResponse): google.cloud.eventarc.v1.ListChannelsResponse; + + /** + * Encodes the specified ListChannelsResponse message. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelsResponse.verify|verify} messages. + * @param message ListChannelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IListChannelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListChannelsResponse message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelsResponse.verify|verify} messages. + * @param message ListChannelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IListChannelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListChannelsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ListChannelsResponse; + + /** + * Decodes a ListChannelsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ListChannelsResponse; + + /** + * Verifies a ListChannelsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListChannelsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListChannelsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ListChannelsResponse; + + /** + * Creates a plain object from a ListChannelsResponse message. Also converts values to other types if specified. + * @param message ListChannelsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.ListChannelsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListChannelsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateChannelRequest. */ + interface ICreateChannelRequest { + + /** CreateChannelRequest parent */ + parent?: (string|null); + + /** CreateChannelRequest channel */ + channel?: (google.cloud.eventarc.v1.IChannel|null); + + /** CreateChannelRequest channelId */ + channelId?: (string|null); + + /** CreateChannelRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a CreateChannelRequest. */ + class CreateChannelRequest implements ICreateChannelRequest { + + /** + * Constructs a new CreateChannelRequest. + * @param [properties] Properties to set */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + constructor(properties?: google.cloud.eventarc.v1.ICreateChannelRequest); + + /** CreateChannelRequest parent. */ + public parent: string; + + /** CreateChannelRequest channel. */ + public channel?: (google.cloud.eventarc.v1.IChannel|null); + + /** CreateChannelRequest channelId. */ + public channelId: string; + + /** CreateChannelRequest validateOnly. */ + public validateOnly: boolean; /** - * Creates new Eventarc service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. + * Creates a new CreateChannelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateChannelRequest instance */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Eventarc; + public static create(properties?: google.cloud.eventarc.v1.ICreateChannelRequest): google.cloud.eventarc.v1.CreateChannelRequest; /** - * Calls GetTrigger. - * @param request GetTriggerRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Trigger + * Encodes the specified CreateChannelRequest message. Does not implicitly {@link google.cloud.eventarc.v1.CreateChannelRequest.verify|verify} messages. + * @param message CreateChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public getTrigger(request: google.cloud.eventarc.v1.IGetTriggerRequest, callback: google.cloud.eventarc.v1.Eventarc.GetTriggerCallback): void; + public static encode(message: google.cloud.eventarc.v1.ICreateChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls GetTrigger. - * @param request GetTriggerRequest message or plain object - * @returns Promise + * Encodes the specified CreateChannelRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.CreateChannelRequest.verify|verify} messages. + * @param message CreateChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public getTrigger(request: google.cloud.eventarc.v1.IGetTriggerRequest): Promise; + public static encodeDelimited(message: google.cloud.eventarc.v1.ICreateChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls ListTriggers. - * @param request ListTriggersRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListTriggersResponse + * Decodes a CreateChannelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public listTriggers(request: google.cloud.eventarc.v1.IListTriggersRequest, callback: google.cloud.eventarc.v1.Eventarc.ListTriggersCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.CreateChannelRequest; /** - * Calls ListTriggers. - * @param request ListTriggersRequest message or plain object - * @returns Promise + * Decodes a CreateChannelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public listTriggers(request: google.cloud.eventarc.v1.IListTriggersRequest): Promise; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.CreateChannelRequest; /** - * Calls CreateTrigger. - * @param request CreateTriggerRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Verifies a CreateChannelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - public createTrigger(request: google.cloud.eventarc.v1.ICreateTriggerRequest, callback: google.cloud.eventarc.v1.Eventarc.CreateTriggerCallback): void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Calls CreateTrigger. - * @param request CreateTriggerRequest message or plain object - * @returns Promise + * Creates a CreateChannelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateChannelRequest */ - public createTrigger(request: google.cloud.eventarc.v1.ICreateTriggerRequest): Promise; + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.CreateChannelRequest; /** - * Calls UpdateTrigger. - * @param request UpdateTriggerRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Creates a plain object from a CreateChannelRequest message. Also converts values to other types if specified. + * @param message CreateChannelRequest + * @param [options] Conversion options + * @returns Plain object */ - public updateTrigger(request: google.cloud.eventarc.v1.IUpdateTriggerRequest, callback: google.cloud.eventarc.v1.Eventarc.UpdateTriggerCallback): void; + public static toObject(message: google.cloud.eventarc.v1.CreateChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Calls UpdateTrigger. - * @param request UpdateTriggerRequest message or plain object - * @returns Promise + * Converts this CreateChannelRequest to JSON. + * @returns JSON object */ - public updateTrigger(request: google.cloud.eventarc.v1.IUpdateTriggerRequest): Promise; + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateChannelRequest. */ + interface IUpdateChannelRequest { + + /** UpdateChannelRequest channel */ + channel?: (google.cloud.eventarc.v1.IChannel|null); + + /** UpdateChannelRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateChannelRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents an UpdateChannelRequest. */ + class UpdateChannelRequest implements IUpdateChannelRequest { /** - * Calls DeleteTrigger. - * @param request DeleteTriggerRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Constructs a new UpdateChannelRequest. + * @param [properties] Properties to set */ - public deleteTrigger(request: google.cloud.eventarc.v1.IDeleteTriggerRequest, callback: google.cloud.eventarc.v1.Eventarc.DeleteTriggerCallback): void; + constructor(properties?: google.cloud.eventarc.v1.IUpdateChannelRequest); + + /** UpdateChannelRequest channel. */ + public channel?: (google.cloud.eventarc.v1.IChannel|null); + + /** UpdateChannelRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateChannelRequest validateOnly. */ + public validateOnly: boolean; /** - * Calls DeleteTrigger. - * @param request DeleteTriggerRequest message or plain object - * @returns Promise + * Creates a new UpdateChannelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateChannelRequest instance */ - public deleteTrigger(request: google.cloud.eventarc.v1.IDeleteTriggerRequest): Promise; - } + public static create(properties?: google.cloud.eventarc.v1.IUpdateChannelRequest): google.cloud.eventarc.v1.UpdateChannelRequest; - namespace Eventarc { + /** + * Encodes the specified UpdateChannelRequest message. Does not implicitly {@link google.cloud.eventarc.v1.UpdateChannelRequest.verify|verify} messages. + * @param message UpdateChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IUpdateChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#getTrigger}. - * @param error Error, if any - * @param [response] Trigger + * Encodes the specified UpdateChannelRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.UpdateChannelRequest.verify|verify} messages. + * @param message UpdateChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - type GetTriggerCallback = (error: (Error|null), response?: google.cloud.eventarc.v1.Trigger) => void; + public static encodeDelimited(message: google.cloud.eventarc.v1.IUpdateChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#listTriggers}. - * @param error Error, if any - * @param [response] ListTriggersResponse + * Decodes an UpdateChannelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type ListTriggersCallback = (error: (Error|null), response?: google.cloud.eventarc.v1.ListTriggersResponse) => void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.UpdateChannelRequest; /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#createTrigger}. - * @param error Error, if any - * @param [response] Operation + * Decodes an UpdateChannelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - type CreateTriggerCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.UpdateChannelRequest; /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#updateTrigger}. - * @param error Error, if any - * @param [response] Operation + * Verifies an UpdateChannelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type UpdateTriggerCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#deleteTrigger}. - * @param error Error, if any - * @param [response] Operation + * Creates an UpdateChannelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateChannelRequest */ - type DeleteTriggerCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.UpdateChannelRequest; + + /** + * Creates a plain object from an UpdateChannelRequest message. Also converts values to other types if specified. + * @param message UpdateChannelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.UpdateChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateChannelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Properties of a GetTriggerRequest. */ - interface IGetTriggerRequest { + /** Properties of a DeleteChannelRequest. */ + interface IDeleteChannelRequest { - /** GetTriggerRequest name */ + /** DeleteChannelRequest name */ name?: (string|null); + + /** DeleteChannelRequest validateOnly */ + validateOnly?: (boolean|null); } - /** Represents a GetTriggerRequest. */ - class GetTriggerRequest implements IGetTriggerRequest { + /** Represents a DeleteChannelRequest. */ + class DeleteChannelRequest implements IDeleteChannelRequest { /** - * Constructs a new GetTriggerRequest. + * Constructs a new DeleteChannelRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.eventarc.v1.IGetTriggerRequest); + constructor(properties?: google.cloud.eventarc.v1.IDeleteChannelRequest); - /** GetTriggerRequest name. */ + /** DeleteChannelRequest name. */ public name: string; + /** DeleteChannelRequest validateOnly. */ + public validateOnly: boolean; + /** - * Creates a new GetTriggerRequest instance using the specified properties. + * Creates a new DeleteChannelRequest instance using the specified properties. * @param [properties] Properties to set - * @returns GetTriggerRequest instance + * @returns DeleteChannelRequest instance */ - public static create(properties?: google.cloud.eventarc.v1.IGetTriggerRequest): google.cloud.eventarc.v1.GetTriggerRequest; + public static create(properties?: google.cloud.eventarc.v1.IDeleteChannelRequest): google.cloud.eventarc.v1.DeleteChannelRequest; /** - * Encodes the specified GetTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.GetTriggerRequest.verify|verify} messages. - * @param message GetTriggerRequest message or plain object to encode + * Encodes the specified DeleteChannelRequest message. Does not implicitly {@link google.cloud.eventarc.v1.DeleteChannelRequest.verify|verify} messages. + * @param message DeleteChannelRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.eventarc.v1.IGetTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.eventarc.v1.IDeleteChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GetTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GetTriggerRequest.verify|verify} messages. - * @param message GetTriggerRequest message or plain object to encode + * Encodes the specified DeleteChannelRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.DeleteChannelRequest.verify|verify} messages. + * @param message DeleteChannelRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.eventarc.v1.IGetTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.eventarc.v1.IDeleteChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GetTriggerRequest message from the specified reader or buffer. + * Decodes a DeleteChannelRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GetTriggerRequest + * @returns DeleteChannelRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.GetTriggerRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.DeleteChannelRequest; /** - * Decodes a GetTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteChannelRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GetTriggerRequest + * @returns DeleteChannelRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.GetTriggerRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.DeleteChannelRequest; /** - * Verifies a GetTriggerRequest message. + * Verifies a DeleteChannelRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a GetTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteChannelRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GetTriggerRequest + * @returns DeleteChannelRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.GetTriggerRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.DeleteChannelRequest; /** - * Creates a plain object from a GetTriggerRequest message. Also converts values to other types if specified. - * @param message GetTriggerRequest + * Creates a plain object from a DeleteChannelRequest message. Also converts values to other types if specified. + * @param message DeleteChannelRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.eventarc.v1.GetTriggerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.eventarc.v1.DeleteChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GetTriggerRequest to JSON. + * Converts this DeleteChannelRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListTriggersRequest. */ - interface IListTriggersRequest { - - /** ListTriggersRequest parent */ - parent?: (string|null); - - /** ListTriggersRequest pageSize */ - pageSize?: (number|null); - - /** ListTriggersRequest pageToken */ - pageToken?: (string|null); + /** Properties of a GetChannelConnectionRequest. */ + interface IGetChannelConnectionRequest { - /** ListTriggersRequest orderBy */ - orderBy?: (string|null); + /** GetChannelConnectionRequest name */ + name?: (string|null); } - /** Represents a ListTriggersRequest. */ - class ListTriggersRequest implements IListTriggersRequest { + /** Represents a GetChannelConnectionRequest. */ + class GetChannelConnectionRequest implements IGetChannelConnectionRequest { /** - * Constructs a new ListTriggersRequest. + * Constructs a new GetChannelConnectionRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.eventarc.v1.IListTriggersRequest); - - /** ListTriggersRequest parent. */ - public parent: string; - - /** ListTriggersRequest pageSize. */ - public pageSize: number; - - /** ListTriggersRequest pageToken. */ - public pageToken: string; + constructor(properties?: google.cloud.eventarc.v1.IGetChannelConnectionRequest); - /** ListTriggersRequest orderBy. */ - public orderBy: string; + /** GetChannelConnectionRequest name. */ + public name: string; /** - * Creates a new ListTriggersRequest instance using the specified properties. + * Creates a new GetChannelConnectionRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ListTriggersRequest instance + * @returns GetChannelConnectionRequest instance */ - public static create(properties?: google.cloud.eventarc.v1.IListTriggersRequest): google.cloud.eventarc.v1.ListTriggersRequest; + public static create(properties?: google.cloud.eventarc.v1.IGetChannelConnectionRequest): google.cloud.eventarc.v1.GetChannelConnectionRequest; /** - * Encodes the specified ListTriggersRequest message. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersRequest.verify|verify} messages. - * @param message ListTriggersRequest message or plain object to encode + * Encodes the specified GetChannelConnectionRequest message. Does not implicitly {@link google.cloud.eventarc.v1.GetChannelConnectionRequest.verify|verify} messages. + * @param message GetChannelConnectionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.eventarc.v1.IListTriggersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.eventarc.v1.IGetChannelConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListTriggersRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersRequest.verify|verify} messages. - * @param message ListTriggersRequest message or plain object to encode + * Encodes the specified GetChannelConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GetChannelConnectionRequest.verify|verify} messages. + * @param message GetChannelConnectionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.eventarc.v1.IListTriggersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.eventarc.v1.IGetChannelConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListTriggersRequest message from the specified reader or buffer. + * Decodes a GetChannelConnectionRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListTriggersRequest + * @returns GetChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ListTriggersRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.GetChannelConnectionRequest; /** - * Decodes a ListTriggersRequest message from the specified reader or buffer, length delimited. + * Decodes a GetChannelConnectionRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListTriggersRequest + * @returns GetChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ListTriggersRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.GetChannelConnectionRequest; /** - * Verifies a ListTriggersRequest message. + * Verifies a GetChannelConnectionRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListTriggersRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetChannelConnectionRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListTriggersRequest + * @returns GetChannelConnectionRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ListTriggersRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.GetChannelConnectionRequest; /** - * Creates a plain object from a ListTriggersRequest message. Also converts values to other types if specified. - * @param message ListTriggersRequest + * Creates a plain object from a GetChannelConnectionRequest message. Also converts values to other types if specified. + * @param message GetChannelConnectionRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.eventarc.v1.ListTriggersRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.eventarc.v1.GetChannelConnectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListTriggersRequest to JSON. + * Converts this GetChannelConnectionRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ListTriggersResponse. */ - interface IListTriggersResponse { + /** Properties of a ListChannelConnectionsRequest. */ + interface IListChannelConnectionsRequest { - /** ListTriggersResponse triggers */ - triggers?: (google.cloud.eventarc.v1.ITrigger[]|null); + /** ListChannelConnectionsRequest parent */ + parent?: (string|null); - /** ListTriggersResponse nextPageToken */ - nextPageToken?: (string|null); + /** ListChannelConnectionsRequest pageSize */ + pageSize?: (number|null); - /** ListTriggersResponse unreachable */ - unreachable?: (string[]|null); + /** ListChannelConnectionsRequest pageToken */ + pageToken?: (string|null); } - /** Represents a ListTriggersResponse. */ - class ListTriggersResponse implements IListTriggersResponse { + /** Represents a ListChannelConnectionsRequest. */ + class ListChannelConnectionsRequest implements IListChannelConnectionsRequest { /** - * Constructs a new ListTriggersResponse. + * Constructs a new ListChannelConnectionsRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.eventarc.v1.IListTriggersResponse); + constructor(properties?: google.cloud.eventarc.v1.IListChannelConnectionsRequest); - /** ListTriggersResponse triggers. */ - public triggers: google.cloud.eventarc.v1.ITrigger[]; + /** ListChannelConnectionsRequest parent. */ + public parent: string; - /** ListTriggersResponse nextPageToken. */ - public nextPageToken: string; + /** ListChannelConnectionsRequest pageSize. */ + public pageSize: number; - /** ListTriggersResponse unreachable. */ - public unreachable: string[]; + /** ListChannelConnectionsRequest pageToken. */ + public pageToken: string; /** - * Creates a new ListTriggersResponse instance using the specified properties. + * Creates a new ListChannelConnectionsRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ListTriggersResponse instance + * @returns ListChannelConnectionsRequest instance */ - public static create(properties?: google.cloud.eventarc.v1.IListTriggersResponse): google.cloud.eventarc.v1.ListTriggersResponse; + public static create(properties?: google.cloud.eventarc.v1.IListChannelConnectionsRequest): google.cloud.eventarc.v1.ListChannelConnectionsRequest; /** - * Encodes the specified ListTriggersResponse message. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersResponse.verify|verify} messages. - * @param message ListTriggersResponse message or plain object to encode + * Encodes the specified ListChannelConnectionsRequest message. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelConnectionsRequest.verify|verify} messages. + * @param message ListChannelConnectionsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.eventarc.v1.IListTriggersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.eventarc.v1.IListChannelConnectionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ListTriggersResponse message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersResponse.verify|verify} messages. - * @param message ListTriggersResponse message or plain object to encode + * Encodes the specified ListChannelConnectionsRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelConnectionsRequest.verify|verify} messages. + * @param message ListChannelConnectionsRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.eventarc.v1.IListTriggersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.eventarc.v1.IListChannelConnectionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ListTriggersResponse message from the specified reader or buffer. + * Decodes a ListChannelConnectionsRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ListTriggersResponse + * @returns ListChannelConnectionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ListTriggersResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ListChannelConnectionsRequest; /** - * Decodes a ListTriggersResponse message from the specified reader or buffer, length delimited. + * Decodes a ListChannelConnectionsRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ListTriggersResponse + * @returns ListChannelConnectionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ListTriggersResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ListChannelConnectionsRequest; /** - * Verifies a ListTriggersResponse message. + * Verifies a ListChannelConnectionsRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ListTriggersResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListChannelConnectionsRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ListTriggersResponse + * @returns ListChannelConnectionsRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ListTriggersResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ListChannelConnectionsRequest; /** - * Creates a plain object from a ListTriggersResponse message. Also converts values to other types if specified. - * @param message ListTriggersResponse + * Creates a plain object from a ListChannelConnectionsRequest message. Also converts values to other types if specified. + * @param message ListChannelConnectionsRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.eventarc.v1.ListTriggersResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.eventarc.v1.ListChannelConnectionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ListTriggersResponse to JSON. + * Converts this ListChannelConnectionsRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CreateTriggerRequest. */ - interface ICreateTriggerRequest { - - /** CreateTriggerRequest parent */ - parent?: (string|null); + /** Properties of a ListChannelConnectionsResponse. */ + interface IListChannelConnectionsResponse { - /** CreateTriggerRequest trigger */ - trigger?: (google.cloud.eventarc.v1.ITrigger|null); + /** ListChannelConnectionsResponse channelConnections */ + channelConnections?: (google.cloud.eventarc.v1.IChannelConnection[]|null); - /** CreateTriggerRequest triggerId */ - triggerId?: (string|null); + /** ListChannelConnectionsResponse nextPageToken */ + nextPageToken?: (string|null); - /** CreateTriggerRequest validateOnly */ - validateOnly?: (boolean|null); + /** ListChannelConnectionsResponse unreachable */ + unreachable?: (string[]|null); } - /** Represents a CreateTriggerRequest. */ - class CreateTriggerRequest implements ICreateTriggerRequest { + /** Represents a ListChannelConnectionsResponse. */ + class ListChannelConnectionsResponse implements IListChannelConnectionsResponse { /** - * Constructs a new CreateTriggerRequest. + * Constructs a new ListChannelConnectionsResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.eventarc.v1.ICreateTriggerRequest); - - /** CreateTriggerRequest parent. */ - public parent: string; + constructor(properties?: google.cloud.eventarc.v1.IListChannelConnectionsResponse); - /** CreateTriggerRequest trigger. */ - public trigger?: (google.cloud.eventarc.v1.ITrigger|null); + /** ListChannelConnectionsResponse channelConnections. */ + public channelConnections: google.cloud.eventarc.v1.IChannelConnection[]; - /** CreateTriggerRequest triggerId. */ - public triggerId: string; + /** ListChannelConnectionsResponse nextPageToken. */ + public nextPageToken: string; - /** CreateTriggerRequest validateOnly. */ - public validateOnly: boolean; + /** ListChannelConnectionsResponse unreachable. */ + public unreachable: string[]; /** - * Creates a new CreateTriggerRequest instance using the specified properties. + * Creates a new ListChannelConnectionsResponse instance using the specified properties. * @param [properties] Properties to set - * @returns CreateTriggerRequest instance + * @returns ListChannelConnectionsResponse instance */ - public static create(properties?: google.cloud.eventarc.v1.ICreateTriggerRequest): google.cloud.eventarc.v1.CreateTriggerRequest; + public static create(properties?: google.cloud.eventarc.v1.IListChannelConnectionsResponse): google.cloud.eventarc.v1.ListChannelConnectionsResponse; /** - * Encodes the specified CreateTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.CreateTriggerRequest.verify|verify} messages. - * @param message CreateTriggerRequest message or plain object to encode + * Encodes the specified ListChannelConnectionsResponse message. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelConnectionsResponse.verify|verify} messages. + * @param message ListChannelConnectionsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.eventarc.v1.ICreateTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.eventarc.v1.IListChannelConnectionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CreateTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.CreateTriggerRequest.verify|verify} messages. - * @param message CreateTriggerRequest message or plain object to encode + * Encodes the specified ListChannelConnectionsResponse message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelConnectionsResponse.verify|verify} messages. + * @param message ListChannelConnectionsResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.eventarc.v1.ICreateTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.eventarc.v1.IListChannelConnectionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CreateTriggerRequest message from the specified reader or buffer. + * Decodes a ListChannelConnectionsResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CreateTriggerRequest + * @returns ListChannelConnectionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.CreateTriggerRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.ListChannelConnectionsResponse; /** - * Decodes a CreateTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a ListChannelConnectionsResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CreateTriggerRequest + * @returns ListChannelConnectionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.CreateTriggerRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.ListChannelConnectionsResponse; /** - * Verifies a CreateTriggerRequest message. + * Verifies a ListChannelConnectionsResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a CreateTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListChannelConnectionsResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CreateTriggerRequest + * @returns ListChannelConnectionsResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.CreateTriggerRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.ListChannelConnectionsResponse; /** - * Creates a plain object from a CreateTriggerRequest message. Also converts values to other types if specified. - * @param message CreateTriggerRequest + * Creates a plain object from a ListChannelConnectionsResponse message. Also converts values to other types if specified. + * @param message ListChannelConnectionsResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.eventarc.v1.CreateTriggerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.eventarc.v1.ListChannelConnectionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CreateTriggerRequest to JSON. + * Converts this ListChannelConnectionsResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an UpdateTriggerRequest. */ - interface IUpdateTriggerRequest { - - /** UpdateTriggerRequest trigger */ - trigger?: (google.cloud.eventarc.v1.ITrigger|null); + /** Properties of a CreateChannelConnectionRequest. */ + interface ICreateChannelConnectionRequest { - /** UpdateTriggerRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); + /** CreateChannelConnectionRequest parent */ + parent?: (string|null); - /** UpdateTriggerRequest allowMissing */ - allowMissing?: (boolean|null); + /** CreateChannelConnectionRequest channelConnection */ + channelConnection?: (google.cloud.eventarc.v1.IChannelConnection|null); - /** UpdateTriggerRequest validateOnly */ - validateOnly?: (boolean|null); + /** CreateChannelConnectionRequest channelConnectionId */ + channelConnectionId?: (string|null); } - /** Represents an UpdateTriggerRequest. */ - class UpdateTriggerRequest implements IUpdateTriggerRequest { + /** Represents a CreateChannelConnectionRequest. */ + class CreateChannelConnectionRequest implements ICreateChannelConnectionRequest { /** - * Constructs a new UpdateTriggerRequest. + * Constructs a new CreateChannelConnectionRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.eventarc.v1.IUpdateTriggerRequest); - - /** UpdateTriggerRequest trigger. */ - public trigger?: (google.cloud.eventarc.v1.ITrigger|null); + constructor(properties?: google.cloud.eventarc.v1.ICreateChannelConnectionRequest); - /** UpdateTriggerRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); + /** CreateChannelConnectionRequest parent. */ + public parent: string; - /** UpdateTriggerRequest allowMissing. */ - public allowMissing: boolean; + /** CreateChannelConnectionRequest channelConnection. */ + public channelConnection?: (google.cloud.eventarc.v1.IChannelConnection|null); - /** UpdateTriggerRequest validateOnly. */ - public validateOnly: boolean; + /** CreateChannelConnectionRequest channelConnectionId. */ + public channelConnectionId: string; /** - * Creates a new UpdateTriggerRequest instance using the specified properties. + * Creates a new CreateChannelConnectionRequest instance using the specified properties. * @param [properties] Properties to set - * @returns UpdateTriggerRequest instance + * @returns CreateChannelConnectionRequest instance */ - public static create(properties?: google.cloud.eventarc.v1.IUpdateTriggerRequest): google.cloud.eventarc.v1.UpdateTriggerRequest; + public static create(properties?: google.cloud.eventarc.v1.ICreateChannelConnectionRequest): google.cloud.eventarc.v1.CreateChannelConnectionRequest; /** - * Encodes the specified UpdateTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.UpdateTriggerRequest.verify|verify} messages. - * @param message UpdateTriggerRequest message or plain object to encode + * Encodes the specified CreateChannelConnectionRequest message. Does not implicitly {@link google.cloud.eventarc.v1.CreateChannelConnectionRequest.verify|verify} messages. + * @param message CreateChannelConnectionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.eventarc.v1.IUpdateTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.eventarc.v1.ICreateChannelConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified UpdateTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.UpdateTriggerRequest.verify|verify} messages. - * @param message UpdateTriggerRequest message or plain object to encode + * Encodes the specified CreateChannelConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.CreateChannelConnectionRequest.verify|verify} messages. + * @param message CreateChannelConnectionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.eventarc.v1.IUpdateTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.eventarc.v1.ICreateChannelConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an UpdateTriggerRequest message from the specified reader or buffer. + * Decodes a CreateChannelConnectionRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns UpdateTriggerRequest + * @returns CreateChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.UpdateTriggerRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.CreateChannelConnectionRequest; /** - * Decodes an UpdateTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateChannelConnectionRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns UpdateTriggerRequest + * @returns CreateChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.UpdateTriggerRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.CreateChannelConnectionRequest; /** - * Verifies an UpdateTriggerRequest message. + * Verifies a CreateChannelConnectionRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an UpdateTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateChannelConnectionRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns UpdateTriggerRequest + * @returns CreateChannelConnectionRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.UpdateTriggerRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.CreateChannelConnectionRequest; /** - * Creates a plain object from an UpdateTriggerRequest message. Also converts values to other types if specified. - * @param message UpdateTriggerRequest + * Creates a plain object from a CreateChannelConnectionRequest message. Also converts values to other types if specified. + * @param message CreateChannelConnectionRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.eventarc.v1.UpdateTriggerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.eventarc.v1.CreateChannelConnectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this UpdateTriggerRequest to JSON. + * Converts this CreateChannelConnectionRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DeleteTriggerRequest. */ - interface IDeleteTriggerRequest { + /** Properties of a DeleteChannelConnectionRequest. */ + interface IDeleteChannelConnectionRequest { - /** DeleteTriggerRequest name */ + /** DeleteChannelConnectionRequest name */ name?: (string|null); - - /** DeleteTriggerRequest etag */ - etag?: (string|null); - - /** DeleteTriggerRequest allowMissing */ - allowMissing?: (boolean|null); - - /** DeleteTriggerRequest validateOnly */ - validateOnly?: (boolean|null); } - /** Represents a DeleteTriggerRequest. */ - class DeleteTriggerRequest implements IDeleteTriggerRequest { + /** Represents a DeleteChannelConnectionRequest. */ + class DeleteChannelConnectionRequest implements IDeleteChannelConnectionRequest { /** - * Constructs a new DeleteTriggerRequest. + * Constructs a new DeleteChannelConnectionRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.eventarc.v1.IDeleteTriggerRequest); + constructor(properties?: google.cloud.eventarc.v1.IDeleteChannelConnectionRequest); - /** DeleteTriggerRequest name. */ + /** DeleteChannelConnectionRequest name. */ public name: string; - /** DeleteTriggerRequest etag. */ - public etag: string; - - /** DeleteTriggerRequest allowMissing. */ - public allowMissing: boolean; - - /** DeleteTriggerRequest validateOnly. */ - public validateOnly: boolean; - /** - * Creates a new DeleteTriggerRequest instance using the specified properties. + * Creates a new DeleteChannelConnectionRequest instance using the specified properties. * @param [properties] Properties to set - * @returns DeleteTriggerRequest instance + * @returns DeleteChannelConnectionRequest instance */ - public static create(properties?: google.cloud.eventarc.v1.IDeleteTriggerRequest): google.cloud.eventarc.v1.DeleteTriggerRequest; + public static create(properties?: google.cloud.eventarc.v1.IDeleteChannelConnectionRequest): google.cloud.eventarc.v1.DeleteChannelConnectionRequest; /** - * Encodes the specified DeleteTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.DeleteTriggerRequest.verify|verify} messages. - * @param message DeleteTriggerRequest message or plain object to encode + * Encodes the specified DeleteChannelConnectionRequest message. Does not implicitly {@link google.cloud.eventarc.v1.DeleteChannelConnectionRequest.verify|verify} messages. + * @param message DeleteChannelConnectionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.eventarc.v1.IDeleteTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DeleteTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.DeleteTriggerRequest.verify|verify} messages. - * @param message DeleteTriggerRequest message or plain object to encode + * Encodes the specified DeleteChannelConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.DeleteChannelConnectionRequest.verify|verify} messages. + * @param message DeleteChannelConnectionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.eventarc.v1.IDeleteTriggerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DeleteTriggerRequest message from the specified reader or buffer. + * Decodes a DeleteChannelConnectionRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DeleteTriggerRequest + * @returns DeleteChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.DeleteTriggerRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.DeleteChannelConnectionRequest; /** - * Decodes a DeleteTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteChannelConnectionRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DeleteTriggerRequest + * @returns DeleteChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.DeleteTriggerRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.DeleteChannelConnectionRequest; /** - * Verifies a DeleteTriggerRequest message. + * Verifies a DeleteChannelConnectionRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DeleteTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteChannelConnectionRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DeleteTriggerRequest + * @returns DeleteChannelConnectionRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.DeleteTriggerRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.DeleteChannelConnectionRequest; /** - * Creates a plain object from a DeleteTriggerRequest message. Also converts values to other types if specified. - * @param message DeleteTriggerRequest + * Creates a plain object from a DeleteChannelConnectionRequest message. Also converts values to other types if specified. + * @param message DeleteChannelConnectionRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.eventarc.v1.DeleteTriggerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.eventarc.v1.DeleteChannelConnectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DeleteTriggerRequest to JSON. + * Converts this DeleteChannelConnectionRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -935,6 +2482,9 @@ export namespace google { /** Trigger labels */ labels?: ({ [k: string]: string }|null); + /** Trigger channel */ + channel?: (string|null); + /** Trigger etag */ etag?: (string|null); } @@ -975,6 +2525,9 @@ export namespace google { /** Trigger labels. */ public labels: { [k: string]: string }; + /** Trigger channel. */ + public channel: string; + /** Trigger etag. */ public etag: string; @@ -1057,6 +2610,9 @@ export namespace google { /** EventFilter value */ value?: (string|null); + + /** EventFilter operator */ + operator?: (string|null); } /** Represents an EventFilter. */ @@ -1074,6 +2630,9 @@ export namespace google { /** EventFilter value. */ public value: string; + /** EventFilter operator. */ + public operator: string; + /** * Creates a new EventFilter instance using the specified properties. * @param [properties] Properties to set @@ -1150,6 +2709,12 @@ export namespace google { /** Destination cloudRun */ cloudRun?: (google.cloud.eventarc.v1.ICloudRun|null); + + /** Destination cloudFunction */ + cloudFunction?: (string|null); + + /** Destination gke */ + gke?: (google.cloud.eventarc.v1.IGKE|null); } /** Represents a Destination. */ @@ -1164,8 +2729,14 @@ export namespace google { /** Destination cloudRun. */ public cloudRun?: (google.cloud.eventarc.v1.ICloudRun|null); + /** Destination cloudFunction. */ + public cloudFunction?: (string|null); + + /** Destination gke. */ + public gke?: (google.cloud.eventarc.v1.IGKE|null); + /** Destination descriptor. */ - public descriptor?: "cloudRun"; + public descriptor?: ("cloudRun"|"cloudFunction"|"gke"); /** * Creates a new Destination instance using the specified properties. @@ -1433,6 +3004,120 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a GKE. */ + interface IGKE { + + /** GKE cluster */ + cluster?: (string|null); + + /** GKE location */ + location?: (string|null); + + /** GKE namespace */ + namespace?: (string|null); + + /** GKE service */ + service?: (string|null); + + /** GKE path */ + path?: (string|null); + } + + /** Represents a GKE. */ + class GKE implements IGKE { + + /** + * Constructs a new GKE. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.eventarc.v1.IGKE); + + /** GKE cluster. */ + public cluster: string; + + /** GKE location. */ + public location: string; + + /** GKE namespace. */ + public namespace: string; + + /** GKE service. */ + public service: string; + + /** GKE path. */ + public path: string; + + /** + * Creates a new GKE instance using the specified properties. + * @param [properties] Properties to set + * @returns GKE instance + */ + public static create(properties?: google.cloud.eventarc.v1.IGKE): google.cloud.eventarc.v1.GKE; + + /** + * Encodes the specified GKE message. Does not implicitly {@link google.cloud.eventarc.v1.GKE.verify|verify} messages. + * @param message GKE message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.eventarc.v1.IGKE, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GKE message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GKE.verify|verify} messages. + * @param message GKE message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.eventarc.v1.IGKE, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GKE message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GKE + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.eventarc.v1.GKE; + + /** + * Decodes a GKE message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GKE + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.eventarc.v1.GKE; + + /** + * Verifies a GKE message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GKE message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GKE + */ + public static fromObject(object: { [k: string]: any }): google.cloud.eventarc.v1.GKE; + + /** + * Creates a plain object from a GKE message. Also converts values to other types if specified. + * @param message GKE + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.eventarc.v1.GKE, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GKE to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Pubsub. */ interface IPubsub { diff --git a/protos/protos.js b/protos/protos.js index c032f84..16e8869 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -66,224 +66,3942 @@ */ var v1 = {}; - v1.Eventarc = (function() { + v1.Channel = (function() { /** - * Constructs a new Eventarc service. + * Properties of a Channel. * @memberof google.cloud.eventarc.v1 - * @classdesc Represents an Eventarc - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @interface IChannel + * @property {string|null} [name] Channel name + * @property {string|null} [uid] Channel uid + * @property {google.protobuf.ITimestamp|null} [createTime] Channel createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Channel updateTime + * @property {string|null} [provider] Channel provider + * @property {string|null} [pubsubTopic] Channel pubsubTopic + * @property {google.cloud.eventarc.v1.Channel.State|null} [state] Channel state + * @property {string|null} [activationToken] Channel activationToken */ - function Eventarc(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (Eventarc.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Eventarc; /** - * Creates new Eventarc service using the specified rpc implementation. - * @function create - * @memberof google.cloud.eventarc.v1.Eventarc - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {Eventarc} RPC service. Useful where requests and/or responses are streamed. + * Constructs a new Channel. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a Channel. + * @implements IChannel + * @constructor + * @param {google.cloud.eventarc.v1.IChannel=} [properties] Properties to set */ - Eventarc.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + function Channel(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#getTrigger}. - * @memberof google.cloud.eventarc.v1.Eventarc - * @typedef GetTriggerCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.eventarc.v1.Trigger} [response] Trigger + * Channel name. + * @member {string} name + * @memberof google.cloud.eventarc.v1.Channel + * @instance */ + Channel.prototype.name = ""; /** - * Calls GetTrigger. - * @function getTrigger - * @memberof google.cloud.eventarc.v1.Eventarc + * Channel uid. + * @member {string} uid + * @memberof google.cloud.eventarc.v1.Channel * @instance - * @param {google.cloud.eventarc.v1.IGetTriggerRequest} request GetTriggerRequest message or plain object - * @param {google.cloud.eventarc.v1.Eventarc.GetTriggerCallback} callback Node-style callback called with the error, if any, and Trigger - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(Eventarc.prototype.getTrigger = function getTrigger(request, callback) { - return this.rpcCall(getTrigger, $root.google.cloud.eventarc.v1.GetTriggerRequest, $root.google.cloud.eventarc.v1.Trigger, request, callback); - }, "name", { value: "GetTrigger" }); + Channel.prototype.uid = ""; /** - * Calls GetTrigger. - * @function getTrigger - * @memberof google.cloud.eventarc.v1.Eventarc + * Channel createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.eventarc.v1.Channel * @instance - * @param {google.cloud.eventarc.v1.IGetTriggerRequest} request GetTriggerRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + Channel.prototype.createTime = null; /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#listTriggers}. - * @memberof google.cloud.eventarc.v1.Eventarc - * @typedef ListTriggersCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.eventarc.v1.ListTriggersResponse} [response] ListTriggersResponse + * Channel updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.eventarc.v1.Channel + * @instance */ + Channel.prototype.updateTime = null; /** - * Calls ListTriggers. - * @function listTriggers - * @memberof google.cloud.eventarc.v1.Eventarc + * Channel provider. + * @member {string} provider + * @memberof google.cloud.eventarc.v1.Channel * @instance - * @param {google.cloud.eventarc.v1.IListTriggersRequest} request ListTriggersRequest message or plain object - * @param {google.cloud.eventarc.v1.Eventarc.ListTriggersCallback} callback Node-style callback called with the error, if any, and ListTriggersResponse - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(Eventarc.prototype.listTriggers = function listTriggers(request, callback) { - return this.rpcCall(listTriggers, $root.google.cloud.eventarc.v1.ListTriggersRequest, $root.google.cloud.eventarc.v1.ListTriggersResponse, request, callback); - }, "name", { value: "ListTriggers" }); + Channel.prototype.provider = ""; /** - * Calls ListTriggers. - * @function listTriggers - * @memberof google.cloud.eventarc.v1.Eventarc + * Channel pubsubTopic. + * @member {string|null|undefined} pubsubTopic + * @memberof google.cloud.eventarc.v1.Channel * @instance - * @param {google.cloud.eventarc.v1.IListTriggersRequest} request ListTriggersRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + Channel.prototype.pubsubTopic = null; /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#createTrigger}. - * @memberof google.cloud.eventarc.v1.Eventarc - * @typedef CreateTriggerCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Channel state. + * @member {google.cloud.eventarc.v1.Channel.State} state + * @memberof google.cloud.eventarc.v1.Channel + * @instance */ + Channel.prototype.state = 0; /** - * Calls CreateTrigger. - * @function createTrigger - * @memberof google.cloud.eventarc.v1.Eventarc + * Channel activationToken. + * @member {string} activationToken + * @memberof google.cloud.eventarc.v1.Channel * @instance - * @param {google.cloud.eventarc.v1.ICreateTriggerRequest} request CreateTriggerRequest message or plain object - * @param {google.cloud.eventarc.v1.Eventarc.CreateTriggerCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(Eventarc.prototype.createTrigger = function createTrigger(request, callback) { - return this.rpcCall(createTrigger, $root.google.cloud.eventarc.v1.CreateTriggerRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "CreateTrigger" }); + Channel.prototype.activationToken = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * Calls CreateTrigger. - * @function createTrigger - * @memberof google.cloud.eventarc.v1.Eventarc + * Channel transport. + * @member {"pubsubTopic"|undefined} transport + * @memberof google.cloud.eventarc.v1.Channel * @instance - * @param {google.cloud.eventarc.v1.ICreateTriggerRequest} request CreateTriggerRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + Object.defineProperty(Channel.prototype, "transport", { + get: $util.oneOfGetter($oneOfFields = ["pubsubTopic"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#updateTrigger}. - * @memberof google.cloud.eventarc.v1.Eventarc - * @typedef UpdateTriggerCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Creates a new Channel instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.Channel + * @static + * @param {google.cloud.eventarc.v1.IChannel=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.Channel} Channel instance */ + Channel.create = function create(properties) { + return new Channel(properties); + }; /** - * Calls UpdateTrigger. - * @function updateTrigger - * @memberof google.cloud.eventarc.v1.Eventarc - * @instance - * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest} request UpdateTriggerRequest message or plain object - * @param {google.cloud.eventarc.v1.Eventarc.UpdateTriggerCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Encodes the specified Channel message. Does not implicitly {@link google.cloud.eventarc.v1.Channel.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.Channel + * @static + * @param {google.cloud.eventarc.v1.IChannel} message Channel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(Eventarc.prototype.updateTrigger = function updateTrigger(request, callback) { - return this.rpcCall(updateTrigger, $root.google.cloud.eventarc.v1.UpdateTriggerRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "UpdateTrigger" }); + Channel.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.uid != null && Object.hasOwnProperty.call(message, "uid")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uid); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.provider != null && Object.hasOwnProperty.call(message, "provider")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.provider); + if (message.pubsubTopic != null && Object.hasOwnProperty.call(message, "pubsubTopic")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.pubsubTopic); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); + if (message.activationToken != null && Object.hasOwnProperty.call(message, "activationToken")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.activationToken); + return writer; + }; /** - * Calls UpdateTrigger. - * @function updateTrigger - * @memberof google.cloud.eventarc.v1.Eventarc - * @instance - * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest} request UpdateTriggerRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Encodes the specified Channel message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.Channel.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.Channel + * @static + * @param {google.cloud.eventarc.v1.IChannel} message Channel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + Channel.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#deleteTrigger}. - * @memberof google.cloud.eventarc.v1.Eventarc - * @typedef DeleteTriggerCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Decodes a Channel message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.Channel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.Channel} Channel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + Channel.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.Channel(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.uid = reader.string(); + break; + case 5: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.provider = reader.string(); + break; + case 8: + message.pubsubTopic = reader.string(); + break; + case 9: + message.state = reader.int32(); + break; + case 10: + message.activationToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Calls DeleteTrigger. - * @function deleteTrigger - * @memberof google.cloud.eventarc.v1.Eventarc - * @instance - * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest} request DeleteTriggerRequest message or plain object - * @param {google.cloud.eventarc.v1.Eventarc.DeleteTriggerCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Decodes a Channel message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.Channel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.Channel} Channel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Object.defineProperty(Eventarc.prototype.deleteTrigger = function deleteTrigger(request, callback) { - return this.rpcCall(deleteTrigger, $root.google.cloud.eventarc.v1.DeleteTriggerRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "DeleteTrigger" }); + Channel.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Calls DeleteTrigger. - * @function deleteTrigger - * @memberof google.cloud.eventarc.v1.Eventarc - * @instance - * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest} request DeleteTriggerRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Verifies a Channel message. + * @function verify + * @memberof google.cloud.eventarc.v1.Channel + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ + Channel.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.uid != null && message.hasOwnProperty("uid")) + if (!$util.isString(message.uid)) + return "uid: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.provider != null && message.hasOwnProperty("provider")) + if (!$util.isString(message.provider)) + return "provider: string expected"; + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) { + properties.transport = 1; + if (!$util.isString(message.pubsubTopic)) + return "pubsubTopic: string expected"; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.activationToken != null && message.hasOwnProperty("activationToken")) + if (!$util.isString(message.activationToken)) + return "activationToken: string expected"; + return null; + }; + + /** + * Creates a Channel message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.Channel + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.Channel} Channel + */ + Channel.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.Channel) + return object; + var message = new $root.google.cloud.eventarc.v1.Channel(); + if (object.name != null) + message.name = String(object.name); + if (object.uid != null) + message.uid = String(object.uid); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.eventarc.v1.Channel.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.eventarc.v1.Channel.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.provider != null) + message.provider = String(object.provider); + if (object.pubsubTopic != null) + message.pubsubTopic = String(object.pubsubTopic); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "PENDING": + case 1: + message.state = 1; + break; + case "ACTIVE": + case 2: + message.state = 2; + break; + case "INACTIVE": + case 3: + message.state = 3; + break; + } + if (object.activationToken != null) + message.activationToken = String(object.activationToken); + return message; + }; + + /** + * Creates a plain object from a Channel message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.Channel + * @static + * @param {google.cloud.eventarc.v1.Channel} message Channel + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Channel.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.uid = ""; + object.createTime = null; + object.updateTime = null; + object.provider = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.activationToken = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.uid != null && message.hasOwnProperty("uid")) + object.uid = message.uid; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.provider != null && message.hasOwnProperty("provider")) + object.provider = message.provider; + if (message.pubsubTopic != null && message.hasOwnProperty("pubsubTopic")) { + object.pubsubTopic = message.pubsubTopic; + if (options.oneofs) + object.transport = "pubsubTopic"; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.eventarc.v1.Channel.State[message.state] : message.state; + if (message.activationToken != null && message.hasOwnProperty("activationToken")) + object.activationToken = message.activationToken; + return object; + }; + + /** + * Converts this Channel to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.Channel + * @instance + * @returns {Object.} JSON object + */ + Channel.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.eventarc.v1.Channel.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} PENDING=1 PENDING value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} INACTIVE=3 INACTIVE value + */ + Channel.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PENDING"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "INACTIVE"] = 3; + return values; + })(); + + return Channel; + })(); + + v1.ChannelConnection = (function() { + + /** + * Properties of a ChannelConnection. + * @memberof google.cloud.eventarc.v1 + * @interface IChannelConnection + * @property {string|null} [name] ChannelConnection name + * @property {string|null} [uid] ChannelConnection uid + * @property {string|null} [channel] ChannelConnection channel + * @property {google.protobuf.ITimestamp|null} [createTime] ChannelConnection createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ChannelConnection updateTime + * @property {string|null} [activationToken] ChannelConnection activationToken + */ + + /** + * Constructs a new ChannelConnection. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a ChannelConnection. + * @implements IChannelConnection + * @constructor + * @param {google.cloud.eventarc.v1.IChannelConnection=} [properties] Properties to set + */ + function ChannelConnection(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChannelConnection name. + * @member {string} name + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @instance + */ + ChannelConnection.prototype.name = ""; + + /** + * ChannelConnection uid. + * @member {string} uid + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @instance + */ + ChannelConnection.prototype.uid = ""; + + /** + * ChannelConnection channel. + * @member {string} channel + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @instance + */ + ChannelConnection.prototype.channel = ""; + + /** + * ChannelConnection createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @instance + */ + ChannelConnection.prototype.createTime = null; + + /** + * ChannelConnection updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @instance + */ + ChannelConnection.prototype.updateTime = null; + + /** + * ChannelConnection activationToken. + * @member {string} activationToken + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @instance + */ + ChannelConnection.prototype.activationToken = ""; + + /** + * Creates a new ChannelConnection instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @static + * @param {google.cloud.eventarc.v1.IChannelConnection=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.ChannelConnection} ChannelConnection instance + */ + ChannelConnection.create = function create(properties) { + return new ChannelConnection(properties); + }; + + /** + * Encodes the specified ChannelConnection message. Does not implicitly {@link google.cloud.eventarc.v1.ChannelConnection.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @static + * @param {google.cloud.eventarc.v1.IChannelConnection} message ChannelConnection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChannelConnection.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.uid != null && Object.hasOwnProperty.call(message, "uid")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uid); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.channel); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.activationToken != null && Object.hasOwnProperty.call(message, "activationToken")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.activationToken); + return writer; + }; + + /** + * Encodes the specified ChannelConnection message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ChannelConnection.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @static + * @param {google.cloud.eventarc.v1.IChannelConnection} message ChannelConnection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChannelConnection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChannelConnection message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.ChannelConnection} ChannelConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChannelConnection.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ChannelConnection(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.uid = reader.string(); + break; + case 5: + message.channel = reader.string(); + break; + case 6: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 8: + message.activationToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChannelConnection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.ChannelConnection} ChannelConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChannelConnection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChannelConnection message. + * @function verify + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChannelConnection.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.uid != null && message.hasOwnProperty("uid")) + if (!$util.isString(message.uid)) + return "uid: string expected"; + if (message.channel != null && message.hasOwnProperty("channel")) + if (!$util.isString(message.channel)) + return "channel: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.activationToken != null && message.hasOwnProperty("activationToken")) + if (!$util.isString(message.activationToken)) + return "activationToken: string expected"; + return null; + }; + + /** + * Creates a ChannelConnection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.ChannelConnection} ChannelConnection + */ + ChannelConnection.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.ChannelConnection) + return object; + var message = new $root.google.cloud.eventarc.v1.ChannelConnection(); + if (object.name != null) + message.name = String(object.name); + if (object.uid != null) + message.uid = String(object.uid); + if (object.channel != null) + message.channel = String(object.channel); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.eventarc.v1.ChannelConnection.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.eventarc.v1.ChannelConnection.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.activationToken != null) + message.activationToken = String(object.activationToken); + return message; + }; + + /** + * Creates a plain object from a ChannelConnection message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @static + * @param {google.cloud.eventarc.v1.ChannelConnection} message ChannelConnection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChannelConnection.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.uid = ""; + object.channel = ""; + object.createTime = null; + object.updateTime = null; + object.activationToken = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.uid != null && message.hasOwnProperty("uid")) + object.uid = message.uid; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = message.channel; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.activationToken != null && message.hasOwnProperty("activationToken")) + object.activationToken = message.activationToken; + return object; + }; + + /** + * Converts this ChannelConnection to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.ChannelConnection + * @instance + * @returns {Object.} JSON object + */ + ChannelConnection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ChannelConnection; + })(); + + v1.Eventarc = (function() { + + /** + * Constructs a new Eventarc service. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents an Eventarc + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Eventarc(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Eventarc.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Eventarc; + + /** + * Creates new Eventarc service using the specified rpc implementation. + * @function create + * @memberof google.cloud.eventarc.v1.Eventarc + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Eventarc} RPC service. Useful where requests and/or responses are streamed. + */ + Eventarc.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#getTrigger}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef GetTriggerCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.eventarc.v1.Trigger} [response] Trigger + */ + + /** + * Calls GetTrigger. + * @function getTrigger + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IGetTriggerRequest} request GetTriggerRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.GetTriggerCallback} callback Node-style callback called with the error, if any, and Trigger + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.getTrigger = function getTrigger(request, callback) { + return this.rpcCall(getTrigger, $root.google.cloud.eventarc.v1.GetTriggerRequest, $root.google.cloud.eventarc.v1.Trigger, request, callback); + }, "name", { value: "GetTrigger" }); + + /** + * Calls GetTrigger. + * @function getTrigger + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IGetTriggerRequest} request GetTriggerRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#listTriggers}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef ListTriggersCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.eventarc.v1.ListTriggersResponse} [response] ListTriggersResponse + */ + + /** + * Calls ListTriggers. + * @function listTriggers + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IListTriggersRequest} request ListTriggersRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.ListTriggersCallback} callback Node-style callback called with the error, if any, and ListTriggersResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.listTriggers = function listTriggers(request, callback) { + return this.rpcCall(listTriggers, $root.google.cloud.eventarc.v1.ListTriggersRequest, $root.google.cloud.eventarc.v1.ListTriggersResponse, request, callback); + }, "name", { value: "ListTriggers" }); + + /** + * Calls ListTriggers. + * @function listTriggers + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IListTriggersRequest} request ListTriggersRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#createTrigger}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef CreateTriggerCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateTrigger. + * @function createTrigger + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.ICreateTriggerRequest} request CreateTriggerRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.CreateTriggerCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.createTrigger = function createTrigger(request, callback) { + return this.rpcCall(createTrigger, $root.google.cloud.eventarc.v1.CreateTriggerRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateTrigger" }); + + /** + * Calls CreateTrigger. + * @function createTrigger + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.ICreateTriggerRequest} request CreateTriggerRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#updateTrigger}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef UpdateTriggerCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateTrigger. + * @function updateTrigger + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest} request UpdateTriggerRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.UpdateTriggerCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.updateTrigger = function updateTrigger(request, callback) { + return this.rpcCall(updateTrigger, $root.google.cloud.eventarc.v1.UpdateTriggerRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateTrigger" }); + + /** + * Calls UpdateTrigger. + * @function updateTrigger + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest} request UpdateTriggerRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#deleteTrigger}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef DeleteTriggerCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteTrigger. + * @function deleteTrigger + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest} request DeleteTriggerRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.DeleteTriggerCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.deleteTrigger = function deleteTrigger(request, callback) { + return this.rpcCall(deleteTrigger, $root.google.cloud.eventarc.v1.DeleteTriggerRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteTrigger" }); + + /** + * Calls DeleteTrigger. + * @function deleteTrigger + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest} request DeleteTriggerRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#getChannel}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef GetChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.eventarc.v1.Channel} [response] Channel + */ + + /** + * Calls GetChannel. + * @function getChannel + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IGetChannelRequest} request GetChannelRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.GetChannelCallback} callback Node-style callback called with the error, if any, and Channel + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.getChannel = function getChannel(request, callback) { + return this.rpcCall(getChannel, $root.google.cloud.eventarc.v1.GetChannelRequest, $root.google.cloud.eventarc.v1.Channel, request, callback); + }, "name", { value: "GetChannel" }); + + /** + * Calls GetChannel. + * @function getChannel + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IGetChannelRequest} request GetChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#listChannels}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef ListChannelsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.eventarc.v1.ListChannelsResponse} [response] ListChannelsResponse + */ + + /** + * Calls ListChannels. + * @function listChannels + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IListChannelsRequest} request ListChannelsRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.ListChannelsCallback} callback Node-style callback called with the error, if any, and ListChannelsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.listChannels = function listChannels(request, callback) { + return this.rpcCall(listChannels, $root.google.cloud.eventarc.v1.ListChannelsRequest, $root.google.cloud.eventarc.v1.ListChannelsResponse, request, callback); + }, "name", { value: "ListChannels" }); + + /** + * Calls ListChannels. + * @function listChannels + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IListChannelsRequest} request ListChannelsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#createChannel}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef CreateChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateChannel. + * @function createChannel + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.ICreateChannelRequest} request CreateChannelRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.CreateChannelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.createChannel = function createChannel(request, callback) { + return this.rpcCall(createChannel, $root.google.cloud.eventarc.v1.CreateChannelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateChannel" }); + + /** + * Calls CreateChannel. + * @function createChannel + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.ICreateChannelRequest} request CreateChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#updateChannel}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef UpdateChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateChannel. + * @function updateChannel + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IUpdateChannelRequest} request UpdateChannelRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.UpdateChannelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.updateChannel = function updateChannel(request, callback) { + return this.rpcCall(updateChannel, $root.google.cloud.eventarc.v1.UpdateChannelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateChannel" }); + + /** + * Calls UpdateChannel. + * @function updateChannel + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IUpdateChannelRequest} request UpdateChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#deleteChannel}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef DeleteChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteChannel. + * @function deleteChannel + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IDeleteChannelRequest} request DeleteChannelRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.DeleteChannelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.deleteChannel = function deleteChannel(request, callback) { + return this.rpcCall(deleteChannel, $root.google.cloud.eventarc.v1.DeleteChannelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteChannel" }); + + /** + * Calls DeleteChannel. + * @function deleteChannel + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IDeleteChannelRequest} request DeleteChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#getChannelConnection}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef GetChannelConnectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.eventarc.v1.ChannelConnection} [response] ChannelConnection + */ + + /** + * Calls GetChannelConnection. + * @function getChannelConnection + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IGetChannelConnectionRequest} request GetChannelConnectionRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.GetChannelConnectionCallback} callback Node-style callback called with the error, if any, and ChannelConnection + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.getChannelConnection = function getChannelConnection(request, callback) { + return this.rpcCall(getChannelConnection, $root.google.cloud.eventarc.v1.GetChannelConnectionRequest, $root.google.cloud.eventarc.v1.ChannelConnection, request, callback); + }, "name", { value: "GetChannelConnection" }); + + /** + * Calls GetChannelConnection. + * @function getChannelConnection + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IGetChannelConnectionRequest} request GetChannelConnectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#listChannelConnections}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef ListChannelConnectionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.eventarc.v1.ListChannelConnectionsResponse} [response] ListChannelConnectionsResponse + */ + + /** + * Calls ListChannelConnections. + * @function listChannelConnections + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IListChannelConnectionsRequest} request ListChannelConnectionsRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.ListChannelConnectionsCallback} callback Node-style callback called with the error, if any, and ListChannelConnectionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.listChannelConnections = function listChannelConnections(request, callback) { + return this.rpcCall(listChannelConnections, $root.google.cloud.eventarc.v1.ListChannelConnectionsRequest, $root.google.cloud.eventarc.v1.ListChannelConnectionsResponse, request, callback); + }, "name", { value: "ListChannelConnections" }); + + /** + * Calls ListChannelConnections. + * @function listChannelConnections + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IListChannelConnectionsRequest} request ListChannelConnectionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#createChannelConnection}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef CreateChannelConnectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateChannelConnection. + * @function createChannelConnection + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.ICreateChannelConnectionRequest} request CreateChannelConnectionRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.CreateChannelConnectionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.createChannelConnection = function createChannelConnection(request, callback) { + return this.rpcCall(createChannelConnection, $root.google.cloud.eventarc.v1.CreateChannelConnectionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateChannelConnection" }); + + /** + * Calls CreateChannelConnection. + * @function createChannelConnection + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.ICreateChannelConnectionRequest} request CreateChannelConnectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.eventarc.v1.Eventarc#deleteChannelConnection}. + * @memberof google.cloud.eventarc.v1.Eventarc + * @typedef DeleteChannelConnectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteChannelConnection. + * @function deleteChannelConnection + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IDeleteChannelConnectionRequest} request DeleteChannelConnectionRequest message or plain object + * @param {google.cloud.eventarc.v1.Eventarc.DeleteChannelConnectionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Eventarc.prototype.deleteChannelConnection = function deleteChannelConnection(request, callback) { + return this.rpcCall(deleteChannelConnection, $root.google.cloud.eventarc.v1.DeleteChannelConnectionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteChannelConnection" }); + + /** + * Calls DeleteChannelConnection. + * @function deleteChannelConnection + * @memberof google.cloud.eventarc.v1.Eventarc + * @instance + * @param {google.cloud.eventarc.v1.IDeleteChannelConnectionRequest} request DeleteChannelConnectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Eventarc; + })(); + + v1.GetTriggerRequest = (function() { + + /** + * Properties of a GetTriggerRequest. + * @memberof google.cloud.eventarc.v1 + * @interface IGetTriggerRequest + * @property {string|null} [name] GetTriggerRequest name + */ + + /** + * Constructs a new GetTriggerRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a GetTriggerRequest. + * @implements IGetTriggerRequest + * @constructor + * @param {google.cloud.eventarc.v1.IGetTriggerRequest=} [properties] Properties to set + */ + function GetTriggerRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetTriggerRequest name. + * @member {string} name + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @instance + */ + GetTriggerRequest.prototype.name = ""; + + /** + * Creates a new GetTriggerRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IGetTriggerRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.GetTriggerRequest} GetTriggerRequest instance + */ + GetTriggerRequest.create = function create(properties) { + return new GetTriggerRequest(properties); + }; + + /** + * Encodes the specified GetTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.GetTriggerRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IGetTriggerRequest} message GetTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTriggerRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GetTriggerRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IGetTriggerRequest} message GetTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetTriggerRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.GetTriggerRequest} GetTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTriggerRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.GetTriggerRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetTriggerRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.GetTriggerRequest} GetTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetTriggerRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTriggerRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.GetTriggerRequest} GetTriggerRequest + */ + GetTriggerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.GetTriggerRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.GetTriggerRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetTriggerRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.GetTriggerRequest} message GetTriggerRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTriggerRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetTriggerRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @instance + * @returns {Object.} JSON object + */ + GetTriggerRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetTriggerRequest; + })(); + + v1.ListTriggersRequest = (function() { + + /** + * Properties of a ListTriggersRequest. + * @memberof google.cloud.eventarc.v1 + * @interface IListTriggersRequest + * @property {string|null} [parent] ListTriggersRequest parent + * @property {number|null} [pageSize] ListTriggersRequest pageSize + * @property {string|null} [pageToken] ListTriggersRequest pageToken + * @property {string|null} [orderBy] ListTriggersRequest orderBy + */ + + /** + * Constructs a new ListTriggersRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a ListTriggersRequest. + * @implements IListTriggersRequest + * @constructor + * @param {google.cloud.eventarc.v1.IListTriggersRequest=} [properties] Properties to set + */ + function ListTriggersRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListTriggersRequest parent. + * @member {string} parent + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @instance + */ + ListTriggersRequest.prototype.parent = ""; + + /** + * ListTriggersRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @instance + */ + ListTriggersRequest.prototype.pageSize = 0; + + /** + * ListTriggersRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @instance + */ + ListTriggersRequest.prototype.pageToken = ""; + + /** + * ListTriggersRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @instance + */ + ListTriggersRequest.prototype.orderBy = ""; + + /** + * Creates a new ListTriggersRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @static + * @param {google.cloud.eventarc.v1.IListTriggersRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.ListTriggersRequest} ListTriggersRequest instance + */ + ListTriggersRequest.create = function create(properties) { + return new ListTriggersRequest(properties); + }; + + /** + * Encodes the specified ListTriggersRequest message. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @static + * @param {google.cloud.eventarc.v1.IListTriggersRequest} message ListTriggersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTriggersRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListTriggersRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @static + * @param {google.cloud.eventarc.v1.IListTriggersRequest} message ListTriggersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTriggersRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTriggersRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.ListTriggersRequest} ListTriggersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTriggersRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ListTriggersRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.orderBy = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTriggersRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.ListTriggersRequest} ListTriggersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTriggersRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTriggersRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTriggersRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListTriggersRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.ListTriggersRequest} ListTriggersRequest + */ + ListTriggersRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.ListTriggersRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.ListTriggersRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListTriggersRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @static + * @param {google.cloud.eventarc.v1.ListTriggersRequest} message ListTriggersRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTriggersRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListTriggersRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @instance + * @returns {Object.} JSON object + */ + ListTriggersRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListTriggersRequest; + })(); + + v1.ListTriggersResponse = (function() { + + /** + * Properties of a ListTriggersResponse. + * @memberof google.cloud.eventarc.v1 + * @interface IListTriggersResponse + * @property {Array.|null} [triggers] ListTriggersResponse triggers + * @property {string|null} [nextPageToken] ListTriggersResponse nextPageToken + * @property {Array.|null} [unreachable] ListTriggersResponse unreachable + */ + + /** + * Constructs a new ListTriggersResponse. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a ListTriggersResponse. + * @implements IListTriggersResponse + * @constructor + * @param {google.cloud.eventarc.v1.IListTriggersResponse=} [properties] Properties to set + */ + function ListTriggersResponse(properties) { + this.triggers = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListTriggersResponse triggers. + * @member {Array.} triggers + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @instance + */ + ListTriggersResponse.prototype.triggers = $util.emptyArray; + + /** + * ListTriggersResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @instance + */ + ListTriggersResponse.prototype.nextPageToken = ""; + + /** + * ListTriggersResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @instance + */ + ListTriggersResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListTriggersResponse instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @static + * @param {google.cloud.eventarc.v1.IListTriggersResponse=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.ListTriggersResponse} ListTriggersResponse instance + */ + ListTriggersResponse.create = function create(properties) { + return new ListTriggersResponse(properties); + }; + + /** + * Encodes the specified ListTriggersResponse message. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @static + * @param {google.cloud.eventarc.v1.IListTriggersResponse} message ListTriggersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTriggersResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.triggers != null && message.triggers.length) + for (var i = 0; i < message.triggers.length; ++i) + $root.google.cloud.eventarc.v1.Trigger.encode(message.triggers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListTriggersResponse message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @static + * @param {google.cloud.eventarc.v1.IListTriggersResponse} message ListTriggersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTriggersResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTriggersResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.ListTriggersResponse} ListTriggersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTriggersResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ListTriggersResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.triggers && message.triggers.length)) + message.triggers = []; + message.triggers.push($root.google.cloud.eventarc.v1.Trigger.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTriggersResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.ListTriggersResponse} ListTriggersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTriggersResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTriggersResponse message. + * @function verify + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTriggersResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.triggers != null && message.hasOwnProperty("triggers")) { + if (!Array.isArray(message.triggers)) + return "triggers: array expected"; + for (var i = 0; i < message.triggers.length; ++i) { + var error = $root.google.cloud.eventarc.v1.Trigger.verify(message.triggers[i]); + if (error) + return "triggers." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListTriggersResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.ListTriggersResponse} ListTriggersResponse + */ + ListTriggersResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.ListTriggersResponse) + return object; + var message = new $root.google.cloud.eventarc.v1.ListTriggersResponse(); + if (object.triggers) { + if (!Array.isArray(object.triggers)) + throw TypeError(".google.cloud.eventarc.v1.ListTriggersResponse.triggers: array expected"); + message.triggers = []; + for (var i = 0; i < object.triggers.length; ++i) { + if (typeof object.triggers[i] !== "object") + throw TypeError(".google.cloud.eventarc.v1.ListTriggersResponse.triggers: object expected"); + message.triggers[i] = $root.google.cloud.eventarc.v1.Trigger.fromObject(object.triggers[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.eventarc.v1.ListTriggersResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListTriggersResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @static + * @param {google.cloud.eventarc.v1.ListTriggersResponse} message ListTriggersResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTriggersResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.triggers = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.triggers && message.triggers.length) { + object.triggers = []; + for (var j = 0; j < message.triggers.length; ++j) + object.triggers[j] = $root.google.cloud.eventarc.v1.Trigger.toObject(message.triggers[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListTriggersResponse to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @instance + * @returns {Object.} JSON object + */ + ListTriggersResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListTriggersResponse; + })(); + + v1.CreateTriggerRequest = (function() { + + /** + * Properties of a CreateTriggerRequest. + * @memberof google.cloud.eventarc.v1 + * @interface ICreateTriggerRequest + * @property {string|null} [parent] CreateTriggerRequest parent + * @property {google.cloud.eventarc.v1.ITrigger|null} [trigger] CreateTriggerRequest trigger + * @property {string|null} [triggerId] CreateTriggerRequest triggerId + * @property {boolean|null} [validateOnly] CreateTriggerRequest validateOnly + */ + + /** + * Constructs a new CreateTriggerRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a CreateTriggerRequest. + * @implements ICreateTriggerRequest + * @constructor + * @param {google.cloud.eventarc.v1.ICreateTriggerRequest=} [properties] Properties to set + */ + function CreateTriggerRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateTriggerRequest parent. + * @member {string} parent + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @instance + */ + CreateTriggerRequest.prototype.parent = ""; + + /** + * CreateTriggerRequest trigger. + * @member {google.cloud.eventarc.v1.ITrigger|null|undefined} trigger + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @instance + */ + CreateTriggerRequest.prototype.trigger = null; + + /** + * CreateTriggerRequest triggerId. + * @member {string} triggerId + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @instance + */ + CreateTriggerRequest.prototype.triggerId = ""; + + /** + * CreateTriggerRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @instance + */ + CreateTriggerRequest.prototype.validateOnly = false; + + /** + * Creates a new CreateTriggerRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.ICreateTriggerRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.CreateTriggerRequest} CreateTriggerRequest instance + */ + CreateTriggerRequest.create = function create(properties) { + return new CreateTriggerRequest(properties); + }; + + /** + * Encodes the specified CreateTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.CreateTriggerRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.ICreateTriggerRequest} message CreateTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTriggerRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + $root.google.cloud.eventarc.v1.Trigger.encode(message.trigger, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.triggerId != null && Object.hasOwnProperty.call(message, "triggerId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.triggerId); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified CreateTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.CreateTriggerRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.ICreateTriggerRequest} message CreateTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateTriggerRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.CreateTriggerRequest} CreateTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTriggerRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.CreateTriggerRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.trigger = $root.google.cloud.eventarc.v1.Trigger.decode(reader, reader.uint32()); + break; + case 3: + message.triggerId = reader.string(); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateTriggerRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.CreateTriggerRequest} CreateTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateTriggerRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateTriggerRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) { + var error = $root.google.cloud.eventarc.v1.Trigger.verify(message.trigger); + if (error) + return "trigger." + error; + } + if (message.triggerId != null && message.hasOwnProperty("triggerId")) + if (!$util.isString(message.triggerId)) + return "triggerId: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a CreateTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.CreateTriggerRequest} CreateTriggerRequest + */ + CreateTriggerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.CreateTriggerRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.CreateTriggerRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.trigger != null) { + if (typeof object.trigger !== "object") + throw TypeError(".google.cloud.eventarc.v1.CreateTriggerRequest.trigger: object expected"); + message.trigger = $root.google.cloud.eventarc.v1.Trigger.fromObject(object.trigger); + } + if (object.triggerId != null) + message.triggerId = String(object.triggerId); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a CreateTriggerRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.CreateTriggerRequest} message CreateTriggerRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateTriggerRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.trigger = null; + object.triggerId = ""; + object.validateOnly = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = $root.google.cloud.eventarc.v1.Trigger.toObject(message.trigger, options); + if (message.triggerId != null && message.hasOwnProperty("triggerId")) + object.triggerId = message.triggerId; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this CreateTriggerRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @instance + * @returns {Object.} JSON object + */ + CreateTriggerRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateTriggerRequest; + })(); + + v1.UpdateTriggerRequest = (function() { + + /** + * Properties of an UpdateTriggerRequest. + * @memberof google.cloud.eventarc.v1 + * @interface IUpdateTriggerRequest + * @property {google.cloud.eventarc.v1.ITrigger|null} [trigger] UpdateTriggerRequest trigger + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateTriggerRequest updateMask + * @property {boolean|null} [allowMissing] UpdateTriggerRequest allowMissing + * @property {boolean|null} [validateOnly] UpdateTriggerRequest validateOnly + */ + + /** + * Constructs a new UpdateTriggerRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents an UpdateTriggerRequest. + * @implements IUpdateTriggerRequest + * @constructor + * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest=} [properties] Properties to set + */ + function UpdateTriggerRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateTriggerRequest trigger. + * @member {google.cloud.eventarc.v1.ITrigger|null|undefined} trigger + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @instance + */ + UpdateTriggerRequest.prototype.trigger = null; + + /** + * UpdateTriggerRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @instance + */ + UpdateTriggerRequest.prototype.updateMask = null; + + /** + * UpdateTriggerRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @instance + */ + UpdateTriggerRequest.prototype.allowMissing = false; + + /** + * UpdateTriggerRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @instance + */ + UpdateTriggerRequest.prototype.validateOnly = false; + + /** + * Creates a new UpdateTriggerRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.UpdateTriggerRequest} UpdateTriggerRequest instance + */ + UpdateTriggerRequest.create = function create(properties) { + return new UpdateTriggerRequest(properties); + }; + + /** + * Encodes the specified UpdateTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.UpdateTriggerRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest} message UpdateTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateTriggerRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + $root.google.cloud.eventarc.v1.Trigger.encode(message.trigger, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified UpdateTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.UpdateTriggerRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest} message UpdateTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateTriggerRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.UpdateTriggerRequest} UpdateTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateTriggerRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.UpdateTriggerRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.trigger = $root.google.cloud.eventarc.v1.Trigger.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.allowMissing = reader.bool(); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateTriggerRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.UpdateTriggerRequest} UpdateTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateTriggerRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateTriggerRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.trigger != null && message.hasOwnProperty("trigger")) { + var error = $root.google.cloud.eventarc.v1.Trigger.verify(message.trigger); + if (error) + return "trigger." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates an UpdateTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.UpdateTriggerRequest} UpdateTriggerRequest + */ + UpdateTriggerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.UpdateTriggerRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.UpdateTriggerRequest(); + if (object.trigger != null) { + if (typeof object.trigger !== "object") + throw TypeError(".google.cloud.eventarc.v1.UpdateTriggerRequest.trigger: object expected"); + message.trigger = $root.google.cloud.eventarc.v1.Trigger.fromObject(object.trigger); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.eventarc.v1.UpdateTriggerRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from an UpdateTriggerRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.UpdateTriggerRequest} message UpdateTriggerRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateTriggerRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.trigger = null; + object.updateMask = null; + object.allowMissing = false; + object.validateOnly = false; + } + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = $root.google.cloud.eventarc.v1.Trigger.toObject(message.trigger, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this UpdateTriggerRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateTriggerRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateTriggerRequest; + })(); + + v1.DeleteTriggerRequest = (function() { + + /** + * Properties of a DeleteTriggerRequest. + * @memberof google.cloud.eventarc.v1 + * @interface IDeleteTriggerRequest + * @property {string|null} [name] DeleteTriggerRequest name + * @property {string|null} [etag] DeleteTriggerRequest etag + * @property {boolean|null} [allowMissing] DeleteTriggerRequest allowMissing + * @property {boolean|null} [validateOnly] DeleteTriggerRequest validateOnly + */ + + /** + * Constructs a new DeleteTriggerRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a DeleteTriggerRequest. + * @implements IDeleteTriggerRequest + * @constructor + * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest=} [properties] Properties to set + */ + function DeleteTriggerRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteTriggerRequest name. + * @member {string} name + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @instance + */ + DeleteTriggerRequest.prototype.name = ""; + + /** + * DeleteTriggerRequest etag. + * @member {string} etag + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @instance + */ + DeleteTriggerRequest.prototype.etag = ""; + + /** + * DeleteTriggerRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @instance + */ + DeleteTriggerRequest.prototype.allowMissing = false; + + /** + * DeleteTriggerRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @instance + */ + DeleteTriggerRequest.prototype.validateOnly = false; + + /** + * Creates a new DeleteTriggerRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.DeleteTriggerRequest} DeleteTriggerRequest instance + */ + DeleteTriggerRequest.create = function create(properties) { + return new DeleteTriggerRequest(properties); + }; + + /** + * Encodes the specified DeleteTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.DeleteTriggerRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest} message DeleteTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTriggerRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.etag); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified DeleteTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.DeleteTriggerRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest} message DeleteTriggerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteTriggerRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.DeleteTriggerRequest} DeleteTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTriggerRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.DeleteTriggerRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.etag = reader.string(); + break; + case 3: + message.allowMissing = reader.bool(); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteTriggerRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.DeleteTriggerRequest} DeleteTriggerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteTriggerRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteTriggerRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a DeleteTriggerRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.DeleteTriggerRequest} DeleteTriggerRequest + */ + DeleteTriggerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.DeleteTriggerRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.DeleteTriggerRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.etag != null) + message.etag = String(object.etag); + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a DeleteTriggerRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @static + * @param {google.cloud.eventarc.v1.DeleteTriggerRequest} message DeleteTriggerRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteTriggerRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.etag = ""; + object.allowMissing = false; + object.validateOnly = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this DeleteTriggerRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteTriggerRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteTriggerRequest; + })(); + + v1.GetChannelRequest = (function() { + + /** + * Properties of a GetChannelRequest. + * @memberof google.cloud.eventarc.v1 + * @interface IGetChannelRequest + * @property {string|null} [name] GetChannelRequest name + */ + + /** + * Constructs a new GetChannelRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a GetChannelRequest. + * @implements IGetChannelRequest + * @constructor + * @param {google.cloud.eventarc.v1.IGetChannelRequest=} [properties] Properties to set + */ + function GetChannelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetChannelRequest name. + * @member {string} name + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @instance + */ + GetChannelRequest.prototype.name = ""; + + /** + * Creates a new GetChannelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @static + * @param {google.cloud.eventarc.v1.IGetChannelRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.GetChannelRequest} GetChannelRequest instance + */ + GetChannelRequest.create = function create(properties) { + return new GetChannelRequest(properties); + }; + + /** + * Encodes the specified GetChannelRequest message. Does not implicitly {@link google.cloud.eventarc.v1.GetChannelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @static + * @param {google.cloud.eventarc.v1.IGetChannelRequest} message GetChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetChannelRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GetChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @static + * @param {google.cloud.eventarc.v1.IGetChannelRequest} message GetChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.GetChannelRequest} GetChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.GetChannelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.GetChannelRequest} GetChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetChannelRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetChannelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.GetChannelRequest} GetChannelRequest + */ + GetChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.GetChannelRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.GetChannelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @static + * @param {google.cloud.eventarc.v1.GetChannelRequest} message GetChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetChannelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetChannelRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.GetChannelRequest + * @instance + * @returns {Object.} JSON object + */ + GetChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetChannelRequest; + })(); + + v1.ListChannelsRequest = (function() { + + /** + * Properties of a ListChannelsRequest. + * @memberof google.cloud.eventarc.v1 + * @interface IListChannelsRequest + * @property {string|null} [parent] ListChannelsRequest parent + * @property {number|null} [pageSize] ListChannelsRequest pageSize + * @property {string|null} [pageToken] ListChannelsRequest pageToken + * @property {string|null} [orderBy] ListChannelsRequest orderBy + */ + + /** + * Constructs a new ListChannelsRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a ListChannelsRequest. + * @implements IListChannelsRequest + * @constructor + * @param {google.cloud.eventarc.v1.IListChannelsRequest=} [properties] Properties to set + */ + function ListChannelsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListChannelsRequest parent. + * @member {string} parent + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @instance + */ + ListChannelsRequest.prototype.parent = ""; + + /** + * ListChannelsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @instance + */ + ListChannelsRequest.prototype.pageSize = 0; + + /** + * ListChannelsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @instance + */ + ListChannelsRequest.prototype.pageToken = ""; + + /** + * ListChannelsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @instance + */ + ListChannelsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListChannelsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @static + * @param {google.cloud.eventarc.v1.IListChannelsRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.ListChannelsRequest} ListChannelsRequest instance + */ + ListChannelsRequest.create = function create(properties) { + return new ListChannelsRequest(properties); + }; + + /** + * Encodes the specified ListChannelsRequest message. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @static + * @param {google.cloud.eventarc.v1.IListChannelsRequest} message ListChannelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListChannelsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListChannelsRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @static + * @param {google.cloud.eventarc.v1.IListChannelsRequest} message ListChannelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListChannelsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListChannelsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.ListChannelsRequest} ListChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListChannelsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ListChannelsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.orderBy = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListChannelsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.ListChannelsRequest} ListChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListChannelsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListChannelsRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListChannelsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListChannelsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.ListChannelsRequest} ListChannelsRequest + */ + ListChannelsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.ListChannelsRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.ListChannelsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListChannelsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @static + * @param {google.cloud.eventarc.v1.ListChannelsRequest} message ListChannelsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListChannelsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListChannelsRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.ListChannelsRequest + * @instance + * @returns {Object.} JSON object + */ + ListChannelsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListChannelsRequest; + })(); + + v1.ListChannelsResponse = (function() { + + /** + * Properties of a ListChannelsResponse. + * @memberof google.cloud.eventarc.v1 + * @interface IListChannelsResponse + * @property {Array.|null} [channels] ListChannelsResponse channels + * @property {string|null} [nextPageToken] ListChannelsResponse nextPageToken + * @property {Array.|null} [unreachable] ListChannelsResponse unreachable + */ + + /** + * Constructs a new ListChannelsResponse. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a ListChannelsResponse. + * @implements IListChannelsResponse + * @constructor + * @param {google.cloud.eventarc.v1.IListChannelsResponse=} [properties] Properties to set + */ + function ListChannelsResponse(properties) { + this.channels = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListChannelsResponse channels. + * @member {Array.} channels + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @instance + */ + ListChannelsResponse.prototype.channels = $util.emptyArray; + + /** + * ListChannelsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @instance + */ + ListChannelsResponse.prototype.nextPageToken = ""; + + /** + * ListChannelsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @instance + */ + ListChannelsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListChannelsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @static + * @param {google.cloud.eventarc.v1.IListChannelsResponse=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.ListChannelsResponse} ListChannelsResponse instance + */ + ListChannelsResponse.create = function create(properties) { + return new ListChannelsResponse(properties); + }; + + /** + * Encodes the specified ListChannelsResponse message. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @static + * @param {google.cloud.eventarc.v1.IListChannelsResponse} message ListChannelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListChannelsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.channels != null && message.channels.length) + for (var i = 0; i < message.channels.length; ++i) + $root.google.cloud.eventarc.v1.Channel.encode(message.channels[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListChannelsResponse message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @static + * @param {google.cloud.eventarc.v1.IListChannelsResponse} message ListChannelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListChannelsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListChannelsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.ListChannelsResponse} ListChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListChannelsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ListChannelsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.channels && message.channels.length)) + message.channels = []; + message.channels.push($root.google.cloud.eventarc.v1.Channel.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + case 3: + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListChannelsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.ListChannelsResponse} ListChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListChannelsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListChannelsResponse message. + * @function verify + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListChannelsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.channels != null && message.hasOwnProperty("channels")) { + if (!Array.isArray(message.channels)) + return "channels: array expected"; + for (var i = 0; i < message.channels.length; ++i) { + var error = $root.google.cloud.eventarc.v1.Channel.verify(message.channels[i]); + if (error) + return "channels." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListChannelsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.ListChannelsResponse} ListChannelsResponse + */ + ListChannelsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.ListChannelsResponse) + return object; + var message = new $root.google.cloud.eventarc.v1.ListChannelsResponse(); + if (object.channels) { + if (!Array.isArray(object.channels)) + throw TypeError(".google.cloud.eventarc.v1.ListChannelsResponse.channels: array expected"); + message.channels = []; + for (var i = 0; i < object.channels.length; ++i) { + if (typeof object.channels[i] !== "object") + throw TypeError(".google.cloud.eventarc.v1.ListChannelsResponse.channels: object expected"); + message.channels[i] = $root.google.cloud.eventarc.v1.Channel.fromObject(object.channels[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.eventarc.v1.ListChannelsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListChannelsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @static + * @param {google.cloud.eventarc.v1.ListChannelsResponse} message ListChannelsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListChannelsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.channels = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.channels && message.channels.length) { + object.channels = []; + for (var j = 0; j < message.channels.length; ++j) + object.channels[j] = $root.google.cloud.eventarc.v1.Channel.toObject(message.channels[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListChannelsResponse to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.ListChannelsResponse + * @instance + * @returns {Object.} JSON object + */ + ListChannelsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListChannelsResponse; + })(); + + v1.CreateChannelRequest = (function() { + + /** + * Properties of a CreateChannelRequest. + * @memberof google.cloud.eventarc.v1 + * @interface ICreateChannelRequest + * @property {string|null} [parent] CreateChannelRequest parent + * @property {google.cloud.eventarc.v1.IChannel|null} [channel] CreateChannelRequest channel + * @property {string|null} [channelId] CreateChannelRequest channelId + * @property {boolean|null} [validateOnly] CreateChannelRequest validateOnly + */ + + /** + * Constructs a new CreateChannelRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a CreateChannelRequest. + * @implements ICreateChannelRequest + * @constructor + * @param {google.cloud.eventarc.v1.ICreateChannelRequest=} [properties] Properties to set + */ + function CreateChannelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateChannelRequest parent. + * @member {string} parent + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @instance + */ + CreateChannelRequest.prototype.parent = ""; + + /** + * CreateChannelRequest channel. + * @member {google.cloud.eventarc.v1.IChannel|null|undefined} channel + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @instance + */ + CreateChannelRequest.prototype.channel = null; + + /** + * CreateChannelRequest channelId. + * @member {string} channelId + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @instance + */ + CreateChannelRequest.prototype.channelId = ""; + + /** + * CreateChannelRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @instance + */ + CreateChannelRequest.prototype.validateOnly = false; + + /** + * Creates a new CreateChannelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @static + * @param {google.cloud.eventarc.v1.ICreateChannelRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.CreateChannelRequest} CreateChannelRequest instance + */ + CreateChannelRequest.create = function create(properties) { + return new CreateChannelRequest(properties); + }; + + /** + * Encodes the specified CreateChannelRequest message. Does not implicitly {@link google.cloud.eventarc.v1.CreateChannelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @static + * @param {google.cloud.eventarc.v1.ICreateChannelRequest} message CreateChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + $root.google.cloud.eventarc.v1.Channel.encode(message.channel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.channelId != null && Object.hasOwnProperty.call(message, "channelId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.channelId); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified CreateChannelRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.CreateChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @static + * @param {google.cloud.eventarc.v1.ICreateChannelRequest} message CreateChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.CreateChannelRequest} CreateChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.CreateChannelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.channel = $root.google.cloud.eventarc.v1.Channel.decode(reader, reader.uint32()); + break; + case 3: + message.channelId = reader.string(); + break; + case 4: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.CreateChannelRequest} CreateChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateChannelRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateChannelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.channel != null && message.hasOwnProperty("channel")) { + var error = $root.google.cloud.eventarc.v1.Channel.verify(message.channel); + if (error) + return "channel." + error; + } + if (message.channelId != null && message.hasOwnProperty("channelId")) + if (!$util.isString(message.channelId)) + return "channelId: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a CreateChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.CreateChannelRequest} CreateChannelRequest + */ + CreateChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.CreateChannelRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.CreateChannelRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.channel != null) { + if (typeof object.channel !== "object") + throw TypeError(".google.cloud.eventarc.v1.CreateChannelRequest.channel: object expected"); + message.channel = $root.google.cloud.eventarc.v1.Channel.fromObject(object.channel); + } + if (object.channelId != null) + message.channelId = String(object.channelId); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a CreateChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @static + * @param {google.cloud.eventarc.v1.CreateChannelRequest} message CreateChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateChannelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.channel = null; + object.channelId = ""; + object.validateOnly = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = $root.google.cloud.eventarc.v1.Channel.toObject(message.channel, options); + if (message.channelId != null && message.hasOwnProperty("channelId")) + object.channelId = message.channelId; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this CreateChannelRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.CreateChannelRequest + * @instance + * @returns {Object.} JSON object + */ + CreateChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateChannelRequest; + })(); + + v1.UpdateChannelRequest = (function() { + + /** + * Properties of an UpdateChannelRequest. + * @memberof google.cloud.eventarc.v1 + * @interface IUpdateChannelRequest + * @property {google.cloud.eventarc.v1.IChannel|null} [channel] UpdateChannelRequest channel + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateChannelRequest updateMask + * @property {boolean|null} [validateOnly] UpdateChannelRequest validateOnly + */ + + /** + * Constructs a new UpdateChannelRequest. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents an UpdateChannelRequest. + * @implements IUpdateChannelRequest + * @constructor + * @param {google.cloud.eventarc.v1.IUpdateChannelRequest=} [properties] Properties to set + */ + function UpdateChannelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateChannelRequest channel. + * @member {google.cloud.eventarc.v1.IChannel|null|undefined} channel + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @instance + */ + UpdateChannelRequest.prototype.channel = null; + + /** + * UpdateChannelRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @instance + */ + UpdateChannelRequest.prototype.updateMask = null; + + /** + * UpdateChannelRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @instance + */ + UpdateChannelRequest.prototype.validateOnly = false; + + /** + * Creates a new UpdateChannelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @static + * @param {google.cloud.eventarc.v1.IUpdateChannelRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.UpdateChannelRequest} UpdateChannelRequest instance + */ + UpdateChannelRequest.create = function create(properties) { + return new UpdateChannelRequest(properties); + }; + + /** + * Encodes the specified UpdateChannelRequest message. Does not implicitly {@link google.cloud.eventarc.v1.UpdateChannelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @static + * @param {google.cloud.eventarc.v1.IUpdateChannelRequest} message UpdateChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + $root.google.cloud.eventarc.v1.Channel.encode(message.channel, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified UpdateChannelRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.UpdateChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @static + * @param {google.cloud.eventarc.v1.IUpdateChannelRequest} message UpdateChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.UpdateChannelRequest} UpdateChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.UpdateChannelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channel = $root.google.cloud.eventarc.v1.Channel.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.validateOnly = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.UpdateChannelRequest} UpdateChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateChannelRequest message. + * @function verify + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateChannelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.channel != null && message.hasOwnProperty("channel")) { + var error = $root.google.cloud.eventarc.v1.Channel.verify(message.channel); + if (error) + return "channel." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates an UpdateChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.UpdateChannelRequest} UpdateChannelRequest + */ + UpdateChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.UpdateChannelRequest) + return object; + var message = new $root.google.cloud.eventarc.v1.UpdateChannelRequest(); + if (object.channel != null) { + if (typeof object.channel !== "object") + throw TypeError(".google.cloud.eventarc.v1.UpdateChannelRequest.channel: object expected"); + message.channel = $root.google.cloud.eventarc.v1.Channel.fromObject(object.channel); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.eventarc.v1.UpdateChannelRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from an UpdateChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @static + * @param {google.cloud.eventarc.v1.UpdateChannelRequest} message UpdateChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateChannelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.channel = null; + object.updateMask = null; + object.validateOnly = false; + } + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = $root.google.cloud.eventarc.v1.Channel.toObject(message.channel, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this UpdateChannelRequest to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.UpdateChannelRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Eventarc; + return UpdateChannelRequest; })(); - v1.GetTriggerRequest = (function() { + v1.DeleteChannelRequest = (function() { /** - * Properties of a GetTriggerRequest. + * Properties of a DeleteChannelRequest. * @memberof google.cloud.eventarc.v1 - * @interface IGetTriggerRequest - * @property {string|null} [name] GetTriggerRequest name + * @interface IDeleteChannelRequest + * @property {string|null} [name] DeleteChannelRequest name + * @property {boolean|null} [validateOnly] DeleteChannelRequest validateOnly */ /** - * Constructs a new GetTriggerRequest. + * Constructs a new DeleteChannelRequest. * @memberof google.cloud.eventarc.v1 - * @classdesc Represents a GetTriggerRequest. - * @implements IGetTriggerRequest + * @classdesc Represents a DeleteChannelRequest. + * @implements IDeleteChannelRequest * @constructor - * @param {google.cloud.eventarc.v1.IGetTriggerRequest=} [properties] Properties to set + * @param {google.cloud.eventarc.v1.IDeleteChannelRequest=} [properties] Properties to set */ - function GetTriggerRequest(properties) { + function DeleteChannelRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -291,76 +4009,89 @@ } /** - * GetTriggerRequest name. + * DeleteChannelRequest name. * @member {string} name - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @instance */ - GetTriggerRequest.prototype.name = ""; + DeleteChannelRequest.prototype.name = ""; /** - * Creates a new GetTriggerRequest instance using the specified properties. + * DeleteChannelRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest + * @instance + */ + DeleteChannelRequest.prototype.validateOnly = false; + + /** + * Creates a new DeleteChannelRequest instance using the specified properties. * @function create - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @static - * @param {google.cloud.eventarc.v1.IGetTriggerRequest=} [properties] Properties to set - * @returns {google.cloud.eventarc.v1.GetTriggerRequest} GetTriggerRequest instance + * @param {google.cloud.eventarc.v1.IDeleteChannelRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.DeleteChannelRequest} DeleteChannelRequest instance */ - GetTriggerRequest.create = function create(properties) { - return new GetTriggerRequest(properties); + DeleteChannelRequest.create = function create(properties) { + return new DeleteChannelRequest(properties); }; /** - * Encodes the specified GetTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.GetTriggerRequest.verify|verify} messages. + * Encodes the specified DeleteChannelRequest message. Does not implicitly {@link google.cloud.eventarc.v1.DeleteChannelRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @static - * @param {google.cloud.eventarc.v1.IGetTriggerRequest} message GetTriggerRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.IDeleteChannelRequest} message DeleteChannelRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetTriggerRequest.encode = function encode(message, writer) { + DeleteChannelRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.validateOnly); return writer; }; /** - * Encodes the specified GetTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GetTriggerRequest.verify|verify} messages. + * Encodes the specified DeleteChannelRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.DeleteChannelRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @static - * @param {google.cloud.eventarc.v1.IGetTriggerRequest} message GetTriggerRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.IDeleteChannelRequest} message DeleteChannelRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GetTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + DeleteChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GetTriggerRequest message from the specified reader or buffer. + * Decodes a DeleteChannelRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.eventarc.v1.GetTriggerRequest} GetTriggerRequest + * @returns {google.cloud.eventarc.v1.DeleteChannelRequest} DeleteChannelRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetTriggerRequest.decode = function decode(reader, length) { + DeleteChannelRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.GetTriggerRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.DeleteChannelRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.name = reader.string(); break; + case 2: + message.validateOnly = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -370,110 +4101,116 @@ }; /** - * Decodes a GetTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteChannelRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.eventarc.v1.GetTriggerRequest} GetTriggerRequest + * @returns {google.cloud.eventarc.v1.DeleteChannelRequest} DeleteChannelRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GetTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + DeleteChannelRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GetTriggerRequest message. + * Verifies a DeleteChannelRequest message. * @function verify - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GetTriggerRequest.verify = function verify(message) { + DeleteChannelRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; return null; }; /** - * Creates a GetTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteChannelRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.eventarc.v1.GetTriggerRequest} GetTriggerRequest + * @returns {google.cloud.eventarc.v1.DeleteChannelRequest} DeleteChannelRequest */ - GetTriggerRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.eventarc.v1.GetTriggerRequest) + DeleteChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.DeleteChannelRequest) return object; - var message = new $root.google.cloud.eventarc.v1.GetTriggerRequest(); + var message = new $root.google.cloud.eventarc.v1.DeleteChannelRequest(); if (object.name != null) message.name = String(object.name); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); return message; }; /** - * Creates a plain object from a GetTriggerRequest message. Also converts values to other types if specified. + * Creates a plain object from a DeleteChannelRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @static - * @param {google.cloud.eventarc.v1.GetTriggerRequest} message GetTriggerRequest + * @param {google.cloud.eventarc.v1.DeleteChannelRequest} message DeleteChannelRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GetTriggerRequest.toObject = function toObject(message, options) { + DeleteChannelRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.validateOnly = false; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; return object; }; /** - * Converts this GetTriggerRequest to JSON. + * Converts this DeleteChannelRequest to JSON. * @function toJSON - * @memberof google.cloud.eventarc.v1.GetTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelRequest * @instance * @returns {Object.} JSON object */ - GetTriggerRequest.prototype.toJSON = function toJSON() { + DeleteChannelRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GetTriggerRequest; + return DeleteChannelRequest; })(); - v1.ListTriggersRequest = (function() { + v1.GetChannelConnectionRequest = (function() { /** - * Properties of a ListTriggersRequest. + * Properties of a GetChannelConnectionRequest. * @memberof google.cloud.eventarc.v1 - * @interface IListTriggersRequest - * @property {string|null} [parent] ListTriggersRequest parent - * @property {number|null} [pageSize] ListTriggersRequest pageSize - * @property {string|null} [pageToken] ListTriggersRequest pageToken - * @property {string|null} [orderBy] ListTriggersRequest orderBy + * @interface IGetChannelConnectionRequest + * @property {string|null} [name] GetChannelConnectionRequest name */ /** - * Constructs a new ListTriggersRequest. + * Constructs a new GetChannelConnectionRequest. * @memberof google.cloud.eventarc.v1 - * @classdesc Represents a ListTriggersRequest. - * @implements IListTriggersRequest + * @classdesc Represents a GetChannelConnectionRequest. + * @implements IGetChannelConnectionRequest * @constructor - * @param {google.cloud.eventarc.v1.IListTriggersRequest=} [properties] Properties to set + * @param {google.cloud.eventarc.v1.IGetChannelConnectionRequest=} [properties] Properties to set */ - function ListTriggersRequest(properties) { + function GetChannelConnectionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -481,114 +4218,75 @@ } /** - * ListTriggersRequest parent. - * @member {string} parent - * @memberof google.cloud.eventarc.v1.ListTriggersRequest - * @instance - */ - ListTriggersRequest.prototype.parent = ""; - - /** - * ListTriggersRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.eventarc.v1.ListTriggersRequest - * @instance - */ - ListTriggersRequest.prototype.pageSize = 0; - - /** - * ListTriggersRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.eventarc.v1.ListTriggersRequest - * @instance - */ - ListTriggersRequest.prototype.pageToken = ""; - - /** - * ListTriggersRequest orderBy. - * @member {string} orderBy - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * GetChannelConnectionRequest name. + * @member {string} name + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @instance */ - ListTriggersRequest.prototype.orderBy = ""; + GetChannelConnectionRequest.prototype.name = ""; /** - * Creates a new ListTriggersRequest instance using the specified properties. + * Creates a new GetChannelConnectionRequest instance using the specified properties. * @function create - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IListTriggersRequest=} [properties] Properties to set - * @returns {google.cloud.eventarc.v1.ListTriggersRequest} ListTriggersRequest instance + * @param {google.cloud.eventarc.v1.IGetChannelConnectionRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.GetChannelConnectionRequest} GetChannelConnectionRequest instance */ - ListTriggersRequest.create = function create(properties) { - return new ListTriggersRequest(properties); + GetChannelConnectionRequest.create = function create(properties) { + return new GetChannelConnectionRequest(properties); }; /** - * Encodes the specified ListTriggersRequest message. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersRequest.verify|verify} messages. + * Encodes the specified GetChannelConnectionRequest message. Does not implicitly {@link google.cloud.eventarc.v1.GetChannelConnectionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IListTriggersRequest} message ListTriggersRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.IGetChannelConnectionRequest} message GetChannelConnectionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTriggersRequest.encode = function encode(message, writer) { + GetChannelConnectionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.orderBy); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified ListTriggersRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersRequest.verify|verify} messages. + * Encodes the specified GetChannelConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GetChannelConnectionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IListTriggersRequest} message ListTriggersRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.IGetChannelConnectionRequest} message GetChannelConnectionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTriggersRequest.encodeDelimited = function encodeDelimited(message, writer) { + GetChannelConnectionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListTriggersRequest message from the specified reader or buffer. + * Decodes a GetChannelConnectionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.eventarc.v1.ListTriggersRequest} ListTriggersRequest + * @returns {google.cloud.eventarc.v1.GetChannelConnectionRequest} GetChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListTriggersRequest.decode = function decode(reader, length) { + GetChannelConnectionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ListTriggersRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.GetChannelConnectionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; - case 4: - message.orderBy = reader.string(); + message.name = reader.string(); break; default: reader.skipType(tag & 7); @@ -599,136 +4297,109 @@ }; /** - * Decodes a ListTriggersRequest message from the specified reader or buffer, length delimited. + * Decodes a GetChannelConnectionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.eventarc.v1.ListTriggersRequest} ListTriggersRequest + * @returns {google.cloud.eventarc.v1.GetChannelConnectionRequest} GetChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListTriggersRequest.decodeDelimited = function decodeDelimited(reader) { + GetChannelConnectionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListTriggersRequest message. + * Verifies a GetChannelConnectionRequest message. * @function verify - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListTriggersRequest.verify = function verify(message) { + GetChannelConnectionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - if (!$util.isString(message.orderBy)) - return "orderBy: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a ListTriggersRequest message from a plain object. Also converts values to their respective internal types. + * Creates a GetChannelConnectionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.eventarc.v1.ListTriggersRequest} ListTriggersRequest + * @returns {google.cloud.eventarc.v1.GetChannelConnectionRequest} GetChannelConnectionRequest */ - ListTriggersRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.eventarc.v1.ListTriggersRequest) + GetChannelConnectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.GetChannelConnectionRequest) return object; - var message = new $root.google.cloud.eventarc.v1.ListTriggersRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.orderBy != null) - message.orderBy = String(object.orderBy); + var message = new $root.google.cloud.eventarc.v1.GetChannelConnectionRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a ListTriggersRequest message. Also converts values to other types if specified. + * Creates a plain object from a GetChannelConnectionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.ListTriggersRequest} message ListTriggersRequest + * @param {google.cloud.eventarc.v1.GetChannelConnectionRequest} message GetChannelConnectionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListTriggersRequest.toObject = function toObject(message, options) { + GetChannelConnectionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.orderBy = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.orderBy != null && message.hasOwnProperty("orderBy")) - object.orderBy = message.orderBy; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this ListTriggersRequest to JSON. + * Converts this GetChannelConnectionRequest to JSON. * @function toJSON - * @memberof google.cloud.eventarc.v1.ListTriggersRequest + * @memberof google.cloud.eventarc.v1.GetChannelConnectionRequest * @instance * @returns {Object.} JSON object */ - ListTriggersRequest.prototype.toJSON = function toJSON() { + GetChannelConnectionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListTriggersRequest; + return GetChannelConnectionRequest; })(); - v1.ListTriggersResponse = (function() { + v1.ListChannelConnectionsRequest = (function() { /** - * Properties of a ListTriggersResponse. + * Properties of a ListChannelConnectionsRequest. * @memberof google.cloud.eventarc.v1 - * @interface IListTriggersResponse - * @property {Array.|null} [triggers] ListTriggersResponse triggers - * @property {string|null} [nextPageToken] ListTriggersResponse nextPageToken - * @property {Array.|null} [unreachable] ListTriggersResponse unreachable + * @interface IListChannelConnectionsRequest + * @property {string|null} [parent] ListChannelConnectionsRequest parent + * @property {number|null} [pageSize] ListChannelConnectionsRequest pageSize + * @property {string|null} [pageToken] ListChannelConnectionsRequest pageToken */ /** - * Constructs a new ListTriggersResponse. + * Constructs a new ListChannelConnectionsRequest. * @memberof google.cloud.eventarc.v1 - * @classdesc Represents a ListTriggersResponse. - * @implements IListTriggersResponse + * @classdesc Represents a ListChannelConnectionsRequest. + * @implements IListChannelConnectionsRequest * @constructor - * @param {google.cloud.eventarc.v1.IListTriggersResponse=} [properties] Properties to set + * @param {google.cloud.eventarc.v1.IListChannelConnectionsRequest=} [properties] Properties to set */ - function ListTriggersResponse(properties) { - this.triggers = []; - this.unreachable = []; + function ListChannelConnectionsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -736,107 +4407,101 @@ } /** - * ListTriggersResponse triggers. - * @member {Array.} triggers - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * ListChannelConnectionsRequest parent. + * @member {string} parent + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @instance */ - ListTriggersResponse.prototype.triggers = $util.emptyArray; + ListChannelConnectionsRequest.prototype.parent = ""; /** - * ListTriggersResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * ListChannelConnectionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @instance */ - ListTriggersResponse.prototype.nextPageToken = ""; + ListChannelConnectionsRequest.prototype.pageSize = 0; /** - * ListTriggersResponse unreachable. - * @member {Array.} unreachable - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * ListChannelConnectionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @instance */ - ListTriggersResponse.prototype.unreachable = $util.emptyArray; + ListChannelConnectionsRequest.prototype.pageToken = ""; /** - * Creates a new ListTriggersResponse instance using the specified properties. + * Creates a new ListChannelConnectionsRequest instance using the specified properties. * @function create - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @static - * @param {google.cloud.eventarc.v1.IListTriggersResponse=} [properties] Properties to set - * @returns {google.cloud.eventarc.v1.ListTriggersResponse} ListTriggersResponse instance + * @param {google.cloud.eventarc.v1.IListChannelConnectionsRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.ListChannelConnectionsRequest} ListChannelConnectionsRequest instance */ - ListTriggersResponse.create = function create(properties) { - return new ListTriggersResponse(properties); + ListChannelConnectionsRequest.create = function create(properties) { + return new ListChannelConnectionsRequest(properties); }; /** - * Encodes the specified ListTriggersResponse message. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersResponse.verify|verify} messages. + * Encodes the specified ListChannelConnectionsRequest message. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelConnectionsRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @static - * @param {google.cloud.eventarc.v1.IListTriggersResponse} message ListTriggersResponse message or plain object to encode + * @param {google.cloud.eventarc.v1.IListChannelConnectionsRequest} message ListChannelConnectionsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTriggersResponse.encode = function encode(message, writer) { + ListChannelConnectionsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.triggers != null && message.triggers.length) - for (var i = 0; i < message.triggers.length; ++i) - $root.google.cloud.eventarc.v1.Trigger.encode(message.triggers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - if (message.unreachable != null && message.unreachable.length) - for (var i = 0; i < message.unreachable.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); return writer; }; /** - * Encodes the specified ListTriggersResponse message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListTriggersResponse.verify|verify} messages. + * Encodes the specified ListChannelConnectionsRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelConnectionsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @static - * @param {google.cloud.eventarc.v1.IListTriggersResponse} message ListTriggersResponse message or plain object to encode + * @param {google.cloud.eventarc.v1.IListChannelConnectionsRequest} message ListChannelConnectionsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ListTriggersResponse.encodeDelimited = function encodeDelimited(message, writer) { + ListChannelConnectionsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ListTriggersResponse message from the specified reader or buffer. + * Decodes a ListChannelConnectionsRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.eventarc.v1.ListTriggersResponse} ListTriggersResponse + * @returns {google.cloud.eventarc.v1.ListChannelConnectionsRequest} ListChannelConnectionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListTriggersResponse.decode = function decode(reader, length) { + ListChannelConnectionsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ListTriggersResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ListChannelConnectionsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.triggers && message.triggers.length)) - message.triggers = []; - message.triggers.push($root.google.cloud.eventarc.v1.Trigger.decode(reader, reader.uint32())); + message.parent = reader.string(); break; case 2: - message.nextPageToken = reader.string(); + message.pageSize = reader.int32(); break; case 3: - if (!(message.unreachable && message.unreachable.length)) - message.unreachable = []; - message.unreachable.push(reader.string()); + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -847,157 +4512,128 @@ }; /** - * Decodes a ListTriggersResponse message from the specified reader or buffer, length delimited. + * Decodes a ListChannelConnectionsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.eventarc.v1.ListTriggersResponse} ListTriggersResponse + * @returns {google.cloud.eventarc.v1.ListChannelConnectionsRequest} ListChannelConnectionsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ListTriggersResponse.decodeDelimited = function decodeDelimited(reader) { + ListChannelConnectionsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ListTriggersResponse message. + * Verifies a ListChannelConnectionsRequest message. * @function verify - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ListTriggersResponse.verify = function verify(message) { + ListChannelConnectionsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.triggers != null && message.hasOwnProperty("triggers")) { - if (!Array.isArray(message.triggers)) - return "triggers: array expected"; - for (var i = 0; i < message.triggers.length; ++i) { - var error = $root.google.cloud.eventarc.v1.Trigger.verify(message.triggers[i]); - if (error) - return "triggers." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.unreachable != null && message.hasOwnProperty("unreachable")) { - if (!Array.isArray(message.unreachable)) - return "unreachable: array expected"; - for (var i = 0; i < message.unreachable.length; ++i) - if (!$util.isString(message.unreachable[i])) - return "unreachable: string[] expected"; - } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates a ListTriggersResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ListChannelConnectionsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.eventarc.v1.ListTriggersResponse} ListTriggersResponse + * @returns {google.cloud.eventarc.v1.ListChannelConnectionsRequest} ListChannelConnectionsRequest */ - ListTriggersResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.eventarc.v1.ListTriggersResponse) + ListChannelConnectionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.ListChannelConnectionsRequest) return object; - var message = new $root.google.cloud.eventarc.v1.ListTriggersResponse(); - if (object.triggers) { - if (!Array.isArray(object.triggers)) - throw TypeError(".google.cloud.eventarc.v1.ListTriggersResponse.triggers: array expected"); - message.triggers = []; - for (var i = 0; i < object.triggers.length; ++i) { - if (typeof object.triggers[i] !== "object") - throw TypeError(".google.cloud.eventarc.v1.ListTriggersResponse.triggers: object expected"); - message.triggers[i] = $root.google.cloud.eventarc.v1.Trigger.fromObject(object.triggers[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.unreachable) { - if (!Array.isArray(object.unreachable)) - throw TypeError(".google.cloud.eventarc.v1.ListTriggersResponse.unreachable: array expected"); - message.unreachable = []; - for (var i = 0; i < object.unreachable.length; ++i) - message.unreachable[i] = String(object.unreachable[i]); - } + var message = new $root.google.cloud.eventarc.v1.ListChannelConnectionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); return message; }; /** - * Creates a plain object from a ListTriggersResponse message. Also converts values to other types if specified. + * Creates a plain object from a ListChannelConnectionsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @static - * @param {google.cloud.eventarc.v1.ListTriggersResponse} message ListTriggersResponse + * @param {google.cloud.eventarc.v1.ListChannelConnectionsRequest} message ListChannelConnectionsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ListTriggersResponse.toObject = function toObject(message, options) { + ListChannelConnectionsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.triggers = []; - object.unreachable = []; - } - if (options.defaults) - object.nextPageToken = ""; - if (message.triggers && message.triggers.length) { - object.triggers = []; - for (var j = 0; j < message.triggers.length; ++j) - object.triggers[j] = $root.google.cloud.eventarc.v1.Trigger.toObject(message.triggers[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.unreachable && message.unreachable.length) { - object.unreachable = []; - for (var j = 0; j < message.unreachable.length; ++j) - object.unreachable[j] = message.unreachable[j]; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; return object; }; /** - * Converts this ListTriggersResponse to JSON. + * Converts this ListChannelConnectionsRequest to JSON. * @function toJSON - * @memberof google.cloud.eventarc.v1.ListTriggersResponse + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsRequest * @instance * @returns {Object.} JSON object */ - ListTriggersResponse.prototype.toJSON = function toJSON() { + ListChannelConnectionsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ListTriggersResponse; + return ListChannelConnectionsRequest; })(); - v1.CreateTriggerRequest = (function() { + v1.ListChannelConnectionsResponse = (function() { /** - * Properties of a CreateTriggerRequest. + * Properties of a ListChannelConnectionsResponse. * @memberof google.cloud.eventarc.v1 - * @interface ICreateTriggerRequest - * @property {string|null} [parent] CreateTriggerRequest parent - * @property {google.cloud.eventarc.v1.ITrigger|null} [trigger] CreateTriggerRequest trigger - * @property {string|null} [triggerId] CreateTriggerRequest triggerId - * @property {boolean|null} [validateOnly] CreateTriggerRequest validateOnly + * @interface IListChannelConnectionsResponse + * @property {Array.|null} [channelConnections] ListChannelConnectionsResponse channelConnections + * @property {string|null} [nextPageToken] ListChannelConnectionsResponse nextPageToken + * @property {Array.|null} [unreachable] ListChannelConnectionsResponse unreachable */ /** - * Constructs a new CreateTriggerRequest. + * Constructs a new ListChannelConnectionsResponse. * @memberof google.cloud.eventarc.v1 - * @classdesc Represents a CreateTriggerRequest. - * @implements ICreateTriggerRequest + * @classdesc Represents a ListChannelConnectionsResponse. + * @implements IListChannelConnectionsResponse * @constructor - * @param {google.cloud.eventarc.v1.ICreateTriggerRequest=} [properties] Properties to set + * @param {google.cloud.eventarc.v1.IListChannelConnectionsResponse=} [properties] Properties to set */ - function CreateTriggerRequest(properties) { + function ListChannelConnectionsResponse(properties) { + this.channelConnections = []; + this.unreachable = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1005,114 +4641,107 @@ } /** - * CreateTriggerRequest parent. - * @member {string} parent - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest - * @instance - */ - CreateTriggerRequest.prototype.parent = ""; - - /** - * CreateTriggerRequest trigger. - * @member {google.cloud.eventarc.v1.ITrigger|null|undefined} trigger - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * ListChannelConnectionsResponse channelConnections. + * @member {Array.} channelConnections + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @instance */ - CreateTriggerRequest.prototype.trigger = null; + ListChannelConnectionsResponse.prototype.channelConnections = $util.emptyArray; /** - * CreateTriggerRequest triggerId. - * @member {string} triggerId - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * ListChannelConnectionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @instance */ - CreateTriggerRequest.prototype.triggerId = ""; + ListChannelConnectionsResponse.prototype.nextPageToken = ""; /** - * CreateTriggerRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * ListChannelConnectionsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @instance */ - CreateTriggerRequest.prototype.validateOnly = false; + ListChannelConnectionsResponse.prototype.unreachable = $util.emptyArray; /** - * Creates a new CreateTriggerRequest instance using the specified properties. + * Creates a new ListChannelConnectionsResponse instance using the specified properties. * @function create - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @static - * @param {google.cloud.eventarc.v1.ICreateTriggerRequest=} [properties] Properties to set - * @returns {google.cloud.eventarc.v1.CreateTriggerRequest} CreateTriggerRequest instance + * @param {google.cloud.eventarc.v1.IListChannelConnectionsResponse=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.ListChannelConnectionsResponse} ListChannelConnectionsResponse instance */ - CreateTriggerRequest.create = function create(properties) { - return new CreateTriggerRequest(properties); + ListChannelConnectionsResponse.create = function create(properties) { + return new ListChannelConnectionsResponse(properties); }; /** - * Encodes the specified CreateTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.CreateTriggerRequest.verify|verify} messages. + * Encodes the specified ListChannelConnectionsResponse message. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelConnectionsResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @static - * @param {google.cloud.eventarc.v1.ICreateTriggerRequest} message CreateTriggerRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.IListChannelConnectionsResponse} message ListChannelConnectionsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateTriggerRequest.encode = function encode(message, writer) { + ListChannelConnectionsResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) - $root.google.cloud.eventarc.v1.Trigger.encode(message.trigger, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.triggerId != null && Object.hasOwnProperty.call(message, "triggerId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.triggerId); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.channelConnections != null && message.channelConnections.length) + for (var i = 0; i < message.channelConnections.length; ++i) + $root.google.cloud.eventarc.v1.ChannelConnection.encode(message.channelConnections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); return writer; }; /** - * Encodes the specified CreateTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.CreateTriggerRequest.verify|verify} messages. + * Encodes the specified ListChannelConnectionsResponse message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.ListChannelConnectionsResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @static - * @param {google.cloud.eventarc.v1.ICreateTriggerRequest} message CreateTriggerRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.IListChannelConnectionsResponse} message ListChannelConnectionsResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CreateTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + ListChannelConnectionsResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CreateTriggerRequest message from the specified reader or buffer. + * Decodes a ListChannelConnectionsResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.eventarc.v1.CreateTriggerRequest} CreateTriggerRequest + * @returns {google.cloud.eventarc.v1.ListChannelConnectionsResponse} ListChannelConnectionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateTriggerRequest.decode = function decode(reader, length) { + ListChannelConnectionsResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.CreateTriggerRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.ListChannelConnectionsResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.parent = reader.string(); + if (!(message.channelConnections && message.channelConnections.length)) + message.channelConnections = []; + message.channelConnections.push($root.google.cloud.eventarc.v1.ChannelConnection.decode(reader, reader.uint32())); break; case 2: - message.trigger = $root.google.cloud.eventarc.v1.Trigger.decode(reader, reader.uint32()); + message.nextPageToken = reader.string(); break; case 3: - message.triggerId = reader.string(); - break; - case 4: - message.validateOnly = reader.bool(); + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); break; default: reader.skipType(tag & 7); @@ -1123,140 +4752,156 @@ }; /** - * Decodes a CreateTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a ListChannelConnectionsResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.eventarc.v1.CreateTriggerRequest} CreateTriggerRequest + * @returns {google.cloud.eventarc.v1.ListChannelConnectionsResponse} ListChannelConnectionsResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CreateTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + ListChannelConnectionsResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CreateTriggerRequest message. + * Verifies a ListChannelConnectionsResponse message. * @function verify - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CreateTriggerRequest.verify = function verify(message) { + ListChannelConnectionsResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.trigger != null && message.hasOwnProperty("trigger")) { - var error = $root.google.cloud.eventarc.v1.Trigger.verify(message.trigger); - if (error) - return "trigger." + error; + if (message.channelConnections != null && message.hasOwnProperty("channelConnections")) { + if (!Array.isArray(message.channelConnections)) + return "channelConnections: array expected"; + for (var i = 0; i < message.channelConnections.length; ++i) { + var error = $root.google.cloud.eventarc.v1.ChannelConnection.verify(message.channelConnections[i]); + if (error) + return "channelConnections." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; } - if (message.triggerId != null && message.hasOwnProperty("triggerId")) - if (!$util.isString(message.triggerId)) - return "triggerId: string expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; return null; }; /** - * Creates a CreateTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ListChannelConnectionsResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.eventarc.v1.CreateTriggerRequest} CreateTriggerRequest + * @returns {google.cloud.eventarc.v1.ListChannelConnectionsResponse} ListChannelConnectionsResponse */ - CreateTriggerRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.eventarc.v1.CreateTriggerRequest) + ListChannelConnectionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.ListChannelConnectionsResponse) return object; - var message = new $root.google.cloud.eventarc.v1.CreateTriggerRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.trigger != null) { - if (typeof object.trigger !== "object") - throw TypeError(".google.cloud.eventarc.v1.CreateTriggerRequest.trigger: object expected"); - message.trigger = $root.google.cloud.eventarc.v1.Trigger.fromObject(object.trigger); + var message = new $root.google.cloud.eventarc.v1.ListChannelConnectionsResponse(); + if (object.channelConnections) { + if (!Array.isArray(object.channelConnections)) + throw TypeError(".google.cloud.eventarc.v1.ListChannelConnectionsResponse.channelConnections: array expected"); + message.channelConnections = []; + for (var i = 0; i < object.channelConnections.length; ++i) { + if (typeof object.channelConnections[i] !== "object") + throw TypeError(".google.cloud.eventarc.v1.ListChannelConnectionsResponse.channelConnections: object expected"); + message.channelConnections[i] = $root.google.cloud.eventarc.v1.ChannelConnection.fromObject(object.channelConnections[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.eventarc.v1.ListChannelConnectionsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); } - if (object.triggerId != null) - message.triggerId = String(object.triggerId); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); return message; }; /** - * Creates a plain object from a CreateTriggerRequest message. Also converts values to other types if specified. + * Creates a plain object from a ListChannelConnectionsResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @static - * @param {google.cloud.eventarc.v1.CreateTriggerRequest} message CreateTriggerRequest + * @param {google.cloud.eventarc.v1.ListChannelConnectionsResponse} message ListChannelConnectionsResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CreateTriggerRequest.toObject = function toObject(message, options) { + ListChannelConnectionsResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.parent = ""; - object.trigger = null; - object.triggerId = ""; - object.validateOnly = false; + if (options.arrays || options.defaults) { + object.channelConnections = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.channelConnections && message.channelConnections.length) { + object.channelConnections = []; + for (var j = 0; j < message.channelConnections.length; ++j) + object.channelConnections[j] = $root.google.cloud.eventarc.v1.ChannelConnection.toObject(message.channelConnections[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.trigger != null && message.hasOwnProperty("trigger")) - object.trigger = $root.google.cloud.eventarc.v1.Trigger.toObject(message.trigger, options); - if (message.triggerId != null && message.hasOwnProperty("triggerId")) - object.triggerId = message.triggerId; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; return object; }; /** - * Converts this CreateTriggerRequest to JSON. + * Converts this ListChannelConnectionsResponse to JSON. * @function toJSON - * @memberof google.cloud.eventarc.v1.CreateTriggerRequest + * @memberof google.cloud.eventarc.v1.ListChannelConnectionsResponse * @instance * @returns {Object.} JSON object */ - CreateTriggerRequest.prototype.toJSON = function toJSON() { + ListChannelConnectionsResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CreateTriggerRequest; + return ListChannelConnectionsResponse; })(); - v1.UpdateTriggerRequest = (function() { + v1.CreateChannelConnectionRequest = (function() { /** - * Properties of an UpdateTriggerRequest. + * Properties of a CreateChannelConnectionRequest. * @memberof google.cloud.eventarc.v1 - * @interface IUpdateTriggerRequest - * @property {google.cloud.eventarc.v1.ITrigger|null} [trigger] UpdateTriggerRequest trigger - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateTriggerRequest updateMask - * @property {boolean|null} [allowMissing] UpdateTriggerRequest allowMissing - * @property {boolean|null} [validateOnly] UpdateTriggerRequest validateOnly + * @interface ICreateChannelConnectionRequest + * @property {string|null} [parent] CreateChannelConnectionRequest parent + * @property {google.cloud.eventarc.v1.IChannelConnection|null} [channelConnection] CreateChannelConnectionRequest channelConnection + * @property {string|null} [channelConnectionId] CreateChannelConnectionRequest channelConnectionId */ /** - * Constructs a new UpdateTriggerRequest. + * Constructs a new CreateChannelConnectionRequest. * @memberof google.cloud.eventarc.v1 - * @classdesc Represents an UpdateTriggerRequest. - * @implements IUpdateTriggerRequest + * @classdesc Represents a CreateChannelConnectionRequest. + * @implements ICreateChannelConnectionRequest * @constructor - * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest=} [properties] Properties to set + * @param {google.cloud.eventarc.v1.ICreateChannelConnectionRequest=} [properties] Properties to set */ - function UpdateTriggerRequest(properties) { + function CreateChannelConnectionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1264,114 +4909,101 @@ } /** - * UpdateTriggerRequest trigger. - * @member {google.cloud.eventarc.v1.ITrigger|null|undefined} trigger - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest - * @instance - */ - UpdateTriggerRequest.prototype.trigger = null; - - /** - * UpdateTriggerRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * CreateChannelConnectionRequest parent. + * @member {string} parent + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @instance */ - UpdateTriggerRequest.prototype.updateMask = null; + CreateChannelConnectionRequest.prototype.parent = ""; /** - * UpdateTriggerRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * CreateChannelConnectionRequest channelConnection. + * @member {google.cloud.eventarc.v1.IChannelConnection|null|undefined} channelConnection + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @instance */ - UpdateTriggerRequest.prototype.allowMissing = false; + CreateChannelConnectionRequest.prototype.channelConnection = null; /** - * UpdateTriggerRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * CreateChannelConnectionRequest channelConnectionId. + * @member {string} channelConnectionId + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @instance */ - UpdateTriggerRequest.prototype.validateOnly = false; + CreateChannelConnectionRequest.prototype.channelConnectionId = ""; /** - * Creates a new UpdateTriggerRequest instance using the specified properties. + * Creates a new CreateChannelConnectionRequest instance using the specified properties. * @function create - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest=} [properties] Properties to set - * @returns {google.cloud.eventarc.v1.UpdateTriggerRequest} UpdateTriggerRequest instance + * @param {google.cloud.eventarc.v1.ICreateChannelConnectionRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.CreateChannelConnectionRequest} CreateChannelConnectionRequest instance */ - UpdateTriggerRequest.create = function create(properties) { - return new UpdateTriggerRequest(properties); + CreateChannelConnectionRequest.create = function create(properties) { + return new CreateChannelConnectionRequest(properties); }; /** - * Encodes the specified UpdateTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.UpdateTriggerRequest.verify|verify} messages. + * Encodes the specified CreateChannelConnectionRequest message. Does not implicitly {@link google.cloud.eventarc.v1.CreateChannelConnectionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest} message UpdateTriggerRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.ICreateChannelConnectionRequest} message CreateChannelConnectionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateTriggerRequest.encode = function encode(message, writer) { + CreateChannelConnectionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) - $root.google.cloud.eventarc.v1.Trigger.encode(message.trigger, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.channelConnection != null && Object.hasOwnProperty.call(message, "channelConnection")) + $root.google.cloud.eventarc.v1.ChannelConnection.encode(message.channelConnection, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.channelConnectionId != null && Object.hasOwnProperty.call(message, "channelConnectionId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.channelConnectionId); return writer; }; /** - * Encodes the specified UpdateTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.UpdateTriggerRequest.verify|verify} messages. + * Encodes the specified CreateChannelConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.CreateChannelConnectionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IUpdateTriggerRequest} message UpdateTriggerRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.ICreateChannelConnectionRequest} message CreateChannelConnectionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UpdateTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + CreateChannelConnectionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UpdateTriggerRequest message from the specified reader or buffer. + * Decodes a CreateChannelConnectionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.eventarc.v1.UpdateTriggerRequest} UpdateTriggerRequest + * @returns {google.cloud.eventarc.v1.CreateChannelConnectionRequest} CreateChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateTriggerRequest.decode = function decode(reader, length) { + CreateChannelConnectionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.UpdateTriggerRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.CreateChannelConnectionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.trigger = $root.google.cloud.eventarc.v1.Trigger.decode(reader, reader.uint32()); + message.parent = reader.string(); break; case 2: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + message.channelConnection = $root.google.cloud.eventarc.v1.ChannelConnection.decode(reader, reader.uint32()); break; case 3: - message.allowMissing = reader.bool(); - break; - case 4: - message.validateOnly = reader.bool(); + message.channelConnectionId = reader.string(); break; default: reader.skipType(tag & 7); @@ -1382,145 +5014,129 @@ }; /** - * Decodes an UpdateTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a CreateChannelConnectionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.eventarc.v1.UpdateTriggerRequest} UpdateTriggerRequest + * @returns {google.cloud.eventarc.v1.CreateChannelConnectionRequest} CreateChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UpdateTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + CreateChannelConnectionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an UpdateTriggerRequest message. + * Verifies a CreateChannelConnectionRequest message. * @function verify - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UpdateTriggerRequest.verify = function verify(message) { + CreateChannelConnectionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.trigger != null && message.hasOwnProperty("trigger")) { - var error = $root.google.cloud.eventarc.v1.Trigger.verify(message.trigger); - if (error) - return "trigger." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.channelConnection != null && message.hasOwnProperty("channelConnection")) { + var error = $root.google.cloud.eventarc.v1.ChannelConnection.verify(message.channelConnection); if (error) - return "updateMask." + error; + return "channelConnection." + error; } - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; + if (message.channelConnectionId != null && message.hasOwnProperty("channelConnectionId")) + if (!$util.isString(message.channelConnectionId)) + return "channelConnectionId: string expected"; return null; }; /** - * Creates an UpdateTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CreateChannelConnectionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.eventarc.v1.UpdateTriggerRequest} UpdateTriggerRequest + * @returns {google.cloud.eventarc.v1.CreateChannelConnectionRequest} CreateChannelConnectionRequest */ - UpdateTriggerRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.eventarc.v1.UpdateTriggerRequest) + CreateChannelConnectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.CreateChannelConnectionRequest) return object; - var message = new $root.google.cloud.eventarc.v1.UpdateTriggerRequest(); - if (object.trigger != null) { - if (typeof object.trigger !== "object") - throw TypeError(".google.cloud.eventarc.v1.UpdateTriggerRequest.trigger: object expected"); - message.trigger = $root.google.cloud.eventarc.v1.Trigger.fromObject(object.trigger); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.eventarc.v1.UpdateTriggerRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + var message = new $root.google.cloud.eventarc.v1.CreateChannelConnectionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.channelConnection != null) { + if (typeof object.channelConnection !== "object") + throw TypeError(".google.cloud.eventarc.v1.CreateChannelConnectionRequest.channelConnection: object expected"); + message.channelConnection = $root.google.cloud.eventarc.v1.ChannelConnection.fromObject(object.channelConnection); } - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); + if (object.channelConnectionId != null) + message.channelConnectionId = String(object.channelConnectionId); return message; }; /** - * Creates a plain object from an UpdateTriggerRequest message. Also converts values to other types if specified. + * Creates a plain object from a CreateChannelConnectionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.UpdateTriggerRequest} message UpdateTriggerRequest + * @param {google.cloud.eventarc.v1.CreateChannelConnectionRequest} message CreateChannelConnectionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - UpdateTriggerRequest.toObject = function toObject(message, options) { + CreateChannelConnectionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.trigger = null; - object.updateMask = null; - object.allowMissing = false; - object.validateOnly = false; + object.parent = ""; + object.channelConnection = null; + object.channelConnectionId = ""; } - if (message.trigger != null && message.hasOwnProperty("trigger")) - object.trigger = $root.google.cloud.eventarc.v1.Trigger.toObject(message.trigger, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.channelConnection != null && message.hasOwnProperty("channelConnection")) + object.channelConnection = $root.google.cloud.eventarc.v1.ChannelConnection.toObject(message.channelConnection, options); + if (message.channelConnectionId != null && message.hasOwnProperty("channelConnectionId")) + object.channelConnectionId = message.channelConnectionId; return object; }; /** - * Converts this UpdateTriggerRequest to JSON. + * Converts this CreateChannelConnectionRequest to JSON. * @function toJSON - * @memberof google.cloud.eventarc.v1.UpdateTriggerRequest + * @memberof google.cloud.eventarc.v1.CreateChannelConnectionRequest * @instance * @returns {Object.} JSON object */ - UpdateTriggerRequest.prototype.toJSON = function toJSON() { + CreateChannelConnectionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return UpdateTriggerRequest; + return CreateChannelConnectionRequest; })(); - v1.DeleteTriggerRequest = (function() { + v1.DeleteChannelConnectionRequest = (function() { /** - * Properties of a DeleteTriggerRequest. + * Properties of a DeleteChannelConnectionRequest. * @memberof google.cloud.eventarc.v1 - * @interface IDeleteTriggerRequest - * @property {string|null} [name] DeleteTriggerRequest name - * @property {string|null} [etag] DeleteTriggerRequest etag - * @property {boolean|null} [allowMissing] DeleteTriggerRequest allowMissing - * @property {boolean|null} [validateOnly] DeleteTriggerRequest validateOnly + * @interface IDeleteChannelConnectionRequest + * @property {string|null} [name] DeleteChannelConnectionRequest name */ /** - * Constructs a new DeleteTriggerRequest. + * Constructs a new DeleteChannelConnectionRequest. * @memberof google.cloud.eventarc.v1 - * @classdesc Represents a DeleteTriggerRequest. - * @implements IDeleteTriggerRequest + * @classdesc Represents a DeleteChannelConnectionRequest. + * @implements IDeleteChannelConnectionRequest * @constructor - * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest=} [properties] Properties to set + * @param {google.cloud.eventarc.v1.IDeleteChannelConnectionRequest=} [properties] Properties to set */ - function DeleteTriggerRequest(properties) { + function DeleteChannelConnectionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1528,115 +5144,76 @@ } /** - * DeleteTriggerRequest name. + * DeleteChannelConnectionRequest name. * @member {string} name - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest - * @instance - */ - DeleteTriggerRequest.prototype.name = ""; - - /** - * DeleteTriggerRequest etag. - * @member {string} etag - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest - * @instance - */ - DeleteTriggerRequest.prototype.etag = ""; - - /** - * DeleteTriggerRequest allowMissing. - * @member {boolean} allowMissing - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest - * @instance - */ - DeleteTriggerRequest.prototype.allowMissing = false; - - /** - * DeleteTriggerRequest validateOnly. - * @member {boolean} validateOnly - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @instance */ - DeleteTriggerRequest.prototype.validateOnly = false; + DeleteChannelConnectionRequest.prototype.name = ""; /** - * Creates a new DeleteTriggerRequest instance using the specified properties. + * Creates a new DeleteChannelConnectionRequest instance using the specified properties. * @function create - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest=} [properties] Properties to set - * @returns {google.cloud.eventarc.v1.DeleteTriggerRequest} DeleteTriggerRequest instance + * @param {google.cloud.eventarc.v1.IDeleteChannelConnectionRequest=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.DeleteChannelConnectionRequest} DeleteChannelConnectionRequest instance */ - DeleteTriggerRequest.create = function create(properties) { - return new DeleteTriggerRequest(properties); + DeleteChannelConnectionRequest.create = function create(properties) { + return new DeleteChannelConnectionRequest(properties); }; /** - * Encodes the specified DeleteTriggerRequest message. Does not implicitly {@link google.cloud.eventarc.v1.DeleteTriggerRequest.verify|verify} messages. + * Encodes the specified DeleteChannelConnectionRequest message. Does not implicitly {@link google.cloud.eventarc.v1.DeleteChannelConnectionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest} message DeleteTriggerRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.IDeleteChannelConnectionRequest} message DeleteChannelConnectionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteTriggerRequest.encode = function encode(message, writer) { + DeleteChannelConnectionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.etag); - if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); - if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); return writer; }; /** - * Encodes the specified DeleteTriggerRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.DeleteTriggerRequest.verify|verify} messages. + * Encodes the specified DeleteChannelConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.DeleteChannelConnectionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.IDeleteTriggerRequest} message DeleteTriggerRequest message or plain object to encode + * @param {google.cloud.eventarc.v1.IDeleteChannelConnectionRequest} message DeleteChannelConnectionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DeleteTriggerRequest.encodeDelimited = function encodeDelimited(message, writer) { + DeleteChannelConnectionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DeleteTriggerRequest message from the specified reader or buffer. + * Decodes a DeleteChannelConnectionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.eventarc.v1.DeleteTriggerRequest} DeleteTriggerRequest + * @returns {google.cloud.eventarc.v1.DeleteChannelConnectionRequest} DeleteChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteTriggerRequest.decode = function decode(reader, length) { + DeleteChannelConnectionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.DeleteTriggerRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.DeleteChannelConnectionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.name = reader.string(); break; - case 2: - message.etag = reader.string(); - break; - case 3: - message.allowMissing = reader.bool(); - break; - case 4: - message.validateOnly = reader.bool(); - break; default: reader.skipType(tag & 7); break; @@ -1646,112 +5223,87 @@ }; /** - * Decodes a DeleteTriggerRequest message from the specified reader or buffer, length delimited. + * Decodes a DeleteChannelConnectionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.eventarc.v1.DeleteTriggerRequest} DeleteTriggerRequest + * @returns {google.cloud.eventarc.v1.DeleteChannelConnectionRequest} DeleteChannelConnectionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DeleteTriggerRequest.decodeDelimited = function decodeDelimited(reader) { + DeleteChannelConnectionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DeleteTriggerRequest message. + * Verifies a DeleteChannelConnectionRequest message. * @function verify - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DeleteTriggerRequest.verify = function verify(message) { + DeleteChannelConnectionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; - if (message.etag != null && message.hasOwnProperty("etag")) - if (!$util.isString(message.etag)) - return "etag: string expected"; - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - if (typeof message.allowMissing !== "boolean") - return "allowMissing: boolean expected"; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - if (typeof message.validateOnly !== "boolean") - return "validateOnly: boolean expected"; return null; }; /** - * Creates a DeleteTriggerRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteChannelConnectionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.eventarc.v1.DeleteTriggerRequest} DeleteTriggerRequest + * @returns {google.cloud.eventarc.v1.DeleteChannelConnectionRequest} DeleteChannelConnectionRequest */ - DeleteTriggerRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.eventarc.v1.DeleteTriggerRequest) + DeleteChannelConnectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.DeleteChannelConnectionRequest) return object; - var message = new $root.google.cloud.eventarc.v1.DeleteTriggerRequest(); + var message = new $root.google.cloud.eventarc.v1.DeleteChannelConnectionRequest(); if (object.name != null) message.name = String(object.name); - if (object.etag != null) - message.etag = String(object.etag); - if (object.allowMissing != null) - message.allowMissing = Boolean(object.allowMissing); - if (object.validateOnly != null) - message.validateOnly = Boolean(object.validateOnly); return message; }; /** - * Creates a plain object from a DeleteTriggerRequest message. Also converts values to other types if specified. + * Creates a plain object from a DeleteChannelConnectionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @static - * @param {google.cloud.eventarc.v1.DeleteTriggerRequest} message DeleteTriggerRequest + * @param {google.cloud.eventarc.v1.DeleteChannelConnectionRequest} message DeleteChannelConnectionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DeleteTriggerRequest.toObject = function toObject(message, options) { + DeleteChannelConnectionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.name = ""; - object.etag = ""; - object.allowMissing = false; - object.validateOnly = false; - } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; - if (message.etag != null && message.hasOwnProperty("etag")) - object.etag = message.etag; - if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) - object.allowMissing = message.allowMissing; - if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) - object.validateOnly = message.validateOnly; return object; }; /** - * Converts this DeleteTriggerRequest to JSON. + * Converts this DeleteChannelConnectionRequest to JSON. * @function toJSON - * @memberof google.cloud.eventarc.v1.DeleteTriggerRequest + * @memberof google.cloud.eventarc.v1.DeleteChannelConnectionRequest * @instance * @returns {Object.} JSON object */ - DeleteTriggerRequest.prototype.toJSON = function toJSON() { + DeleteChannelConnectionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DeleteTriggerRequest; + return DeleteChannelConnectionRequest; })(); v1.OperationMetadata = (function() { @@ -2099,6 +5651,7 @@ * @property {google.cloud.eventarc.v1.IDestination|null} [destination] Trigger destination * @property {google.cloud.eventarc.v1.ITransport|null} [transport] Trigger transport * @property {Object.|null} [labels] Trigger labels + * @property {string|null} [channel] Trigger channel * @property {string|null} [etag] Trigger etag */ @@ -2191,6 +5744,14 @@ */ Trigger.prototype.labels = $util.emptyObject; + /** + * Trigger channel. + * @member {string} channel + * @memberof google.cloud.eventarc.v1.Trigger + * @instance + */ + Trigger.prototype.channel = ""; + /** * Trigger etag. * @member {string} etag @@ -2243,6 +5804,8 @@ if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) writer.uint32(/* id 12, wireType 2 =*/98).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.channel != null && Object.hasOwnProperty.call(message, "channel")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.channel); if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) writer.uint32(/* id 99, wireType 2 =*/794).string(message.etag); return writer; @@ -2327,6 +5890,9 @@ } message.labels[key] = value; break; + case 13: + message.channel = reader.string(); + break; case 99: message.etag = reader.string(); break; @@ -2411,6 +5977,9 @@ if (!$util.isString(message.labels[key[i]])) return "labels: string{k:string} expected"; } + if (message.channel != null && message.hasOwnProperty("channel")) + if (!$util.isString(message.channel)) + return "channel: string expected"; if (message.etag != null && message.hasOwnProperty("etag")) if (!$util.isString(message.etag)) return "etag: string expected"; @@ -2472,6 +6041,8 @@ for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) message.labels[keys[i]] = String(object.labels[keys[i]]); } + if (object.channel != null) + message.channel = String(object.channel); if (object.etag != null) message.etag = String(object.etag); return message; @@ -2502,6 +6073,7 @@ object.serviceAccount = ""; object.destination = null; object.transport = null; + object.channel = ""; object.etag = ""; } if (message.name != null && message.hasOwnProperty("name")) @@ -2529,6 +6101,8 @@ for (var j = 0; j < keys2.length; ++j) object.labels[keys2[j]] = message.labels[keys2[j]]; } + if (message.channel != null && message.hasOwnProperty("channel")) + object.channel = message.channel; if (message.etag != null && message.hasOwnProperty("etag")) object.etag = message.etag; return object; @@ -2556,6 +6130,7 @@ * @interface IEventFilter * @property {string|null} [attribute] EventFilter attribute * @property {string|null} [value] EventFilter value + * @property {string|null} [operator] EventFilter operator */ /** @@ -2589,6 +6164,14 @@ */ EventFilter.prototype.value = ""; + /** + * EventFilter operator. + * @member {string} operator + * @memberof google.cloud.eventarc.v1.EventFilter + * @instance + */ + EventFilter.prototype.operator = ""; + /** * Creates a new EventFilter instance using the specified properties. * @function create @@ -2617,6 +6200,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.attribute); if (message.value != null && Object.hasOwnProperty.call(message, "value")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.operator != null && Object.hasOwnProperty.call(message, "operator")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.operator); return writer; }; @@ -2657,6 +6242,9 @@ case 2: message.value = reader.string(); break; + case 3: + message.operator = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -2698,6 +6286,9 @@ if (message.value != null && message.hasOwnProperty("value")) if (!$util.isString(message.value)) return "value: string expected"; + if (message.operator != null && message.hasOwnProperty("operator")) + if (!$util.isString(message.operator)) + return "operator: string expected"; return null; }; @@ -2717,6 +6308,8 @@ message.attribute = String(object.attribute); if (object.value != null) message.value = String(object.value); + if (object.operator != null) + message.operator = String(object.operator); return message; }; @@ -2736,11 +6329,14 @@ if (options.defaults) { object.attribute = ""; object.value = ""; + object.operator = ""; } if (message.attribute != null && message.hasOwnProperty("attribute")) object.attribute = message.attribute; if (message.value != null && message.hasOwnProperty("value")) object.value = message.value; + if (message.operator != null && message.hasOwnProperty("operator")) + object.operator = message.operator; return object; }; @@ -2765,6 +6361,8 @@ * @memberof google.cloud.eventarc.v1 * @interface IDestination * @property {google.cloud.eventarc.v1.ICloudRun|null} [cloudRun] Destination cloudRun + * @property {string|null} [cloudFunction] Destination cloudFunction + * @property {google.cloud.eventarc.v1.IGKE|null} [gke] Destination gke */ /** @@ -2790,17 +6388,33 @@ */ Destination.prototype.cloudRun = null; + /** + * Destination cloudFunction. + * @member {string|null|undefined} cloudFunction + * @memberof google.cloud.eventarc.v1.Destination + * @instance + */ + Destination.prototype.cloudFunction = null; + + /** + * Destination gke. + * @member {google.cloud.eventarc.v1.IGKE|null|undefined} gke + * @memberof google.cloud.eventarc.v1.Destination + * @instance + */ + Destination.prototype.gke = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * Destination descriptor. - * @member {"cloudRun"|undefined} descriptor + * @member {"cloudRun"|"cloudFunction"|"gke"|undefined} descriptor * @memberof google.cloud.eventarc.v1.Destination * @instance */ Object.defineProperty(Destination.prototype, "descriptor", { - get: $util.oneOfGetter($oneOfFields = ["cloudRun"]), + get: $util.oneOfGetter($oneOfFields = ["cloudRun", "cloudFunction", "gke"]), set: $util.oneOfSetter($oneOfFields) }); @@ -2830,6 +6444,10 @@ writer = $Writer.create(); if (message.cloudRun != null && Object.hasOwnProperty.call(message, "cloudRun")) $root.google.cloud.eventarc.v1.CloudRun.encode(message.cloudRun, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.cloudFunction != null && Object.hasOwnProperty.call(message, "cloudFunction")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.cloudFunction); + if (message.gke != null && Object.hasOwnProperty.call(message, "gke")) + $root.google.cloud.eventarc.v1.GKE.encode(message.gke, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -2867,6 +6485,12 @@ case 1: message.cloudRun = $root.google.cloud.eventarc.v1.CloudRun.decode(reader, reader.uint32()); break; + case 2: + message.cloudFunction = reader.string(); + break; + case 3: + message.gke = $root.google.cloud.eventarc.v1.GKE.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -2911,6 +6535,23 @@ return "cloudRun." + error; } } + if (message.cloudFunction != null && message.hasOwnProperty("cloudFunction")) { + if (properties.descriptor === 1) + return "descriptor: multiple values"; + properties.descriptor = 1; + if (!$util.isString(message.cloudFunction)) + return "cloudFunction: string expected"; + } + if (message.gke != null && message.hasOwnProperty("gke")) { + if (properties.descriptor === 1) + return "descriptor: multiple values"; + properties.descriptor = 1; + { + var error = $root.google.cloud.eventarc.v1.GKE.verify(message.gke); + if (error) + return "gke." + error; + } + } return null; }; @@ -2931,6 +6572,13 @@ throw TypeError(".google.cloud.eventarc.v1.Destination.cloudRun: object expected"); message.cloudRun = $root.google.cloud.eventarc.v1.CloudRun.fromObject(object.cloudRun); } + if (object.cloudFunction != null) + message.cloudFunction = String(object.cloudFunction); + if (object.gke != null) { + if (typeof object.gke !== "object") + throw TypeError(".google.cloud.eventarc.v1.Destination.gke: object expected"); + message.gke = $root.google.cloud.eventarc.v1.GKE.fromObject(object.gke); + } return message; }; @@ -2952,6 +6600,16 @@ if (options.oneofs) object.descriptor = "cloudRun"; } + if (message.cloudFunction != null && message.hasOwnProperty("cloudFunction")) { + object.cloudFunction = message.cloudFunction; + if (options.oneofs) + object.descriptor = "cloudFunction"; + } + if (message.gke != null && message.hasOwnProperty("gke")) { + object.gke = $root.google.cloud.eventarc.v1.GKE.toObject(message.gke, options); + if (options.oneofs) + object.descriptor = "gke"; + } return object; }; @@ -3412,6 +7070,282 @@ return CloudRun; })(); + v1.GKE = (function() { + + /** + * Properties of a GKE. + * @memberof google.cloud.eventarc.v1 + * @interface IGKE + * @property {string|null} [cluster] GKE cluster + * @property {string|null} [location] GKE location + * @property {string|null} [namespace] GKE namespace + * @property {string|null} [service] GKE service + * @property {string|null} [path] GKE path + */ + + /** + * Constructs a new GKE. + * @memberof google.cloud.eventarc.v1 + * @classdesc Represents a GKE. + * @implements IGKE + * @constructor + * @param {google.cloud.eventarc.v1.IGKE=} [properties] Properties to set + */ + function GKE(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GKE cluster. + * @member {string} cluster + * @memberof google.cloud.eventarc.v1.GKE + * @instance + */ + GKE.prototype.cluster = ""; + + /** + * GKE location. + * @member {string} location + * @memberof google.cloud.eventarc.v1.GKE + * @instance + */ + GKE.prototype.location = ""; + + /** + * GKE namespace. + * @member {string} namespace + * @memberof google.cloud.eventarc.v1.GKE + * @instance + */ + GKE.prototype.namespace = ""; + + /** + * GKE service. + * @member {string} service + * @memberof google.cloud.eventarc.v1.GKE + * @instance + */ + GKE.prototype.service = ""; + + /** + * GKE path. + * @member {string} path + * @memberof google.cloud.eventarc.v1.GKE + * @instance + */ + GKE.prototype.path = ""; + + /** + * Creates a new GKE instance using the specified properties. + * @function create + * @memberof google.cloud.eventarc.v1.GKE + * @static + * @param {google.cloud.eventarc.v1.IGKE=} [properties] Properties to set + * @returns {google.cloud.eventarc.v1.GKE} GKE instance + */ + GKE.create = function create(properties) { + return new GKE(properties); + }; + + /** + * Encodes the specified GKE message. Does not implicitly {@link google.cloud.eventarc.v1.GKE.verify|verify} messages. + * @function encode + * @memberof google.cloud.eventarc.v1.GKE + * @static + * @param {google.cloud.eventarc.v1.IGKE} message GKE message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GKE.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cluster != null && Object.hasOwnProperty.call(message, "cluster")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.cluster); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.location); + if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.namespace); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.service); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.path); + return writer; + }; + + /** + * Encodes the specified GKE message, length delimited. Does not implicitly {@link google.cloud.eventarc.v1.GKE.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.eventarc.v1.GKE + * @static + * @param {google.cloud.eventarc.v1.IGKE} message GKE message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GKE.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GKE message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.eventarc.v1.GKE + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.eventarc.v1.GKE} GKE + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GKE.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.eventarc.v1.GKE(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cluster = reader.string(); + break; + case 2: + message.location = reader.string(); + break; + case 3: + message.namespace = reader.string(); + break; + case 4: + message.service = reader.string(); + break; + case 5: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GKE message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.eventarc.v1.GKE + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.eventarc.v1.GKE} GKE + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GKE.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GKE message. + * @function verify + * @memberof google.cloud.eventarc.v1.GKE + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GKE.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cluster != null && message.hasOwnProperty("cluster")) + if (!$util.isString(message.cluster)) + return "cluster: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.namespace != null && message.hasOwnProperty("namespace")) + if (!$util.isString(message.namespace)) + return "namespace: string expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a GKE message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.eventarc.v1.GKE + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.eventarc.v1.GKE} GKE + */ + GKE.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.eventarc.v1.GKE) + return object; + var message = new $root.google.cloud.eventarc.v1.GKE(); + if (object.cluster != null) + message.cluster = String(object.cluster); + if (object.location != null) + message.location = String(object.location); + if (object.namespace != null) + message.namespace = String(object.namespace); + if (object.service != null) + message.service = String(object.service); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a GKE message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.eventarc.v1.GKE + * @static + * @param {google.cloud.eventarc.v1.GKE} message GKE + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GKE.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.cluster = ""; + object.location = ""; + object.namespace = ""; + object.service = ""; + object.path = ""; + } + if (message.cluster != null && message.hasOwnProperty("cluster")) + object.cluster = message.cluster; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.namespace != null && message.hasOwnProperty("namespace")) + object.namespace = message.namespace; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this GKE to JSON. + * @function toJSON + * @memberof google.cloud.eventarc.v1.GKE + * @instance + * @returns {Object.} JSON object + */ + GKE.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GKE; + })(); + v1.Pubsub = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index 8cdeb64..dddc33b 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -8,17 +8,153 @@ "nested": { "v1": { "options": { + "csharp_namespace": "Google.Cloud.Eventarc.V1", "go_package": "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc", "java_multiple_files": true, "java_outer_classname": "TriggerProto", "java_package": "com.google.cloud.eventarc.v1", - "csharp_namespace": "Google.Cloud.Eventarc.V1", "php_namespace": "Google\\Cloud\\Eventarc\\V1", "ruby_package": "Google::Cloud::Eventarc::V1", "(google.api.resource_definition).type": "run.googleapis.com/Service", "(google.api.resource_definition).pattern": "*" }, "nested": { + "Channel": { + "options": { + "(google.api.resource).type": "eventarc.googleapis.com/Channel", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/channels/{channel}", + "(google.api.resource).plural": "channels", + "(google.api.resource).singular": "channel" + }, + "oneofs": { + "transport": { + "oneof": [ + "pubsubTopic" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "uid": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "provider": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pubsubTopic": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "State", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "activationToken": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "PENDING": 1, + "ACTIVE": 2, + "INACTIVE": 3 + } + } + } + }, + "ChannelConnection": { + "options": { + "(google.api.resource).type": "eventarc.googleapis.com/ChannelConnection", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/channelConnections/{channel_connection}", + "(google.api.resource).plural": "channelConnections", + "(google.api.resource).singular": "channelConnection" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "uid": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "channel": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Channel" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "activationToken": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } + } + } + }, "Eventarc": { "options": { "(google.api.default_host)": "eventarc.googleapis.com", @@ -117,35 +253,353 @@ } ] }, - "DeleteTrigger": { - "requestType": "DeleteTriggerRequest", - "responseType": "google.longrunning.Operation", + "DeleteTrigger": { + "requestType": "DeleteTriggerRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/triggers/*}", + "(google.api.method_signature)": "name,allow_missing", + "(google.longrunning.operation_info).response_type": "Trigger", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/triggers/*}" + } + }, + { + "(google.api.method_signature)": "name,allow_missing" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Trigger", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "GetChannel": { + "requestType": "GetChannelRequest", + "responseType": "Channel", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/channels/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/channels/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListChannels": { + "requestType": "ListChannelsRequest", + "responseType": "ListChannelsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/channels", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/channels" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "CreateChannel": { + "requestType": "CreateChannelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/channels", + "(google.api.http).body": "channel", + "(google.api.method_signature)": "parent,channel,channel_id", + "(google.longrunning.operation_info).response_type": "Channel", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/channels", + "body": "channel" + } + }, + { + "(google.api.method_signature)": "parent,channel,channel_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Channel", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "UpdateChannel": { + "requestType": "UpdateChannelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{channel.name=projects/*/locations/*/channels/*}", + "(google.api.http).body": "channel", + "(google.api.method_signature)": "channel,update_mask", + "(google.longrunning.operation_info).response_type": "Channel", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{channel.name=projects/*/locations/*/channels/*}", + "body": "channel" + } + }, + { + "(google.api.method_signature)": "channel,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Channel", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteChannel": { + "requestType": "DeleteChannelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/channels/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "Channel", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/channels/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Channel", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "GetChannelConnection": { + "requestType": "GetChannelConnectionRequest", + "responseType": "ChannelConnection", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/channelConnections/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/channelConnections/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListChannelConnections": { + "requestType": "ListChannelConnectionsRequest", + "responseType": "ListChannelConnectionsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/channelConnections", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/channelConnections" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "CreateChannelConnection": { + "requestType": "CreateChannelConnectionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/channelConnections", + "(google.api.http).body": "channel_connection", + "(google.api.method_signature)": "parent,channel_connection,channel_connection_id", + "(google.longrunning.operation_info).response_type": "ChannelConnection", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/channelConnections", + "body": "channel_connection" + } + }, + { + "(google.api.method_signature)": "parent,channel_connection,channel_connection_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ChannelConnection", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteChannelConnection": { + "requestType": "DeleteChannelConnectionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/channelConnections/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "ChannelConnection", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/channelConnections/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ChannelConnection", + "metadata_type": "OperationMetadata" + } + } + ] + } + } + }, + "GetTriggerRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Trigger" + } + } + } + }, + "ListTriggersRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "eventarc.googleapis.com/Trigger" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "orderBy": { + "type": "string", + "id": 4 + } + } + }, + "ListTriggersResponse": { + "fields": { + "triggers": { + "rule": "repeated", + "type": "Trigger", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "CreateTriggerRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "eventarc.googleapis.com/Trigger" + } + }, + "trigger": { + "type": "Trigger", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "triggerId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "validateOnly": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateTriggerRequest": { + "fields": { + "trigger": { + "type": "Trigger", + "id": 1 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "allowMissing": { + "type": "bool", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4, "options": { - "(google.api.http).delete": "/v1/{name=projects/*/locations/*/triggers/*}", - "(google.api.method_signature)": "name,allow_missing", - "(google.longrunning.operation_info).response_type": "Trigger", - "(google.longrunning.operation_info).metadata_type": "OperationMetadata" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=projects/*/locations/*/triggers/*}" - } - }, - { - "(google.api.method_signature)": "name,allow_missing" - }, - { - "(google.longrunning.operation_info)": { - "response_type": "Trigger", - "metadata_type": "OperationMetadata" - } - } - ] + "(google.api.field_behavior)": "REQUIRED" + } } } }, - "GetTriggerRequest": { + "DeleteTriggerRequest": { "fields": { "name": { "type": "string", @@ -154,17 +608,44 @@ "(google.api.field_behavior)": "REQUIRED", "(google.api.resource_reference).type": "eventarc.googleapis.com/Trigger" } + }, + "etag": { + "type": "string", + "id": 2 + }, + "allowMissing": { + "type": "bool", + "id": 3 + }, + "validateOnly": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } } } }, - "ListTriggersRequest": { + "GetChannelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Channel" + } + } + } + }, + "ListChannelsRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "eventarc.googleapis.com/Trigger" + "(google.api.resource_reference).child_type": "eventarc.googleapis.com/Channel" } }, "pageSize": { @@ -181,11 +662,11 @@ } } }, - "ListTriggersResponse": { + "ListChannelsResponse": { "fields": { - "triggers": { + "channels": { "rule": "repeated", - "type": "Trigger", + "type": "Channel", "id": 1 }, "nextPageToken": { @@ -199,24 +680,24 @@ } } }, - "CreateTriggerRequest": { + "CreateChannelRequest": { "fields": { "parent": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "eventarc.googleapis.com/Trigger" + "(google.api.resource_reference).child_type": "eventarc.googleapis.com/Channel" } }, - "trigger": { - "type": "Trigger", + "channel": { + "type": "Channel", "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } }, - "triggerId": { + "channelId": { "type": "string", "id": 3, "options": { @@ -232,56 +713,132 @@ } } }, - "UpdateTriggerRequest": { + "UpdateChannelRequest": { "fields": { - "trigger": { - "type": "Trigger", + "channel": { + "type": "Channel", "id": 1 }, "updateMask": { "type": "google.protobuf.FieldMask", "id": 2 }, - "allowMissing": { + "validateOnly": { "type": "bool", - "id": 3 + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteChannelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "eventarc.googleapis.com/Channel" + } }, "validateOnly": { "type": "bool", - "id": 4, + "id": 2, "options": { "(google.api.field_behavior)": "REQUIRED" } } } }, - "DeleteTriggerRequest": { + "GetChannelConnectionRequest": { "fields": { "name": { "type": "string", "id": 1, "options": { "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "eventarc.googleapis.com/Trigger" + "(google.api.resource_reference).type": "eventarc.googleapis.com/ChannelConnection" + } + } + } + }, + "ListChannelConnectionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "eventarc.googleapis.com/ChannelConnection" } }, - "etag": { + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListChannelConnectionsResponse": { + "fields": { + "channelConnections": { + "rule": "repeated", + "type": "ChannelConnection", + "id": 1 + }, + "nextPageToken": { "type": "string", "id": 2 }, - "allowMissing": { - "type": "bool", + "unreachable": { + "rule": "repeated", + "type": "string", "id": 3 + } + } + }, + "CreateChannelConnectionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "eventarc.googleapis.com/ChannelConnection" + } }, - "validateOnly": { - "type": "bool", - "id": 4, + "channelConnection": { + "type": "ChannelConnection", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "channelConnectionId": { + "type": "string", + "id": 3, "options": { "(google.api.field_behavior)": "REQUIRED" } } } }, + "DeleteChannelConnectionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "eventarc.googleapis.com/ChannelConnection" + } + } + } + }, "OperationMetadata": { "fields": { "createTime": { @@ -409,6 +966,13 @@ "(google.api.field_behavior)": "OPTIONAL" } }, + "channel": { + "type": "string", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "etag": { "type": "string", "id": 99, @@ -433,6 +997,13 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "operator": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -440,7 +1011,9 @@ "oneofs": { "descriptor": { "oneof": [ - "cloudRun" + "cloudRun", + "cloudFunction", + "gke" ] } }, @@ -448,6 +1021,17 @@ "cloudRun": { "type": "CloudRun", "id": 1 + }, + "cloudFunction": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "cloudfunctions.googleapis.com/CloudFunction" + } + }, + "gke": { + "type": "GKE", + "id": 3 } } }, @@ -492,6 +1076,45 @@ } } }, + "GKE": { + "fields": { + "cluster": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "location": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "namespace": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "service": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "path": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, "Pubsub": { "fields": { "topic": { @@ -520,7 +1143,7 @@ "options": { "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", "java_multiple_files": true, - "java_outer_classname": "ResourceProto", + "java_outer_classname": "ClientProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -613,22 +1236,6 @@ } } }, - "methodSignature": { - "rule": "repeated", - "type": "string", - "id": 1051, - "extend": "google.protobuf.MethodOptions" - }, - "defaultHost": { - "type": "string", - "id": 1049, - "extend": "google.protobuf.ServiceOptions" - }, - "oauthScopes": { - "type": "string", - "id": 1050, - "extend": "google.protobuf.ServiceOptions" - }, "fieldBehavior": { "rule": "repeated", "type": "google.api.FieldBehavior", @@ -723,6 +1330,22 @@ "id": 2 } } + }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" } } }, diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel.js b/samples/generated/v1/eventarc.create_channel.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel.js rename to samples/generated/v1/eventarc.create_channel.js diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel_connection.js b/samples/generated/v1/eventarc.create_channel_connection.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.create_channel_connection.js rename to samples/generated/v1/eventarc.create_channel_connection.js diff --git a/samples/generated/v1/eventarc.create_trigger.js b/samples/generated/v1/eventarc.create_trigger.js index 7f262bf..89367ed 100644 --- a/samples/generated/v1/eventarc.create_trigger.js +++ b/samples/generated/v1/eventarc.create_trigger.js @@ -33,7 +33,7 @@ function main(parent, trigger, triggerId, validateOnly) { */ // const triggerId = 'abc123' /** - * Required. If set, validate the request and preview the review, but do not actually + * Required. If set, validate the request and preview the review, but do not * post it. */ // const validateOnly = true diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel.js b/samples/generated/v1/eventarc.delete_channel.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel.js rename to samples/generated/v1/eventarc.delete_channel.js diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel_connection.js b/samples/generated/v1/eventarc.delete_channel_connection.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.delete_channel_connection.js rename to samples/generated/v1/eventarc.delete_channel_connection.js diff --git a/samples/generated/v1/eventarc.delete_trigger.js b/samples/generated/v1/eventarc.delete_trigger.js index 10b654c..88055ea 100644 --- a/samples/generated/v1/eventarc.delete_trigger.js +++ b/samples/generated/v1/eventarc.delete_trigger.js @@ -35,7 +35,7 @@ function main(name, validateOnly) { */ // const allowMissing = true /** - * Required. If set, validate the request and preview the review, but do not actually + * Required. If set, validate the request and preview the review, but do not * post it. */ // const validateOnly = true diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel.js b/samples/generated/v1/eventarc.get_channel.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel.js rename to samples/generated/v1/eventarc.get_channel.js diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel_connection.js b/samples/generated/v1/eventarc.get_channel_connection.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.get_channel_connection.js rename to samples/generated/v1/eventarc.get_channel_connection.js diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.list_channel_connections.js b/samples/generated/v1/eventarc.list_channel_connections.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.list_channel_connections.js rename to samples/generated/v1/eventarc.list_channel_connections.js diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.list_channels.js b/samples/generated/v1/eventarc.list_channels.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.list_channels.js rename to samples/generated/v1/eventarc.list_channels.js diff --git a/samples/generated/v1/eventarc.list_triggers.js b/samples/generated/v1/eventarc.list_triggers.js index fc64d6e..ea7d7cb 100644 --- a/samples/generated/v1/eventarc.list_triggers.js +++ b/samples/generated/v1/eventarc.list_triggers.js @@ -37,9 +37,9 @@ function main(parent) { */ // const pageToken = 'abc123' /** - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. To specify - * descending order for a field, append a ` desc` suffix; for example: + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: * `name desc, trigger_id`. */ // const orderBy = 'abc123' diff --git a/owl-bot-staging/v1/samples/generated/v1/eventarc.update_channel.js b/samples/generated/v1/eventarc.update_channel.js similarity index 100% rename from owl-bot-staging/v1/samples/generated/v1/eventarc.update_channel.js rename to samples/generated/v1/eventarc.update_channel.js diff --git a/samples/generated/v1/eventarc.update_trigger.js b/samples/generated/v1/eventarc.update_trigger.js index 6e6bf25..8dc6411 100644 --- a/samples/generated/v1/eventarc.update_trigger.js +++ b/samples/generated/v1/eventarc.update_trigger.js @@ -25,8 +25,8 @@ function main(validateOnly) { */ // const trigger = {} /** - * The fields to be updated; only fields explicitly provided will be updated. - * If no field mask is provided, all provided fields in the request will be + * The fields to be updated; only fields explicitly provided are updated. + * If no field mask is provided, all provided fields in the request are * updated. To update all fields, provide a field mask of "*". */ // const updateMask = {} @@ -36,7 +36,7 @@ function main(validateOnly) { */ // const allowMissing = true /** - * Required. If set, validate the request and preview the review, but do not actually + * Required. If set, validate the request and preview the review, but do not * post it. */ // const validateOnly = true diff --git a/src/v1/eventarc_client.ts b/src/v1/eventarc_client.ts index a38927e..f33f481 100644 --- a/src/v1/eventarc_client.ts +++ b/src/v1/eventarc_client.ts @@ -167,6 +167,12 @@ export class EventarcClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + channelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channels/{channel}' + ), + channelConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/channelConnections/{channel_connection}' + ), locationPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}' ), @@ -187,6 +193,16 @@ export class EventarcClient { 'nextPageToken', 'triggers' ), + listChannels: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'channels' + ), + listChannelConnections: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'channelConnections' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -219,6 +235,36 @@ export class EventarcClient { const deleteTriggerMetadata = protoFilesRoot.lookup( '.google.cloud.eventarc.v1.OperationMetadata' ) as gax.protobuf.Type; + const createChannelResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Channel' + ) as gax.protobuf.Type; + const createChannelMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata' + ) as gax.protobuf.Type; + const updateChannelResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Channel' + ) as gax.protobuf.Type; + const updateChannelMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata' + ) as gax.protobuf.Type; + const deleteChannelResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.Channel' + ) as gax.protobuf.Type; + const deleteChannelMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata' + ) as gax.protobuf.Type; + const createChannelConnectionResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.ChannelConnection' + ) as gax.protobuf.Type; + const createChannelConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata' + ) as gax.protobuf.Type; + const deleteChannelConnectionResponse = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.ChannelConnection' + ) as gax.protobuf.Type; + const deleteChannelConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.eventarc.v1.OperationMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { createTrigger: new this._gaxModule.LongrunningDescriptor( @@ -236,6 +282,39 @@ export class EventarcClient { deleteTriggerResponse.decode.bind(deleteTriggerResponse), deleteTriggerMetadata.decode.bind(deleteTriggerMetadata) ), + createChannel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createChannelResponse.decode.bind(createChannelResponse), + createChannelMetadata.decode.bind(createChannelMetadata) + ), + updateChannel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateChannelResponse.decode.bind(updateChannelResponse), + updateChannelMetadata.decode.bind(updateChannelMetadata) + ), + deleteChannel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteChannelResponse.decode.bind(deleteChannelResponse), + deleteChannelMetadata.decode.bind(deleteChannelMetadata) + ), + createChannelConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createChannelConnectionResponse.decode.bind( + createChannelConnectionResponse + ), + createChannelConnectionMetadata.decode.bind( + createChannelConnectionMetadata + ) + ), + deleteChannelConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteChannelConnectionResponse.decode.bind( + deleteChannelConnectionResponse + ), + deleteChannelConnectionMetadata.decode.bind( + deleteChannelConnectionMetadata + ) + ), }; // Put together the default options sent with requests. @@ -293,6 +372,15 @@ export class EventarcClient { 'createTrigger', 'updateTrigger', 'deleteTrigger', + 'getChannel', + 'listChannels', + 'createChannel', + 'updateChannel', + 'deleteChannel', + 'getChannelConnection', + 'listChannelConnections', + 'createChannelConnection', + 'deleteChannelConnection', ]; for (const methodName of eventarcStubMethods) { const callPromise = this.eventarcStub.then( @@ -461,6 +549,180 @@ export class EventarcClient { this.initialize(); return this.innerApiCalls.getTrigger(request, options, callback); } + /** + * Get a single Channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the channel to get. + * @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 [Channel]{@link google.cloud.eventarc.v1.Channel}. + * 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/eventarc.get_channel.js + * region_tag:eventarc_v1_generated_Eventarc_GetChannel_async + */ + getChannel( + request?: protos.google.cloud.eventarc.v1.IGetChannelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest | undefined, + {} | undefined + ] + >; + getChannel( + request: protos.google.cloud.eventarc.v1.IGetChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest | null | undefined, + {} | null | undefined + > + ): void; + getChannel( + request: protos.google.cloud.eventarc.v1.IGetChannelRequest, + callback: Callback< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest | null | undefined, + {} | null | undefined + > + ): void; + getChannel( + request?: protos.google.cloud.eventarc.v1.IGetChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IGetChannelRequest | 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getChannel(request, options, callback); + } + /** + * Get a single ChannelConnection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the channel connection to get. + * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. + * 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/eventarc.get_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_GetChannelConnection_async + */ + getChannelConnection( + request?: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest | undefined, + {} | undefined + ] + >; + getChannelConnection( + request: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.eventarc.v1.IChannelConnection, + | protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getChannelConnection( + request: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, + callback: Callback< + protos.google.cloud.eventarc.v1.IChannelConnection, + | protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getChannelConnection( + request?: protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.eventarc.v1.IChannelConnection, + | protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.eventarc.v1.IChannelConnection, + | protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IGetChannelConnectionRequest | 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getChannelConnection(request, options, callback); + } /** * Create a new trigger in a particular project and location. @@ -474,7 +736,7 @@ export class EventarcClient { * @param {string} request.triggerId * Required. The user-provided ID to be assigned to the trigger. * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not actually + * Required. If set, validate the request and preview the review, but do not * post it. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -614,14 +876,14 @@ export class EventarcClient { * @param {google.cloud.eventarc.v1.Trigger} request.trigger * The trigger to be updated. * @param {google.protobuf.FieldMask} request.updateMask - * The fields to be updated; only fields explicitly provided will be updated. - * If no field mask is provided, all provided fields in the request will be + * The fields to be updated; only fields explicitly provided are updated. + * If no field mask is provided, all provided fields in the request are * updated. To update all fields, provide a field mask of "*". * @param {boolean} request.allowMissing * If set to true, and the trigger is not found, a new trigger will be * created. In this situation, `update_mask` is ignored. * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not actually + * Required. If set, validate the request and preview the review, but do not * post it. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -767,7 +1029,7 @@ export class EventarcClient { * If set to true, and the trigger is not found, the request will succeed * but no action will be taken on the server. * @param {boolean} request.validateOnly - * Required. If set, validate the request and preview the review, but do not actually + * Required. If set, validate the request and preview the review, but do not * post it. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. @@ -900,87 +1162,95 @@ export class EventarcClient { >; } /** - * List triggers. + * Create a new channel in a particular project and location. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The parent collection to list triggers on. - * @param {number} request.pageSize - * The maximum number of triggers to return on each page. - * Note: The service may send fewer. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListTriggers` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListTriggers` must match - * the call that provided the page token. - * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. To specify - * descending order for a field, append a ` desc` suffix; for example: - * `name desc, trigger_id`. + * Required. The parent collection in which to add this channel. + * @param {google.cloud.eventarc.v1.Channel} request.channel + * Required. The channel to create. + * @param {string} request.channelId + * Required. The user-provided ID to be assigned to the channel. + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger}. - * 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 `listTriggersAsync()` - * method described below for async iteration which you can stop as needed. + * 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#auto-pagination) + * [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/eventarc.create_channel.js + * region_tag:eventarc_v1_generated_Eventarc_CreateChannel_async */ - listTriggers( - request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + createChannel( + request?: protos.google.cloud.eventarc.v1.ICreateChannelRequest, options?: CallOptions ): Promise< [ - protos.google.cloud.eventarc.v1.ITrigger[], - protos.google.cloud.eventarc.v1.IListTriggersRequest | null, - protos.google.cloud.eventarc.v1.IListTriggersResponse + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined ] >; - listTriggers( - request: protos.google.cloud.eventarc.v1.IListTriggersRequest, + createChannel( + request: protos.google.cloud.eventarc.v1.ICreateChannelRequest, options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.eventarc.v1.IListTriggersRequest, - protos.google.cloud.eventarc.v1.IListTriggersResponse | null | undefined, - protos.google.cloud.eventarc.v1.ITrigger + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined > ): void; - listTriggers( - request: protos.google.cloud.eventarc.v1.IListTriggersRequest, - callback: PaginationCallback< - protos.google.cloud.eventarc.v1.IListTriggersRequest, - protos.google.cloud.eventarc.v1.IListTriggersResponse | null | undefined, - protos.google.cloud.eventarc.v1.ITrigger + createChannel( + request: protos.google.cloud.eventarc.v1.ICreateChannelRequest, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined > ): void; - listTriggers( - request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + createChannel( + request?: protos.google.cloud.eventarc.v1.ICreateChannelRequest, optionsOrCallback?: | CallOptions - | PaginationCallback< - protos.google.cloud.eventarc.v1.IListTriggersRequest, - | protos.google.cloud.eventarc.v1.IListTriggersResponse - | null - | undefined, - protos.google.cloud.eventarc.v1.ITrigger + | Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined >, - callback?: PaginationCallback< - protos.google.cloud.eventarc.v1.IListTriggersRequest, - protos.google.cloud.eventarc.v1.IListTriggersResponse | null | undefined, - protos.google.cloud.eventarc.v1.ITrigger + callback?: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined > ): Promise< [ - protos.google.cloud.eventarc.v1.ITrigger[], - protos.google.cloud.eventarc.v1.IListTriggersRequest | null, - protos.google.cloud.eventarc.v1.IListTriggersResponse + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined ] > | void { request = request || {}; @@ -999,43 +1269,962 @@ export class EventarcClient { parent: request.parent || '', }); this.initialize(); - return this.innerApiCalls.listTriggers(request, options, callback); + return this.innerApiCalls.createChannel(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 collection to list triggers on. - * @param {number} request.pageSize - * The maximum number of triggers to return on each page. - * Note: The service may send fewer. - * @param {string} request.pageToken - * The page token; provide the value from the `next_page_token` field in a - * previous `ListTriggers` call to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListTriggers` must match + * Check the status of the long running operation returned by `createChannel()`. + * @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/eventarc.create_channel.js + * region_tag:eventarc_v1_generated_Eventarc_CreateChannel_async + */ + async checkCreateChannelProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.eventarc.v1.Channel, + protos.google.cloud.eventarc.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createChannel, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.eventarc.v1.Channel, + protos.google.cloud.eventarc.v1.OperationMetadata + >; + } + /** + * Update a single channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.eventarc.v1.Channel} request.channel + * The channel to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The fields to be updated; only fields explicitly provided are updated. + * If no field mask is provided, all provided fields in the request are + * updated. To update all fields, provide a field mask of "*". + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. + * @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/eventarc.update_channel.js + * region_tag:eventarc_v1_generated_Eventarc_UpdateChannel_async + */ + updateChannel( + request?: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateChannel( + request: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateChannel( + request: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateChannel( + request?: protos.google.cloud.eventarc.v1.IUpdateChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + 'channel.name': request.channel!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateChannel(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateChannel()`. + * @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/eventarc.update_channel.js + * region_tag:eventarc_v1_generated_Eventarc_UpdateChannel_async + */ + async checkUpdateChannelProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.eventarc.v1.Channel, + protos.google.cloud.eventarc.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.updateChannel, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.eventarc.v1.Channel, + protos.google.cloud.eventarc.v1.OperationMetadata + >; + } + /** + * Delete a single channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the channel to be deleted. + * @param {boolean} request.validateOnly + * Required. If set, validate the request and preview the review, but do not + * post it. + * @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/eventarc.delete_channel.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteChannel_async + */ + deleteChannel( + request?: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteChannel( + request: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteChannel( + request: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteChannel( + request?: protos.google.cloud.eventarc.v1.IDeleteChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteChannel(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteChannel()`. + * @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/eventarc.delete_channel.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteChannel_async + */ + async checkDeleteChannelProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.eventarc.v1.Channel, + protos.google.cloud.eventarc.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteChannel, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.eventarc.v1.Channel, + protos.google.cloud.eventarc.v1.OperationMetadata + >; + } + /** + * Create a new ChannelConnection in a particular project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection in which to add this channel connection. + * @param {google.cloud.eventarc.v1.ChannelConnection} request.channelConnection + * Required. Channel connection to create. + * @param {string} request.channelConnectionId + * Required. The user-provided ID to be assigned to the channel connection. + * @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/eventarc.create_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_CreateChannelConnection_async + */ + createChannelConnection( + request?: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createChannelConnection( + request: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createChannelConnection( + request: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createChannelConnection( + request?: protos.google.cloud.eventarc.v1.ICreateChannelConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createChannelConnection( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `createChannelConnection()`. + * @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/eventarc.create_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_CreateChannelConnection_async + */ + async checkCreateChannelConnectionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.eventarc.v1.ChannelConnection, + protos.google.cloud.eventarc.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createChannelConnection, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.eventarc.v1.ChannelConnection, + protos.google.cloud.eventarc.v1.OperationMetadata + >; + } + /** + * Delete a single ChannelConnection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the channel connection to delete. + * @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/eventarc.delete_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteChannelConnection_async + */ + deleteChannelConnection( + request?: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteChannelConnection( + request: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteChannelConnection( + request: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, + callback: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteChannelConnection( + request?: protos.google.cloud.eventarc.v1.IDeleteChannelConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteChannelConnection( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deleteChannelConnection()`. + * @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/eventarc.delete_channel_connection.js + * region_tag:eventarc_v1_generated_Eventarc_DeleteChannelConnection_async + */ + async checkDeleteChannelConnectionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.eventarc.v1.ChannelConnection, + protos.google.cloud.eventarc.v1.OperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteChannelConnection, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.eventarc.v1.ChannelConnection, + protos.google.cloud.eventarc.v1.OperationMetadata + >; + } + /** + * List triggers. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection to list triggers on. + * @param {number} request.pageSize + * The maximum number of triggers to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListTriggers` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTriggers` must match + * the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, trigger_id`. + * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger}. + * 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 `listTriggersAsync()` + * 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. + */ + listTriggers( + request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.eventarc.v1.ITrigger[], + protos.google.cloud.eventarc.v1.IListTriggersRequest | null, + protos.google.cloud.eventarc.v1.IListTriggersResponse + ] + >; + listTriggers( + request: protos.google.cloud.eventarc.v1.IListTriggersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListTriggersRequest, + protos.google.cloud.eventarc.v1.IListTriggersResponse | null | undefined, + protos.google.cloud.eventarc.v1.ITrigger + > + ): void; + listTriggers( + request: protos.google.cloud.eventarc.v1.IListTriggersRequest, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListTriggersRequest, + protos.google.cloud.eventarc.v1.IListTriggersResponse | null | undefined, + protos.google.cloud.eventarc.v1.ITrigger + > + ): void; + listTriggers( + request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.eventarc.v1.IListTriggersRequest, + | protos.google.cloud.eventarc.v1.IListTriggersResponse + | null + | undefined, + protos.google.cloud.eventarc.v1.ITrigger + >, + callback?: PaginationCallback< + protos.google.cloud.eventarc.v1.IListTriggersRequest, + protos.google.cloud.eventarc.v1.IListTriggersResponse | null | undefined, + protos.google.cloud.eventarc.v1.ITrigger + > + ): Promise< + [ + protos.google.cloud.eventarc.v1.ITrigger[], + protos.google.cloud.eventarc.v1.IListTriggersRequest | null, + protos.google.cloud.eventarc.v1.IListTriggersResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listTriggers(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 collection to list triggers on. + * @param {number} request.pageSize + * The maximum number of triggers to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListTriggers` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTriggers` must match + * the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, trigger_id`. + * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger} 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 `listTriggersAsync()` + * 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. + */ + listTriggersStream( + request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTriggers.createStream( + this.innerApiCalls.listTriggers as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listTriggers`, 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 collection to list triggers on. + * @param {number} request.pageSize + * The maximum number of triggers to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListTriggers` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTriggers` must match * the call that provided the page token. * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. To specify - * descending order for a field, append a ` desc` suffix; for example: - * `name desc, trigger_id`. + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, trigger_id`. + * @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 + * [Trigger]{@link google.cloud.eventarc.v1.Trigger}. 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/eventarc.list_triggers.js + * region_tag:eventarc_v1_generated_Eventarc_ListTriggers_async + */ + listTriggersAsync( + request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listTriggers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listTriggers.asyncIterate( + this.innerApiCalls['listTriggers'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List channels. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection to list channels on. + * @param {number} request.pageSize + * The maximum number of channels to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannels` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannels` must + * match the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, channel_id`. + * @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 [Channel]{@link google.cloud.eventarc.v1.Channel}. + * 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 `listChannelsAsync()` + * 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. + */ + listChannels( + request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.eventarc.v1.IChannel[], + protos.google.cloud.eventarc.v1.IListChannelsRequest | null, + protos.google.cloud.eventarc.v1.IListChannelsResponse + ] + >; + listChannels( + request: protos.google.cloud.eventarc.v1.IListChannelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelsRequest, + protos.google.cloud.eventarc.v1.IListChannelsResponse | null | undefined, + protos.google.cloud.eventarc.v1.IChannel + > + ): void; + listChannels( + request: protos.google.cloud.eventarc.v1.IListChannelsRequest, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelsRequest, + protos.google.cloud.eventarc.v1.IListChannelsResponse | null | undefined, + protos.google.cloud.eventarc.v1.IChannel + > + ): void; + listChannels( + request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelsRequest, + | protos.google.cloud.eventarc.v1.IListChannelsResponse + | null + | undefined, + protos.google.cloud.eventarc.v1.IChannel + >, + callback?: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelsRequest, + protos.google.cloud.eventarc.v1.IListChannelsResponse | null | undefined, + protos.google.cloud.eventarc.v1.IChannel + > + ): Promise< + [ + protos.google.cloud.eventarc.v1.IChannel[], + protos.google.cloud.eventarc.v1.IListChannelsRequest | null, + protos.google.cloud.eventarc.v1.IListChannelsResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listChannels(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 collection to list channels on. + * @param {number} request.pageSize + * The maximum number of channels to return on each page. + * Note: The service may send fewer. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannels` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannels` must + * match the call that provided the page token. + * @param {string} request.orderBy + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, channel_id`. * @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 [Trigger]{@link google.cloud.eventarc.v1.Trigger} on 'data' event. + * An object stream which emits an object representing [Channel]{@link google.cloud.eventarc.v1.Channel} 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 `listTriggersAsync()` + * We recommend using `listChannelsAsync()` * 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. */ - listTriggersStream( - request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + listChannelsStream( + request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, options?: CallOptions ): Transform { request = request || {}; @@ -1046,55 +2235,55 @@ export class EventarcClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const defaultCallSettings = this._defaults['listTriggers']; + const defaultCallSettings = this._defaults['listChannels']; const callSettings = defaultCallSettings.merge(options); this.initialize(); - return this.descriptors.page.listTriggers.createStream( - this.innerApiCalls.listTriggers as gax.GaxCall, + return this.descriptors.page.listChannels.createStream( + this.innerApiCalls.listChannels as gax.GaxCall, request, callSettings ); } /** - * Equivalent to `listTriggers`, but returns an iterable object. + * Equivalent to `listChannels`, 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 collection to list triggers on. + * Required. The parent collection to list channels on. * @param {number} request.pageSize - * The maximum number of triggers to return on each page. + * The maximum number of channels to return on each page. * Note: The service may send fewer. * @param {string} request.pageToken * The page token; provide the value from the `next_page_token` field in a - * previous `ListTriggers` call to retrieve the subsequent page. + * previous `ListChannels` call to retrieve the subsequent page. * - * When paginating, all other parameters provided to `ListTriggers` must match - * the call that provided the page token. + * When paginating, all other parameters provided to `ListChannels` must + * match the call that provided the page token. * @param {string} request.orderBy - * The sorting order of the resources returned. Value should be a comma - * separated list of fields. The default sorting oder is ascending. To specify - * descending order for a field, append a ` desc` suffix; for example: - * `name desc, trigger_id`. + * The sorting order of the resources returned. Value should be a + * comma-separated list of fields. The default sorting order is ascending. To + * specify descending order for a field, append a `desc` suffix; for example: + * `name desc, channel_id`. * @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 - * [Trigger]{@link google.cloud.eventarc.v1.Trigger}. The API will be called under the hood as needed, once per the page, + * [Channel]{@link google.cloud.eventarc.v1.Channel}. 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/eventarc.list_triggers.js - * region_tag:eventarc_v1_generated_Eventarc_ListTriggers_async + * @example include:samples/generated/v1/eventarc.list_channels.js + * region_tag:eventarc_v1_generated_Eventarc_ListChannels_async */ - listTriggersAsync( - request?: protos.google.cloud.eventarc.v1.IListTriggersRequest, + listChannelsAsync( + request?: protos.google.cloud.eventarc.v1.IListChannelsRequest, options?: CallOptions - ): AsyncIterable { + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1103,19 +2292,337 @@ export class EventarcClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const defaultCallSettings = this._defaults['listTriggers']; + const defaultCallSettings = this._defaults['listChannels']; const callSettings = defaultCallSettings.merge(options); this.initialize(); - return this.descriptors.page.listTriggers.asyncIterate( - this.innerApiCalls['listTriggers'] as GaxCall, + return this.descriptors.page.listChannels.asyncIterate( + this.innerApiCalls['listChannels'] as GaxCall, request as unknown as RequestType, callSettings - ) as AsyncIterable; + ) as AsyncIterable; + } + /** + * List channel connections. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent collection from which to list channel connections. + * @param {number} request.pageSize + * The maximum number of channel connections to return on each page. + * Note: The service may send fewer responses. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannelConnections` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannelConnetions` + * match the call that provided the page token. + * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. + * 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 `listChannelConnectionsAsync()` + * 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. + */ + listChannelConnections( + request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.eventarc.v1.IChannelConnection[], + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest | null, + protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse + ] + >; + listChannelConnections( + request: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + | protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse + | null + | undefined, + protos.google.cloud.eventarc.v1.IChannelConnection + > + ): void; + listChannelConnections( + request: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + callback: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + | protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse + | null + | undefined, + protos.google.cloud.eventarc.v1.IChannelConnection + > + ): void; + listChannelConnections( + request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + | protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse + | null + | undefined, + protos.google.cloud.eventarc.v1.IChannelConnection + >, + callback?: PaginationCallback< + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + | protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse + | null + | undefined, + protos.google.cloud.eventarc.v1.IChannelConnection + > + ): Promise< + [ + protos.google.cloud.eventarc.v1.IChannelConnection[], + protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest | null, + protos.google.cloud.eventarc.v1.IListChannelConnectionsResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listChannelConnections( + 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 collection from which to list channel connections. + * @param {number} request.pageSize + * The maximum number of channel connections to return on each page. + * Note: The service may send fewer responses. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannelConnections` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannelConnetions` + * match the call that provided the page token. + * @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 [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection} 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 `listChannelConnectionsAsync()` + * 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. + */ + listChannelConnectionsStream( + request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listChannelConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listChannelConnections.createStream( + this.innerApiCalls.listChannelConnections as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listChannelConnections`, 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 collection from which to list channel connections. + * @param {number} request.pageSize + * The maximum number of channel connections to return on each page. + * Note: The service may send fewer responses. + * @param {string} request.pageToken + * The page token; provide the value from the `next_page_token` field in a + * previous `ListChannelConnections` call to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListChannelConnetions` + * match the call that provided the 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 + * [ChannelConnection]{@link google.cloud.eventarc.v1.ChannelConnection}. 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/eventarc.list_channel_connections.js + * region_tag:eventarc_v1_generated_Eventarc_ListChannelConnections_async + */ + listChannelConnectionsAsync( + request?: protos.google.cloud.eventarc.v1.IListChannelConnectionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listChannelConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listChannelConnections.asyncIterate( + this.innerApiCalls['listChannelConnections'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; } // -------------------- // -- Path templates -- // -------------------- + /** + * Return a fully-qualified channel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel + * @returns {string} Resource name string. + */ + channelPath(project: string, location: string, channel: string) { + return this.pathTemplates.channelPathTemplate.render({ + project: project, + location: location, + channel: channel, + }); + } + + /** + * Parse the project from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).project; + } + + /** + * Parse the location from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).location; + } + + /** + * Parse the channel from Channel resource. + * + * @param {string} channelName + * A fully-qualified path representing Channel resource. + * @returns {string} A string representing the channel. + */ + matchChannelFromChannelName(channelName: string) { + return this.pathTemplates.channelPathTemplate.match(channelName).channel; + } + + /** + * Return a fully-qualified channelConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} channel_connection + * @returns {string} Resource name string. + */ + channelConnectionPath( + project: string, + location: string, + channelConnection: string + ) { + return this.pathTemplates.channelConnectionPathTemplate.render({ + project: project, + location: location, + channel_connection: channelConnection, + }); + } + + /** + * Parse the project from ChannelConnection resource. + * + * @param {string} channelConnectionName + * A fully-qualified path representing ChannelConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromChannelConnectionName(channelConnectionName: string) { + return this.pathTemplates.channelConnectionPathTemplate.match( + channelConnectionName + ).project; + } + + /** + * Parse the location from ChannelConnection resource. + * + * @param {string} channelConnectionName + * A fully-qualified path representing ChannelConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromChannelConnectionName(channelConnectionName: string) { + return this.pathTemplates.channelConnectionPathTemplate.match( + channelConnectionName + ).location; + } + + /** + * Parse the channel_connection from ChannelConnection resource. + * + * @param {string} channelConnectionName + * A fully-qualified path representing ChannelConnection resource. + * @returns {string} A string representing the channel_connection. + */ + matchChannelConnectionFromChannelConnectionName( + channelConnectionName: string + ) { + return this.pathTemplates.channelConnectionPathTemplate.match( + channelConnectionName + ).channel_connection; + } + /** * Return a fully-qualified location resource name string. * diff --git a/src/v1/eventarc_client_config.json b/src/v1/eventarc_client_config.json index fa82b75..656b6b2 100644 --- a/src/v1/eventarc_client_config.json +++ b/src/v1/eventarc_client_config.json @@ -39,6 +39,42 @@ "DeleteTrigger": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" + }, + "GetChannel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListChannels": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateChannel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateChannel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteChannel": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetChannelConnection": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListChannelConnections": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateChannelConnection": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteChannelConnection": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/src/v1/eventarc_proto_list.json b/src/v1/eventarc_proto_list.json index 750251c..bc82a79 100644 --- a/src/v1/eventarc_proto_list.json +++ b/src/v1/eventarc_proto_list.json @@ -1,4 +1,6 @@ [ + "../../protos/google/cloud/eventarc/v1/channel.proto", + "../../protos/google/cloud/eventarc/v1/channel_connection.proto", "../../protos/google/cloud/eventarc/v1/eventarc.proto", "../../protos/google/cloud/eventarc/v1/trigger.proto" ] diff --git a/src/v1/gapic_metadata.json b/src/v1/gapic_metadata.json index 4aa184b..95b183d 100644 --- a/src/v1/gapic_metadata.json +++ b/src/v1/gapic_metadata.json @@ -15,6 +15,16 @@ "getTrigger" ] }, + "GetChannel": { + "methods": [ + "getChannel" + ] + }, + "GetChannelConnection": { + "methods": [ + "getChannelConnection" + ] + }, "CreateTrigger": { "methods": [ "createTrigger" @@ -30,12 +40,51 @@ "deleteTrigger" ] }, + "CreateChannel": { + "methods": [ + "createChannel" + ] + }, + "UpdateChannel": { + "methods": [ + "updateChannel" + ] + }, + "DeleteChannel": { + "methods": [ + "deleteChannel" + ] + }, + "CreateChannelConnection": { + "methods": [ + "createChannelConnection" + ] + }, + "DeleteChannelConnection": { + "methods": [ + "deleteChannelConnection" + ] + }, "ListTriggers": { "methods": [ "listTriggers", "listTriggersStream", "listTriggersAsync" ] + }, + "ListChannels": { + "methods": [ + "listChannels", + "listChannelsStream", + "listChannelsAsync" + ] + }, + "ListChannelConnections": { + "methods": [ + "listChannelConnections", + "listChannelConnectionsStream", + "listChannelConnectionsAsync" + ] } } }, @@ -47,6 +96,16 @@ "getTrigger" ] }, + "GetChannel": { + "methods": [ + "getChannel" + ] + }, + "GetChannelConnection": { + "methods": [ + "getChannelConnection" + ] + }, "CreateTrigger": { "methods": [ "createTrigger" @@ -62,12 +121,51 @@ "deleteTrigger" ] }, + "CreateChannel": { + "methods": [ + "createChannel" + ] + }, + "UpdateChannel": { + "methods": [ + "updateChannel" + ] + }, + "DeleteChannel": { + "methods": [ + "deleteChannel" + ] + }, + "CreateChannelConnection": { + "methods": [ + "createChannelConnection" + ] + }, + "DeleteChannelConnection": { + "methods": [ + "deleteChannelConnection" + ] + }, "ListTriggers": { "methods": [ "listTriggers", "listTriggersStream", "listTriggersAsync" ] + }, + "ListChannels": { + "methods": [ + "listChannels", + "listChannelsStream", + "listChannelsAsync" + ] + }, + "ListChannelConnections": { + "methods": [ + "listChannelConnections", + "listChannelConnectionsStream", + "listChannelConnectionsAsync" + ] } } } diff --git a/test/gapic_eventarc_v1.ts b/test/gapic_eventarc_v1.ts index b5dcca5..11272f2 100644 --- a/test/gapic_eventarc_v1.ts +++ b/test/gapic_eventarc_v1.ts @@ -336,6 +336,229 @@ describe('v1.EventarcClient', () => { }); }); + describe('getChannel', () => { + it('invokes getChannel without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.GetChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.eventarc.v1.Channel() + ); + client.innerApiCalls.getChannel = stubSimpleCall(expectedResponse); + const [response] = await client.getChannel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getChannel without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.GetChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.eventarc.v1.Channel() + ); + client.innerApiCalls.getChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getChannel( + request, + ( + err?: Error | null, + result?: protos.google.cloud.eventarc.v1.IChannel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getChannel with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.GetChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getChannel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getChannel(request), expectedError); + assert( + (client.innerApiCalls.getChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getChannelConnection', () => { + it('invokes getChannelConnection without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ); + client.innerApiCalls.getChannelConnection = + stubSimpleCall(expectedResponse); + const [response] = await client.getChannelConnection(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getChannelConnection without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ); + client.innerApiCalls.getChannelConnection = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getChannelConnection( + request, + ( + err?: Error | null, + result?: protos.google.cloud.eventarc.v1.IChannelConnection | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getChannelConnection with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.GetChannelConnectionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getChannelConnection = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getChannelConnection(request), expectedError); + assert( + (client.innerApiCalls.getChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('createTrigger', () => { it('invokes createTrigger without error', async () => { const client = new eventarcModule.v1.EventarcClient({ @@ -922,15 +1145,15 @@ describe('v1.EventarcClient', () => { }); }); - describe('listTriggers', () => { - it('invokes listTriggers without error', async () => { + describe('createChannel', () => { + it('invokes createChannel without error', async () => { const client = new eventarcModule.v1.EventarcClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.eventarc.v1.ListTriggersRequest() + new protos.google.cloud.eventarc.v1.CreateChannelRequest() ); request.parent = ''; const expectedHeaderRequestParams = 'parent='; @@ -941,29 +1164,29 @@ describe('v1.EventarcClient', () => { }, }, }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - ]; - client.innerApiCalls.listTriggers = stubSimpleCall(expectedResponse); - const [response] = await client.listTriggers(request); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createChannel = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createChannel(request); + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.listTriggers as SinonStub) + (client.innerApiCalls.createChannel as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes listTriggers without error using callback', async () => { + it('invokes createChannel without error using callback', async () => { const client = new eventarcModule.v1.EventarcClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.eventarc.v1.ListTriggersRequest() + new protos.google.cloud.eventarc.v1.CreateChannelRequest() ); request.parent = ''; const expectedHeaderRequestParams = 'parent='; @@ -974,19 +1197,20 @@ describe('v1.EventarcClient', () => { }, }, }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - ]; - client.innerApiCalls.listTriggers = - stubSimpleCallWithCallback(expectedResponse); + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createChannel = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listTriggers( + client.createChannel( request, ( err?: Error | null, - result?: protos.google.cloud.eventarc.v1.ITrigger[] | null + result?: LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + > | null ) => { if (err) { reject(err); @@ -996,23 +1220,27 @@ describe('v1.EventarcClient', () => { } ); }); - const response = await promise; + const operation = (await promise) as LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >; + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.listTriggers as SinonStub) + (client.innerApiCalls.createChannel as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes listTriggers with error', async () => { + it('invokes createChannel with call error', async () => { const client = new eventarcModule.v1.EventarcClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.eventarc.v1.ListTriggersRequest() + new protos.google.cloud.eventarc.v1.CreateChannelRequest() ); request.parent = ''; const expectedHeaderRequestParams = 'parent='; @@ -1024,89 +1252,1658 @@ describe('v1.EventarcClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.listTriggers = stubSimpleCall( + client.innerApiCalls.createChannel = stubLongRunningCall( undefined, expectedError ); - await assert.rejects(client.listTriggers(request), expectedError); + await assert.rejects(client.createChannel(request), expectedError); assert( - (client.innerApiCalls.listTriggers as SinonStub) + (client.innerApiCalls.createChannel as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes listTriggersStream without error', async () => { + it('invokes createChannel with LRO error', async () => { const client = new eventarcModule.v1.EventarcClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.eventarc.v1.ListTriggersRequest() + new protos.google.cloud.eventarc.v1.CreateChannelRequest() ); request.parent = ''; const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - ]; - client.descriptors.page.listTriggers.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.eventarc.v1.Trigger[] = []; - stream.on( - 'data', - (response: protos.google.cloud.eventarc.v1.Trigger) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createChannel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createChannel(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateChannelProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateChannelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateChannelProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateChannelProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateChannel', () => { + it('invokes updateChannel without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.UpdateChannelRequest() + ); + request.channel = {}; + request.channel.name = ''; + const expectedHeaderRequestParams = 'channel.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateChannel = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateChannel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateChannel without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.UpdateChannelRequest() + ); + request.channel = {}; + request.channel.name = ''; + const expectedHeaderRequestParams = 'channel.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateChannel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateChannel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateChannel with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.UpdateChannelRequest() + ); + request.channel = {}; + request.channel.name = ''; + const expectedHeaderRequestParams = 'channel.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateChannel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateChannel(request), expectedError); + assert( + (client.innerApiCalls.updateChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateChannel with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.UpdateChannelRequest() + ); + request.channel = {}; + request.channel.name = ''; + const expectedHeaderRequestParams = 'channel.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateChannel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateChannel(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateChannelProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkUpdateChannelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateChannelProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkUpdateChannelProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteChannel', () => { + it('invokes deleteChannel without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.DeleteChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteChannel = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteChannel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteChannel without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.DeleteChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteChannel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteChannel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.eventarc.v1.IChannel, + protos.google.cloud.eventarc.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteChannel with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.DeleteChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteChannel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteChannel(request), expectedError); + assert( + (client.innerApiCalls.deleteChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteChannel with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.DeleteChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteChannel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteChannel(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteChannelProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteChannelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteChannelProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteChannelProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createChannelConnection', () => { + it('invokes createChannelConnection without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createChannelConnection = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createChannelConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createChannelConnection without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createChannelConnection = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createChannelConnection( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createChannelConnection with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createChannelConnection = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.createChannelConnection(request), + expectedError + ); + assert( + (client.innerApiCalls.createChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createChannelConnection with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.CreateChannelConnectionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createChannelConnection = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createChannelConnection(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateChannelConnectionProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateChannelConnectionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateChannelConnectionProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkCreateChannelConnectionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteChannelConnection', () => { + it('invokes deleteChannelConnection without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteChannelConnection = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteChannelConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteChannelConnection without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteChannelConnection = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteChannelConnection( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.eventarc.v1.IChannelConnection, + protos.google.cloud.eventarc.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteChannelConnection with call error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteChannelConnection = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteChannelConnection(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteChannelConnection with LRO error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.DeleteChannelConnectionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteChannelConnection = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteChannelConnection(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteChannelConnection as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteChannelConnectionProgress without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteChannelConnectionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteChannelConnectionProgress with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + 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.checkDeleteChannelConnectionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listTriggers', () => { + it('invokes listTriggers without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListTriggersRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + ]; + client.innerApiCalls.listTriggers = stubSimpleCall(expectedResponse); + const [response] = await client.listTriggers(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listTriggers as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listTriggers without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListTriggersRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + ]; + client.innerApiCalls.listTriggers = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTriggers( + request, + ( + err?: Error | null, + result?: protos.google.cloud.eventarc.v1.ITrigger[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listTriggers as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listTriggers with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListTriggersRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listTriggers = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listTriggers(request), expectedError); + assert( + (client.innerApiCalls.listTriggers as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listTriggersStream without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListTriggersRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + ]; + client.descriptors.page.listTriggers.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.Trigger[] = []; + stream.on( + 'data', + (response: protos.google.cloud.eventarc.v1.Trigger) => { + 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.listTriggers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTriggers, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listTriggers.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listTriggersStream with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListTriggersRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listTriggers.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listTriggersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.Trigger[] = []; + stream.on( + 'data', + (response: protos.google.cloud.eventarc.v1.Trigger) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listTriggers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTriggers, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listTriggers.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTriggers without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListTriggersRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + ]; + client.descriptors.page.listTriggers.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.eventarc.v1.ITrigger[] = []; + const iterable = client.listTriggersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listTriggers.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listTriggers.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTriggers with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListTriggersRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listTriggers.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTriggersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.eventarc.v1.ITrigger[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listTriggers.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listTriggers.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listChannels', () => { + it('invokes listChannels without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + ]; + client.innerApiCalls.listChannels = stubSimpleCall(expectedResponse); + const [response] = await client.listChannels(request); + assert.deepStrictEqual(response, expectedResponse); assert( - (client.descriptors.page.listTriggers.createStream as SinonStub) + (client.innerApiCalls.listChannels as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listTriggers, request) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listChannels without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + ]; + client.innerApiCalls.listChannels = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listChannels( + request, + ( + err?: Error | null, + result?: protos.google.cloud.eventarc.v1.IChannel[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listChannels as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listChannels with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listChannels = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listChannels(request), expectedError); + assert( + (client.innerApiCalls.listChannels as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listChannelsStream without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + ]; + client.descriptors.page.listChannels.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listChannelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.Channel[] = []; + stream.on( + 'data', + (response: protos.google.cloud.eventarc.v1.Channel) => { + 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.listChannels.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listChannels, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listChannels.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listChannelsStream with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listChannels.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listChannelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.Channel[] = []; + stream.on( + 'data', + (response: protos.google.cloud.eventarc.v1.Channel) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listChannels.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listChannels, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listChannels.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listChannels without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + generateSampleMessage(new protos.google.cloud.eventarc.v1.Channel()), + ]; + client.descriptors.page.listChannels.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.eventarc.v1.IChannel[] = []; + const iterable = client.listChannelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listChannels.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listChannels.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listChannels with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listChannels.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listChannelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.eventarc.v1.IChannel[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listChannels.asyncIterate as SinonStub + ).getCall(0).args[1], + request ); assert.strictEqual( ( - client.descriptors.page.listTriggers.createStream as SinonStub + client.descriptors.page.listChannels.asyncIterate as SinonStub ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); + }); - it('invokes listTriggersStream with error', async () => { + describe('listChannelConnections', () => { + it('invokes listChannelConnections without error', async () => { const client = new eventarcModule.v1.EventarcClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.eventarc.v1.ListTriggersRequest() + new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + ]; + client.innerApiCalls.listChannelConnections = + stubSimpleCall(expectedResponse); + const [response] = await client.listChannelConnections(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listChannelConnections as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listChannelConnections without error using callback', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + ]; + client.innerApiCalls.listChannelConnections = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listChannelConnections( + request, + ( + err?: Error | null, + result?: protos.google.cloud.eventarc.v1.IChannelConnection[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listChannelConnections as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listChannelConnections with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest() ); request.parent = ''; const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedError = new Error('expected'); - client.descriptors.page.listTriggers.createStream = stubPageStreamingCall( + client.innerApiCalls.listChannelConnections = stubSimpleCall( undefined, expectedError ); - const stream = client.listTriggersStream(request); + await assert.rejects( + client.listChannelConnections(request), + expectedError + ); + assert( + (client.innerApiCalls.listChannelConnections as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listChannelConnectionsStream without error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + ]; + client.descriptors.page.listChannelConnections.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listChannelConnectionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.eventarc.v1.Trigger[] = []; + const responses: protos.google.cloud.eventarc.v1.ChannelConnection[] = + []; stream.on( 'data', - (response: protos.google.cloud.eventarc.v1.Trigger) => { + (response: protos.google.cloud.eventarc.v1.ChannelConnection) => { + 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.listChannelConnections + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listChannelConnections, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listChannelConnections + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listChannelConnectionsStream with error', async () => { + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listChannelConnections.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listChannelConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.eventarc.v1.ChannelConnection[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.eventarc.v1.ChannelConnection) => { responses.push(response); } ); @@ -1119,86 +2916,102 @@ describe('v1.EventarcClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listTriggers.createStream as SinonStub) + ( + client.descriptors.page.listChannelConnections + .createStream as SinonStub + ) .getCall(0) - .calledWith(client.innerApiCalls.listTriggers, request) + .calledWith(client.innerApiCalls.listChannelConnections, request) ); assert.strictEqual( ( - client.descriptors.page.listTriggers.createStream as SinonStub + client.descriptors.page.listChannelConnections + .createStream as SinonStub ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); - it('uses async iteration with listTriggers without error', async () => { + it('uses async iteration with listChannelConnections without error', async () => { const client = new eventarcModule.v1.EventarcClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.eventarc.v1.ListTriggersRequest() + new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest() ); request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), - generateSampleMessage(new protos.google.cloud.eventarc.v1.Trigger()), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), + generateSampleMessage( + new protos.google.cloud.eventarc.v1.ChannelConnection() + ), ]; - client.descriptors.page.listTriggers.asyncIterate = + client.descriptors.page.listChannelConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.eventarc.v1.ITrigger[] = []; - const iterable = client.listTriggersAsync(request); + const responses: protos.google.cloud.eventarc.v1.IChannelConnection[] = + []; + const iterable = client.listChannelConnectionsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( ( - client.descriptors.page.listTriggers.asyncIterate as SinonStub + client.descriptors.page.listChannelConnections + .asyncIterate as SinonStub ).getCall(0).args[1], request ); assert.strictEqual( ( - client.descriptors.page.listTriggers.asyncIterate as SinonStub + client.descriptors.page.listChannelConnections + .asyncIterate as SinonStub ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); - it('uses async iteration with listTriggers with error', async () => { + it('uses async iteration with listChannelConnections with error', async () => { const client = new eventarcModule.v1.EventarcClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.eventarc.v1.ListTriggersRequest() + new protos.google.cloud.eventarc.v1.ListChannelConnectionsRequest() ); request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listTriggers.asyncIterate = + client.descriptors.page.listChannelConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTriggersAsync(request); + const iterable = client.listChannelConnectionsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.eventarc.v1.ITrigger[] = []; + const responses: protos.google.cloud.eventarc.v1.IChannelConnection[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( ( - client.descriptors.page.listTriggers.asyncIterate as SinonStub + client.descriptors.page.listChannelConnections + .asyncIterate as SinonStub ).getCall(0).args[1], request ); assert.strictEqual( ( - client.descriptors.page.listTriggers.asyncIterate as SinonStub + client.descriptors.page.listChannelConnections + .asyncIterate as SinonStub ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); @@ -1206,6 +3019,147 @@ describe('v1.EventarcClient', () => { }); describe('Path templates', () => { + describe('channel', () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + channel: 'channelValue', + }; + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'channelValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('channelConnection', () => { + const fakePath = '/rendered/path/channelConnection'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + channel_connection: 'channelConnectionValue', + }; + const client = new eventarcModule.v1.EventarcClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.channelConnectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelConnectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelConnectionPath', () => { + const result = client.channelConnectionPath( + 'projectValue', + 'locationValue', + 'channelConnectionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.channelConnectionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromChannelConnectionName', () => { + const result = client.matchProjectFromChannelConnectionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.channelConnectionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromChannelConnectionName', () => { + const result = client.matchLocationFromChannelConnectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.channelConnectionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelConnectionFromChannelConnectionName', () => { + const result = + client.matchChannelConnectionFromChannelConnectionName(fakePath); + assert.strictEqual(result, 'channelConnectionValue'); + assert( + ( + client.pathTemplates.channelConnectionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('location', () => { const fakePath = '/rendered/path/location'; const expectedParameters = {