google-cloud-dialogflow-cx-v3 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google/cloud/dialogflow/cx/v3/advanced_settings_pb.rb +32 -0
  7. data/lib/google/cloud/dialogflow/cx/v3/agent_pb.rb +122 -0
  8. data/lib/google/cloud/dialogflow/cx/v3/agent_services_pb.rb +82 -0
  9. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +1051 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/agents/credentials.rb +54 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +666 -0
  12. data/lib/google/cloud/dialogflow/cx/v3/agents/paths.rb +151 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/agents.rb +52 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/audio_config_pb.rb +94 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/entity_type_pb.rb +92 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_type_services_pb.rb +67 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +766 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/credentials.rb +54 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/entity_types/paths.rb +75 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/entity_types.rb +51 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/environment_pb.rb +117 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/environment_services_pb.rb +61 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +950 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/environments/credentials.rb +54 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +666 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/environments/paths.rb +98 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/environments.rb +52 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/experiment_pb.rb +177 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/experiment_services_pb.rb +61 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +851 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/experiments/credentials.rb +54 -0
  32. data/lib/google/cloud/dialogflow/cx/v3/experiments/paths.rb +102 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/experiments.rb +51 -0
  34. data/lib/google/cloud/dialogflow/cx/v3/flow_pb.rb +145 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/flow_services_pb.rb +88 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +1200 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/flows/credentials.rb +54 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +666 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/flows/paths.rb +184 -0
  40. data/lib/google/cloud/dialogflow/cx/v3/flows.rb +52 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/fulfillment_pb.rb +55 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/intent_pb.rb +97 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/intent_services_pb.rb +67 -0
  44. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +750 -0
  45. data/lib/google/cloud/dialogflow/cx/v3/intents/credentials.rb +54 -0
  46. data/lib/google/cloud/dialogflow/cx/v3/intents/paths.rb +96 -0
  47. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +51 -0
  48. data/lib/google/cloud/dialogflow/cx/v3/page_pb.rb +113 -0
  49. data/lib/google/cloud/dialogflow/cx/v3/page_services_pb.rb +67 -0
  50. data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +805 -0
  51. data/lib/google/cloud/dialogflow/cx/v3/pages/credentials.rb +54 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/pages/paths.rb +165 -0
  53. data/lib/google/cloud/dialogflow/cx/v3/pages.rb +51 -0
  54. data/lib/google/cloud/dialogflow/cx/v3/response_message_pb.rb +77 -0
  55. data/lib/google/cloud/dialogflow/cx/v3/security_settings_pb.rb +89 -0
  56. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +696 -0
  57. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/credentials.rb +54 -0
  58. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/paths.rb +157 -0
  59. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service.rb +51 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/security_settings_services_pb.rb +56 -0
  61. data/lib/google/cloud/dialogflow/cx/v3/session_entity_type_pb.rb +68 -0
  62. data/lib/google/cloud/dialogflow/cx/v3/session_entity_type_services_pb.rb +55 -0
  63. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +715 -0
  64. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/credentials.rb +54 -0
  65. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/paths.rb +137 -0
  66. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types.rb +51 -0
  67. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +209 -0
  68. data/lib/google/cloud/dialogflow/cx/v3/session_services_pb.rb +71 -0
  69. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +654 -0
  70. data/lib/google/cloud/dialogflow/cx/v3/sessions/credentials.rb +54 -0
  71. data/lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb +225 -0
  72. data/lib/google/cloud/dialogflow/cx/v3/sessions.rb +53 -0
  73. data/lib/google/cloud/dialogflow/cx/v3/test_case_pb.rb +302 -0
  74. data/lib/google/cloud/dialogflow/cx/v3/test_case_services_pb.rb +73 -0
  75. data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +1324 -0
  76. data/lib/google/cloud/dialogflow/cx/v3/test_cases/credentials.rb +54 -0
  77. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +666 -0
  78. data/lib/google/cloud/dialogflow/cx/v3/test_cases/paths.rb +249 -0
  79. data/lib/google/cloud/dialogflow/cx/v3/test_cases.rb +53 -0
  80. data/lib/google/cloud/dialogflow/cx/v3/transition_route_group_pb.rb +67 -0
  81. data/lib/google/cloud/dialogflow/cx/v3/transition_route_group_services_pb.rb +67 -0
  82. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +766 -0
  83. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/credentials.rb +54 -0
  84. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/paths.rb +144 -0
  85. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups.rb +51 -0
  86. data/lib/google/cloud/dialogflow/cx/v3/validation_message_pb.rb +59 -0
  87. data/lib/google/cloud/dialogflow/cx/v3/version.rb +30 -0
  88. data/lib/google/cloud/dialogflow/cx/v3/version_pb.rb +88 -0
  89. data/lib/google/cloud/dialogflow/cx/v3/version_services_pb.rb +57 -0
  90. data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +792 -0
  91. data/lib/google/cloud/dialogflow/cx/v3/versions/credentials.rb +54 -0
  92. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +666 -0
  93. data/lib/google/cloud/dialogflow/cx/v3/versions/paths.rb +79 -0
  94. data/lib/google/cloud/dialogflow/cx/v3/versions.rb +52 -0
  95. data/lib/google/cloud/dialogflow/cx/v3/webhook_pb.rb +172 -0
  96. data/lib/google/cloud/dialogflow/cx/v3/webhook_services_pb.rb +55 -0
  97. data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +704 -0
  98. data/lib/google/cloud/dialogflow/cx/v3/webhooks/credentials.rb +54 -0
  99. data/lib/google/cloud/dialogflow/cx/v3/webhooks/paths.rb +96 -0
  100. data/lib/google/cloud/dialogflow/cx/v3/webhooks.rb +51 -0
  101. data/lib/google/cloud/dialogflow/cx/v3.rb +53 -0
  102. data/lib/google-cloud-dialogflow-cx-v3.rb +21 -0
  103. data/proto_docs/README.md +4 -0
  104. data/proto_docs/google/api/field_behavior.rb +71 -0
  105. data/proto_docs/google/api/resource.rb +283 -0
  106. data/proto_docs/google/cloud/dialogflow/cx/v3/advanced_settings.rb +57 -0
  107. data/proto_docs/google/cloud/dialogflow/cx/v3/agent.rb +301 -0
  108. data/proto_docs/google/cloud/dialogflow/cx/v3/audio_config.rb +322 -0
  109. data/proto_docs/google/cloud/dialogflow/cx/v3/entity_type.rb +306 -0
  110. data/proto_docs/google/cloud/dialogflow/cx/v3/environment.rb +279 -0
  111. data/proto_docs/google/cloud/dialogflow/cx/v3/experiment.rb +438 -0
  112. data/proto_docs/google/cloud/dialogflow/cx/v3/flow.rb +438 -0
  113. data/proto_docs/google/cloud/dialogflow/cx/v3/fulfillment.rb +126 -0
  114. data/proto_docs/google/cloud/dialogflow/cx/v3/intent.rb +318 -0
  115. data/proto_docs/google/cloud/dialogflow/cx/v3/page.rb +478 -0
  116. data/proto_docs/google/cloud/dialogflow/cx/v3/response_message.rb +220 -0
  117. data/proto_docs/google/cloud/dialogflow/cx/v3/security_settings.rb +222 -0
  118. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +798 -0
  119. data/proto_docs/google/cloud/dialogflow/cx/v3/session_entity_type.rb +184 -0
  120. data/proto_docs/google/cloud/dialogflow/cx/v3/test_case.rb +757 -0
  121. data/proto_docs/google/cloud/dialogflow/cx/v3/transition_route_group.rb +195 -0
  122. data/proto_docs/google/cloud/dialogflow/cx/v3/validation_message.rb +121 -0
  123. data/proto_docs/google/cloud/dialogflow/cx/v3/version.rb +182 -0
  124. data/proto_docs/google/cloud/dialogflow/cx/v3/webhook.rb +496 -0
  125. data/proto_docs/google/longrunning/operations.rb +164 -0
  126. data/proto_docs/google/protobuf/any.rb +141 -0
  127. data/proto_docs/google/protobuf/duration.rb +98 -0
  128. data/proto_docs/google/protobuf/empty.rb +36 -0
  129. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  130. data/proto_docs/google/protobuf/struct.rb +96 -0
  131. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  132. data/proto_docs/google/rpc/status.rb +46 -0
  133. data/proto_docs/google/type/latlng.rb +38 -0
  134. metadata +326 -0
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Dialogflow
24
+ module CX
25
+ module V3
26
+ module TestCases
27
+ # Credentials for the TestCases API.
28
+ class Credentials < ::Google::Auth::Credentials
29
+ self.scope = [
30
+ "https://www.googleapis.com/auth/cloud-platform",
31
+ "https://www.googleapis.com/auth/dialogflow"
32
+ ]
33
+ self.env_vars = [
34
+ "DIALOGFLOW_CREDENTIALS",
35
+ "DIALOGFLOW_KEYFILE",
36
+ "GOOGLE_CLOUD_CREDENTIALS",
37
+ "GOOGLE_CLOUD_KEYFILE",
38
+ "GCLOUD_KEYFILE",
39
+ "DIALOGFLOW_CREDENTIALS_JSON",
40
+ "DIALOGFLOW_KEYFILE_JSON",
41
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
42
+ "GOOGLE_CLOUD_KEYFILE_JSON",
43
+ "GCLOUD_KEYFILE_JSON"
44
+ ]
45
+ self.paths = [
46
+ "~/.config/google_cloud/application_default_credentials.json"
47
+ ]
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,666 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/operation"
20
+ require "google/longrunning/operations_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module CX
26
+ module V3
27
+ module TestCases
28
+ # Service that implements Longrunning Operations API.
29
+ class Operations
30
+ # @private
31
+ attr_reader :operations_stub
32
+
33
+ ##
34
+ # Configuration for the TestCases Operations API.
35
+ #
36
+ # @yield [config] Configure the Operations client.
37
+ # @yieldparam config [Operations::Configuration]
38
+ #
39
+ # @return [Operations::Configuration]
40
+ #
41
+ def self.configure
42
+ @configure ||= Operations::Configuration.new
43
+ yield @configure if block_given?
44
+ @configure
45
+ end
46
+
47
+ ##
48
+ # Configure the TestCases Operations instance.
49
+ #
50
+ # The configuration is set to the derived mode, meaning that values can be changed,
51
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
52
+ # should be made on {Operations.configure}.
53
+ #
54
+ # @yield [config] Configure the Operations client.
55
+ # @yieldparam config [Operations::Configuration]
56
+ #
57
+ # @return [Operations::Configuration]
58
+ #
59
+ def configure
60
+ yield @config if block_given?
61
+ @config
62
+ end
63
+
64
+ ##
65
+ # Create a new Operations client object.
66
+ #
67
+ # @yield [config] Configure the Client client.
68
+ # @yieldparam config [Operations::Configuration]
69
+ #
70
+ def initialize
71
+ # These require statements are intentionally placed here to initialize
72
+ # the gRPC module only when it's required.
73
+ # See https://github.com/googleapis/toolkit/issues/446
74
+ require "gapic/grpc"
75
+ require "google/longrunning/operations_services_pb"
76
+
77
+ # Create the configuration object
78
+ @config = Configuration.new Operations.configure
79
+
80
+ # Yield the configuration if needed
81
+ yield @config if block_given?
82
+
83
+ # Create credentials
84
+ credentials = @config.credentials
85
+ credentials ||= Credentials.default scope: @config.scope
86
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
87
+ credentials = Credentials.new credentials, scope: @config.scope
88
+ end
89
+ @quota_project_id = @config.quota_project
90
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
91
+
92
+ @operations_stub = ::Gapic::ServiceStub.new(
93
+ ::Google::Longrunning::Operations::Stub,
94
+ credentials: credentials,
95
+ endpoint: @config.endpoint,
96
+ channel_args: @config.channel_args,
97
+ interceptors: @config.interceptors
98
+ )
99
+ end
100
+
101
+ # Service calls
102
+
103
+ ##
104
+ # Lists operations that match the specified filter in the request. If the
105
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
106
+ #
107
+ # NOTE: the `name` binding allows API services to override the binding
108
+ # to use different resource name schemes, such as `users/*/operations`. To
109
+ # override the binding, API services can add a binding such as
110
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
111
+ # For backwards compatibility, the default name includes the operations
112
+ # collection id, however overriding users must ensure the name binding
113
+ # is the parent resource, without the operations collection id.
114
+ #
115
+ # @overload list_operations(request, options = nil)
116
+ # Pass arguments to `list_operations` via a request object, either of type
117
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
118
+ #
119
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
120
+ # A request object representing the call parameters. Required. To specify no
121
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
122
+ # @param options [::Gapic::CallOptions, ::Hash]
123
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
124
+ #
125
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
126
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
127
+ # least one keyword argument is required. To specify no parameters, or to keep all
128
+ # the default parameter values, pass an empty Hash as a request object (see above).
129
+ #
130
+ # @param name [::String]
131
+ # The name of the operation's parent resource.
132
+ # @param filter [::String]
133
+ # The standard list filter.
134
+ # @param page_size [::Integer]
135
+ # The standard list page size.
136
+ # @param page_token [::String]
137
+ # The standard list page token.
138
+ #
139
+ # @yield [response, operation] Access the result along with the RPC operation
140
+ # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
141
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
142
+ #
143
+ # @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
144
+ #
145
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
146
+ #
147
+ def list_operations request, options = nil
148
+ raise ::ArgumentError, "request must be provided" if request.nil?
149
+
150
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
151
+
152
+ # Converts hash and nil to an options object
153
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
154
+
155
+ # Customize the options with defaults
156
+ metadata = @config.rpcs.list_operations.metadata.to_h
157
+
158
+ # Set x-goog-api-client and x-goog-user-project headers
159
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
160
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
161
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
162
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
163
+
164
+ header_params = {
165
+ "name" => request.name
166
+ }
167
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
168
+ metadata[:"x-goog-request-params"] ||= request_params_header
169
+
170
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
171
+ metadata: metadata,
172
+ retry_policy: @config.rpcs.list_operations.retry_policy
173
+
174
+ options.apply_defaults timeout: @config.timeout,
175
+ metadata: @config.metadata,
176
+ retry_policy: @config.retry_policy
177
+
178
+ @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
179
+ wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
180
+ response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
181
+ yield response, operation if block_given?
182
+ return response
183
+ end
184
+ rescue ::GRPC::BadStatus => e
185
+ raise ::Google::Cloud::Error.from_error(e)
186
+ end
187
+
188
+ ##
189
+ # Gets the latest state of a long-running operation. Clients can use this
190
+ # method to poll the operation result at intervals as recommended by the API
191
+ # service.
192
+ #
193
+ # @overload get_operation(request, options = nil)
194
+ # Pass arguments to `get_operation` via a request object, either of type
195
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
196
+ #
197
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
198
+ # A request object representing the call parameters. Required. To specify no
199
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
200
+ # @param options [::Gapic::CallOptions, ::Hash]
201
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
202
+ #
203
+ # @overload get_operation(name: nil)
204
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
205
+ # least one keyword argument is required. To specify no parameters, or to keep all
206
+ # the default parameter values, pass an empty Hash as a request object (see above).
207
+ #
208
+ # @param name [::String]
209
+ # The name of the operation resource.
210
+ #
211
+ # @yield [response, operation] Access the result along with the RPC operation
212
+ # @yieldparam response [::Gapic::Operation]
213
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
214
+ #
215
+ # @return [::Gapic::Operation]
216
+ #
217
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
218
+ #
219
+ def get_operation request, options = nil
220
+ raise ::ArgumentError, "request must be provided" if request.nil?
221
+
222
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
223
+
224
+ # Converts hash and nil to an options object
225
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
226
+
227
+ # Customize the options with defaults
228
+ metadata = @config.rpcs.get_operation.metadata.to_h
229
+
230
+ # Set x-goog-api-client and x-goog-user-project headers
231
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
232
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
233
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
234
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
235
+
236
+ header_params = {
237
+ "name" => request.name
238
+ }
239
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
240
+ metadata[:"x-goog-request-params"] ||= request_params_header
241
+
242
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
243
+ metadata: metadata,
244
+ retry_policy: @config.rpcs.get_operation.retry_policy
245
+
246
+ options.apply_defaults timeout: @config.timeout,
247
+ metadata: @config.metadata,
248
+ retry_policy: @config.retry_policy
249
+
250
+ @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
251
+ response = ::Gapic::Operation.new response, @operations_client, options: options
252
+ yield response, operation if block_given?
253
+ return response
254
+ end
255
+ rescue ::GRPC::BadStatus => e
256
+ raise ::Google::Cloud::Error.from_error(e)
257
+ end
258
+
259
+ ##
260
+ # Deletes a long-running operation. This method indicates that the client is
261
+ # no longer interested in the operation result. It does not cancel the
262
+ # operation. If the server doesn't support this method, it returns
263
+ # `google.rpc.Code.UNIMPLEMENTED`.
264
+ #
265
+ # @overload delete_operation(request, options = nil)
266
+ # Pass arguments to `delete_operation` via a request object, either of type
267
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
268
+ #
269
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
270
+ # A request object representing the call parameters. Required. To specify no
271
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
272
+ # @param options [::Gapic::CallOptions, ::Hash]
273
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
274
+ #
275
+ # @overload delete_operation(name: nil)
276
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
277
+ # least one keyword argument is required. To specify no parameters, or to keep all
278
+ # the default parameter values, pass an empty Hash as a request object (see above).
279
+ #
280
+ # @param name [::String]
281
+ # The name of the operation resource to be deleted.
282
+ #
283
+ # @yield [response, operation] Access the result along with the RPC operation
284
+ # @yieldparam response [::Google::Protobuf::Empty]
285
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
286
+ #
287
+ # @return [::Google::Protobuf::Empty]
288
+ #
289
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
290
+ #
291
+ def delete_operation request, options = nil
292
+ raise ::ArgumentError, "request must be provided" if request.nil?
293
+
294
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
295
+
296
+ # Converts hash and nil to an options object
297
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
298
+
299
+ # Customize the options with defaults
300
+ metadata = @config.rpcs.delete_operation.metadata.to_h
301
+
302
+ # Set x-goog-api-client and x-goog-user-project headers
303
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
304
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
305
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
306
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
307
+
308
+ header_params = {
309
+ "name" => request.name
310
+ }
311
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
312
+ metadata[:"x-goog-request-params"] ||= request_params_header
313
+
314
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
315
+ metadata: metadata,
316
+ retry_policy: @config.rpcs.delete_operation.retry_policy
317
+
318
+ options.apply_defaults timeout: @config.timeout,
319
+ metadata: @config.metadata,
320
+ retry_policy: @config.retry_policy
321
+
322
+ @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
323
+ yield response, operation if block_given?
324
+ return response
325
+ end
326
+ rescue ::GRPC::BadStatus => e
327
+ raise ::Google::Cloud::Error.from_error(e)
328
+ end
329
+
330
+ ##
331
+ # Starts asynchronous cancellation on a long-running operation. The server
332
+ # makes a best effort to cancel the operation, but success is not
333
+ # guaranteed. If the server doesn't support this method, it returns
334
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
335
+ # Operations.GetOperation or
336
+ # other methods to check whether the cancellation succeeded or whether the
337
+ # operation completed despite cancellation. On successful cancellation,
338
+ # the operation is not deleted; instead, it becomes an operation with
339
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
340
+ # corresponding to `Code.CANCELLED`.
341
+ #
342
+ # @overload cancel_operation(request, options = nil)
343
+ # Pass arguments to `cancel_operation` via a request object, either of type
344
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
345
+ #
346
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
347
+ # A request object representing the call parameters. Required. To specify no
348
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
349
+ # @param options [::Gapic::CallOptions, ::Hash]
350
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
351
+ #
352
+ # @overload cancel_operation(name: nil)
353
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
354
+ # least one keyword argument is required. To specify no parameters, or to keep all
355
+ # the default parameter values, pass an empty Hash as a request object (see above).
356
+ #
357
+ # @param name [::String]
358
+ # The name of the operation resource to be cancelled.
359
+ #
360
+ # @yield [response, operation] Access the result along with the RPC operation
361
+ # @yieldparam response [::Google::Protobuf::Empty]
362
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
363
+ #
364
+ # @return [::Google::Protobuf::Empty]
365
+ #
366
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
367
+ #
368
+ def cancel_operation request, options = nil
369
+ raise ::ArgumentError, "request must be provided" if request.nil?
370
+
371
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
372
+
373
+ # Converts hash and nil to an options object
374
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
375
+
376
+ # Customize the options with defaults
377
+ metadata = @config.rpcs.cancel_operation.metadata.to_h
378
+
379
+ # Set x-goog-api-client and x-goog-user-project headers
380
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
381
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
382
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
383
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
384
+
385
+ header_params = {
386
+ "name" => request.name
387
+ }
388
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
389
+ metadata[:"x-goog-request-params"] ||= request_params_header
390
+
391
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
392
+ metadata: metadata,
393
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
394
+
395
+ options.apply_defaults timeout: @config.timeout,
396
+ metadata: @config.metadata,
397
+ retry_policy: @config.retry_policy
398
+
399
+ @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
400
+ yield response, operation if block_given?
401
+ return response
402
+ end
403
+ rescue ::GRPC::BadStatus => e
404
+ raise ::Google::Cloud::Error.from_error(e)
405
+ end
406
+
407
+ ##
408
+ # Waits until the specified long-running operation is done or reaches at most
409
+ # a specified timeout, returning the latest state. If the operation is
410
+ # already done, the latest state is immediately returned. If the timeout
411
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
412
+ # timeout is used. If the server does not support this method, it returns
413
+ # `google.rpc.Code.UNIMPLEMENTED`.
414
+ # Note that this method is on a best-effort basis. It may return the latest
415
+ # state before the specified timeout (including immediately), meaning even an
416
+ # immediate response is no guarantee that the operation is done.
417
+ #
418
+ # @overload wait_operation(request, options = nil)
419
+ # Pass arguments to `wait_operation` via a request object, either of type
420
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
421
+ #
422
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
423
+ # A request object representing the call parameters. Required. To specify no
424
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
425
+ # @param options [::Gapic::CallOptions, ::Hash]
426
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
427
+ #
428
+ # @overload wait_operation(name: nil, timeout: nil)
429
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
430
+ # least one keyword argument is required. To specify no parameters, or to keep all
431
+ # the default parameter values, pass an empty Hash as a request object (see above).
432
+ #
433
+ # @param name [::String]
434
+ # The name of the operation resource to wait on.
435
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
436
+ # The maximum duration to wait before timing out. If left blank, the wait
437
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
438
+ # If RPC context deadline is also specified, the shorter one will be used.
439
+ #
440
+ # @yield [response, operation] Access the result along with the RPC operation
441
+ # @yieldparam response [::Gapic::Operation]
442
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
443
+ #
444
+ # @return [::Gapic::Operation]
445
+ #
446
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
447
+ #
448
+ def wait_operation request, options = nil
449
+ raise ::ArgumentError, "request must be provided" if request.nil?
450
+
451
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
452
+
453
+ # Converts hash and nil to an options object
454
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
455
+
456
+ # Customize the options with defaults
457
+ metadata = @config.rpcs.wait_operation.metadata.to_h
458
+
459
+ # Set x-goog-api-client and x-goog-user-project headers
460
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
461
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
462
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
463
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
464
+
465
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
466
+ metadata: metadata,
467
+ retry_policy: @config.rpcs.wait_operation.retry_policy
468
+
469
+ options.apply_defaults timeout: @config.timeout,
470
+ metadata: @config.metadata,
471
+ retry_policy: @config.retry_policy
472
+
473
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
474
+ response = ::Gapic::Operation.new response, @operations_client, options: options
475
+ yield response, operation if block_given?
476
+ return response
477
+ end
478
+ rescue ::GRPC::BadStatus => e
479
+ raise ::Google::Cloud::Error.from_error(e)
480
+ end
481
+
482
+ ##
483
+ # Configuration class for the Operations API.
484
+ #
485
+ # This class represents the configuration for Operations,
486
+ # providing control over timeouts, retry behavior, logging, transport
487
+ # parameters, and other low-level controls. Certain parameters can also be
488
+ # applied individually to specific RPCs. See
489
+ # {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
490
+ # for a list of RPCs that can be configured independently.
491
+ #
492
+ # Configuration can be applied globally to all clients, or to a single client
493
+ # on construction.
494
+ #
495
+ # @example
496
+ #
497
+ # # Modify the global config, setting the timeout for
498
+ # # list_operations to 20 seconds,
499
+ # # and all remaining timeouts to 10 seconds.
500
+ # ::Google::Longrunning::Operations::Client.configure do |config|
501
+ # config.timeout = 10.0
502
+ # config.rpcs.list_operations.timeout = 20.0
503
+ # end
504
+ #
505
+ # # Apply the above configuration only to a new client.
506
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
507
+ # config.timeout = 10.0
508
+ # config.rpcs.list_operations.timeout = 20.0
509
+ # end
510
+ #
511
+ # @!attribute [rw] endpoint
512
+ # The hostname or hostname:port of the service endpoint.
513
+ # Defaults to `"dialogflow.googleapis.com"`.
514
+ # @return [::String]
515
+ # @!attribute [rw] credentials
516
+ # Credentials to send with calls. You may provide any of the following types:
517
+ # * (`String`) The path to a service account key file in JSON format
518
+ # * (`Hash`) A service account key as a Hash
519
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
520
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
521
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
522
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
523
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
524
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
525
+ # * (`nil`) indicating no credentials
526
+ # @return [::Object]
527
+ # @!attribute [rw] scope
528
+ # The OAuth scopes
529
+ # @return [::Array<::String>]
530
+ # @!attribute [rw] lib_name
531
+ # The library name as recorded in instrumentation and logging
532
+ # @return [::String]
533
+ # @!attribute [rw] lib_version
534
+ # The library version as recorded in instrumentation and logging
535
+ # @return [::String]
536
+ # @!attribute [rw] channel_args
537
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
538
+ # `GRPC::Core::Channel` object is provided as the credential.
539
+ # @return [::Hash]
540
+ # @!attribute [rw] interceptors
541
+ # An array of interceptors that are run before calls are executed.
542
+ # @return [::Array<::GRPC::ClientInterceptor>]
543
+ # @!attribute [rw] timeout
544
+ # The call timeout in seconds.
545
+ # @return [::Numeric]
546
+ # @!attribute [rw] metadata
547
+ # Additional gRPC headers to be sent with the call.
548
+ # @return [::Hash{::Symbol=>::String}]
549
+ # @!attribute [rw] retry_policy
550
+ # The retry policy. The value is a hash with the following keys:
551
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
552
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
553
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
554
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
555
+ # trigger a retry.
556
+ # @return [::Hash]
557
+ # @!attribute [rw] quota_project
558
+ # A separate project against which to charge quota.
559
+ # @return [::String]
560
+ #
561
+ class Configuration
562
+ extend ::Gapic::Config
563
+
564
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
565
+ config_attr :credentials, nil do |value|
566
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
567
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
568
+ allowed.any? { |klass| klass === value }
569
+ end
570
+ config_attr :scope, nil, ::String, ::Array, nil
571
+ config_attr :lib_name, nil, ::String, nil
572
+ config_attr :lib_version, nil, ::String, nil
573
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
574
+ config_attr :interceptors, nil, ::Array, nil
575
+ config_attr :timeout, nil, ::Numeric, nil
576
+ config_attr :metadata, nil, ::Hash, nil
577
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
578
+ config_attr :quota_project, nil, ::String, nil
579
+
580
+ # @private
581
+ def initialize parent_config = nil
582
+ @parent_config = parent_config unless parent_config.nil?
583
+
584
+ yield self if block_given?
585
+ end
586
+
587
+ ##
588
+ # Configurations for individual RPCs
589
+ # @return [Rpcs]
590
+ #
591
+ def rpcs
592
+ @rpcs ||= begin
593
+ parent_rpcs = nil
594
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
595
+ Rpcs.new parent_rpcs
596
+ end
597
+ end
598
+
599
+ ##
600
+ # Configuration RPC class for the Operations API.
601
+ #
602
+ # Includes fields providing the configuration for each RPC in this service.
603
+ # Each configuration object is of type `Gapic::Config::Method` and includes
604
+ # the following configuration fields:
605
+ #
606
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
607
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
608
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
609
+ # include the following keys:
610
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
611
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
612
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
613
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
614
+ # trigger a retry.
615
+ #
616
+ class Rpcs
617
+ ##
618
+ # RPC-specific configuration for `list_operations`
619
+ # @return [::Gapic::Config::Method]
620
+ #
621
+ attr_reader :list_operations
622
+ ##
623
+ # RPC-specific configuration for `get_operation`
624
+ # @return [::Gapic::Config::Method]
625
+ #
626
+ attr_reader :get_operation
627
+ ##
628
+ # RPC-specific configuration for `delete_operation`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :delete_operation
632
+ ##
633
+ # RPC-specific configuration for `cancel_operation`
634
+ # @return [::Gapic::Config::Method]
635
+ #
636
+ attr_reader :cancel_operation
637
+ ##
638
+ # RPC-specific configuration for `wait_operation`
639
+ # @return [::Gapic::Config::Method]
640
+ #
641
+ attr_reader :wait_operation
642
+
643
+ # @private
644
+ def initialize parent_rpcs = nil
645
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
646
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
647
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
648
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
649
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
650
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
651
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
652
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
653
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
654
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
655
+
656
+ yield self if block_given?
657
+ end
658
+ end
659
+ end
660
+ end
661
+ end
662
+ end
663
+ end
664
+ end
665
+ end
666
+ end