google-cloud-discovery_engine-v1 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +9 -3
  3. data/lib/google/cloud/discovery_engine/v1/completion_service/operations.rb +13 -5
  4. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +9 -3
  5. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/operations.rb +28 -5
  6. data/lib/google/cloud/discovery_engine/v1/control_service/client.rb +875 -0
  7. data/lib/google/cloud/discovery_engine/v1/control_service/credentials.rb +47 -0
  8. data/lib/google/cloud/discovery_engine/v1/control_service/paths.rb +167 -0
  9. data/lib/google/cloud/discovery_engine/v1/control_service/rest/client.rb +814 -0
  10. data/lib/google/cloud/discovery_engine/v1/control_service/rest/service_stub.rb +440 -0
  11. data/lib/google/cloud/discovery_engine/v1/control_service/rest.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1/control_service.rb +58 -0
  13. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +764 -6
  14. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/paths.rb +199 -0
  15. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +715 -6
  16. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +520 -0
  17. data/lib/google/cloud/discovery_engine/v1/data_store_service/client.rb +15 -7
  18. data/lib/google/cloud/discovery_engine/v1/data_store_service/operations.rb +13 -5
  19. data/lib/google/cloud/discovery_engine/v1/data_store_service/paths.rb +45 -0
  20. data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/client.rb +15 -7
  21. data/lib/google/cloud/discovery_engine/v1/data_store_service/rest/operations.rb +28 -5
  22. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +23 -13
  23. data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +13 -5
  24. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +23 -13
  25. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +28 -5
  26. data/lib/google/cloud/discovery_engine/v1/engine_service/client.rb +13 -5
  27. data/lib/google/cloud/discovery_engine/v1/engine_service/operations.rb +13 -5
  28. data/lib/google/cloud/discovery_engine/v1/engine_service/rest/client.rb +13 -5
  29. data/lib/google/cloud/discovery_engine/v1/engine_service/rest/operations.rb +28 -5
  30. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/client.rb +471 -0
  31. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/credentials.rb +47 -0
  32. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/paths.rb +52 -0
  33. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/client.rb +438 -0
  34. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest/service_stub.rb +129 -0
  35. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service/rest.rb +52 -0
  36. data/lib/google/cloud/discovery_engine/v1/grounded_generation_service.rb +55 -0
  37. data/lib/google/cloud/discovery_engine/v1/project_service/client.rb +485 -0
  38. data/lib/google/cloud/discovery_engine/v1/project_service/credentials.rb +47 -0
  39. data/lib/google/cloud/discovery_engine/v1/project_service/operations.rb +809 -0
  40. data/lib/google/cloud/discovery_engine/v1/project_service/paths.rb +47 -0
  41. data/lib/google/cloud/discovery_engine/v1/project_service/rest/client.rb +452 -0
  42. data/lib/google/cloud/discovery_engine/v1/project_service/rest/operations.rb +1114 -0
  43. data/lib/google/cloud/discovery_engine/v1/project_service/rest/service_stub.rb +129 -0
  44. data/lib/google/cloud/discovery_engine/v1/project_service/rest.rb +54 -0
  45. data/lib/google/cloud/discovery_engine/v1/project_service.rb +57 -0
  46. data/lib/google/cloud/discovery_engine/v1/rank_service/client.rb +481 -0
  47. data/lib/google/cloud/discovery_engine/v1/rank_service/credentials.rb +47 -0
  48. data/lib/google/cloud/discovery_engine/v1/rank_service/paths.rb +52 -0
  49. data/lib/google/cloud/discovery_engine/v1/rank_service/rest/client.rb +448 -0
  50. data/lib/google/cloud/discovery_engine/v1/rank_service/rest/service_stub.rb +129 -0
  51. data/lib/google/cloud/discovery_engine/v1/rank_service/rest.rb +52 -0
  52. data/lib/google/cloud/discovery_engine/v1/rank_service.rb +55 -0
  53. data/lib/google/cloud/discovery_engine/v1/recommendation_service/client.rb +24 -19
  54. data/lib/google/cloud/discovery_engine/v1/recommendation_service/paths.rb +66 -0
  55. data/lib/google/cloud/discovery_engine/v1/recommendation_service/rest/client.rb +24 -19
  56. data/lib/google/cloud/discovery_engine/v1/rest.rb +4 -0
  57. data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +18 -10
  58. data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +13 -5
  59. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +18 -10
  60. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +28 -5
  61. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +15 -8
  62. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +15 -8
  63. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/client.rb +27 -12
  64. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/operations.rb +13 -5
  65. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/client.rb +27 -12
  66. data/lib/google/cloud/discovery_engine/v1/site_search_engine_service/rest/operations.rb +28 -5
  67. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +23 -6
  68. data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +13 -5
  69. data/lib/google/cloud/discovery_engine/v1/user_event_service/paths.rb +21 -0
  70. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +23 -6
  71. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +28 -5
  72. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +8 -0
  73. data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
  74. data/lib/google/cloud/discovery_engine/v1.rb +4 -0
  75. data/lib/google/cloud/discoveryengine/v1/answer_pb.rb +69 -0
  76. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +2 -1
  77. data/lib/google/cloud/discoveryengine/v1/control_pb.rb +55 -0
  78. data/lib/google/cloud/discoveryengine/v1/control_service_pb.rb +57 -0
  79. data/lib/google/cloud/discoveryengine/v1/control_service_services_pb.rb +69 -0
  80. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +32 -1
  81. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +25 -0
  82. data/lib/google/cloud/discoveryengine/v1/data_store_pb.rb +3 -1
  83. data/lib/google/cloud/discoveryengine/v1/document_processing_config_pb.rb +48 -0
  84. data/lib/google/cloud/discoveryengine/v1/document_service_services_pb.rb +1 -1
  85. data/lib/google/cloud/discoveryengine/v1/engine_pb.rb +1 -1
  86. data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_pb.rb +52 -0
  87. data/lib/google/cloud/discoveryengine/v1/grounded_generation_service_services_pb.rb +45 -0
  88. data/lib/google/cloud/discoveryengine/v1/grounding_pb.rb +46 -0
  89. data/lib/google/cloud/discoveryengine/v1/project_pb.rb +49 -0
  90. data/lib/google/cloud/discoveryengine/v1/project_service_pb.rb +50 -0
  91. data/lib/google/cloud/discoveryengine/v1/project_service_services_pb.rb +51 -0
  92. data/lib/google/cloud/discoveryengine/v1/rank_service_pb.rb +49 -0
  93. data/lib/google/cloud/discoveryengine/v1/rank_service_services_pb.rb +45 -0
  94. data/lib/google/cloud/discoveryengine/v1/session_pb.rb +50 -0
  95. data/lib/google/cloud/discoveryengine/v1/site_search_engine_pb.rb +1 -1
  96. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +1 -1
  97. data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +1 -1
  98. data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +1 -1
  99. data/proto_docs/google/cloud/discoveryengine/v1/answer.rb +362 -0
  100. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +16 -0
  101. data/proto_docs/google/cloud/discoveryengine/v1/control.rb +207 -0
  102. data/proto_docs/google/cloud/discoveryengine/v1/control_service.rb +126 -0
  103. data/proto_docs/google/cloud/discoveryengine/v1/conversation.rb +2 -2
  104. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +485 -0
  105. data/proto_docs/google/cloud/discoveryengine/v1/data_store.rb +3 -0
  106. data/proto_docs/google/cloud/discoveryengine/v1/data_store_service.rb +2 -2
  107. data/proto_docs/google/cloud/discoveryengine/v1/document_processing_config.rb +102 -0
  108. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +5 -5
  109. data/proto_docs/google/cloud/discoveryengine/v1/engine.rb +3 -3
  110. data/proto_docs/google/cloud/discoveryengine/v1/grounded_generation_service.rb +144 -0
  111. data/proto_docs/google/cloud/discoveryengine/v1/grounding.rb +79 -0
  112. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +4 -4
  113. data/proto_docs/google/cloud/discoveryengine/v1/project.rb +106 -0
  114. data/proto_docs/google/cloud/discoveryengine/v1/project_service.rb +57 -0
  115. data/proto_docs/google/cloud/discoveryengine/v1/rank_service.rb +124 -0
  116. data/proto_docs/google/cloud/discoveryengine/v1/recommendation_service.rb +20 -19
  117. data/proto_docs/google/cloud/discoveryengine/v1/schema_service.rb +5 -5
  118. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +23 -18
  119. data/proto_docs/google/cloud/discoveryengine/v1/session.rb +88 -0
  120. data/proto_docs/google/cloud/discoveryengine/v1/site_search_engine.rb +3 -0
  121. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +24 -3
  122. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +13 -1
  123. metadata +56 -2
@@ -0,0 +1,485 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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 "google/cloud/errors"
20
+ require "google/cloud/discoveryengine/v1/project_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DiscoveryEngine
26
+ module V1
27
+ module ProjectService
28
+ ##
29
+ # Client for the ProjectService service.
30
+ #
31
+ # Service for operations on the
32
+ # {::Google::Cloud::DiscoveryEngine::V1::Project Project}.
33
+ #
34
+ class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
40
+
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :project_service_stub
45
+
46
+ ##
47
+ # Configure the ProjectService Client class.
48
+ #
49
+ # See {::Google::Cloud::DiscoveryEngine::V1::ProjectService::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all ProjectService clients
55
+ # ::Google::Cloud::DiscoveryEngine::V1::ProjectService::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config.timeout = 30.0
76
+ default_config.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config
81
+ end
82
+ yield @configure if block_given?
83
+ @configure
84
+ end
85
+
86
+ ##
87
+ # Configure the ProjectService Client instance.
88
+ #
89
+ # The configuration is set to the derived mode, meaning that values can be changed,
90
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
91
+ # should be made on {Client.configure}.
92
+ #
93
+ # See {::Google::Cloud::DiscoveryEngine::V1::ProjectService::Client::Configuration}
94
+ # for a description of the configuration fields.
95
+ #
96
+ # @yield [config] Configure the Client client.
97
+ # @yieldparam config [Client::Configuration]
98
+ #
99
+ # @return [Client::Configuration]
100
+ #
101
+ def configure
102
+ yield @config if block_given?
103
+ @config
104
+ end
105
+
106
+ ##
107
+ # The effective universe domain
108
+ #
109
+ # @return [String]
110
+ #
111
+ def universe_domain
112
+ @project_service_stub.universe_domain
113
+ end
114
+
115
+ ##
116
+ # Create a new ProjectService client object.
117
+ #
118
+ # @example
119
+ #
120
+ # # Create a client using the default configuration
121
+ # client = ::Google::Cloud::DiscoveryEngine::V1::ProjectService::Client.new
122
+ #
123
+ # # Create a client using a custom configuration
124
+ # client = ::Google::Cloud::DiscoveryEngine::V1::ProjectService::Client.new do |config|
125
+ # config.timeout = 10.0
126
+ # end
127
+ #
128
+ # @yield [config] Configure the ProjectService client.
129
+ # @yieldparam config [Client::Configuration]
130
+ #
131
+ def initialize
132
+ # These require statements are intentionally placed here to initialize
133
+ # the gRPC module only when it's required.
134
+ # See https://github.com/googleapis/toolkit/issues/446
135
+ require "gapic/grpc"
136
+ require "google/cloud/discoveryengine/v1/project_service_services_pb"
137
+
138
+ # Create the configuration object
139
+ @config = Configuration.new Client.configure
140
+
141
+ # Yield the configuration if needed
142
+ yield @config if block_given?
143
+
144
+ # Create credentials
145
+ credentials = @config.credentials
146
+ # Use self-signed JWT if the endpoint is unchanged from default,
147
+ # but only if the default endpoint does not have a region prefix.
148
+ enable_self_signed_jwt = @config.endpoint.nil? ||
149
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
150
+ !@config.endpoint.split(".").first.include?("-"))
151
+ credentials ||= Credentials.default scope: @config.scope,
152
+ enable_self_signed_jwt: enable_self_signed_jwt
153
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
154
+ credentials = Credentials.new credentials, scope: @config.scope
155
+ end
156
+ @quota_project_id = @config.quota_project
157
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
158
+
159
+ @operations_client = Operations.new do |config|
160
+ config.credentials = credentials
161
+ config.quota_project = @quota_project_id
162
+ config.endpoint = @config.endpoint
163
+ config.universe_domain = @config.universe_domain
164
+ end
165
+
166
+ @project_service_stub = ::Gapic::ServiceStub.new(
167
+ ::Google::Cloud::DiscoveryEngine::V1::ProjectService::Stub,
168
+ credentials: credentials,
169
+ endpoint: @config.endpoint,
170
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
171
+ universe_domain: @config.universe_domain,
172
+ channel_args: @config.channel_args,
173
+ interceptors: @config.interceptors,
174
+ channel_pool_config: @config.channel_pool
175
+ )
176
+
177
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
178
+ config.credentials = credentials
179
+ config.quota_project = @quota_project_id
180
+ config.endpoint = @project_service_stub.endpoint
181
+ config.universe_domain = @project_service_stub.universe_domain
182
+ end
183
+ end
184
+
185
+ ##
186
+ # Get the associated client for long-running operations.
187
+ #
188
+ # @return [::Google::Cloud::DiscoveryEngine::V1::ProjectService::Operations]
189
+ #
190
+ attr_reader :operations_client
191
+
192
+ ##
193
+ # Get the associated client for mix-in of the Locations.
194
+ #
195
+ # @return [Google::Cloud::Location::Locations::Client]
196
+ #
197
+ attr_reader :location_client
198
+
199
+ # Service calls
200
+
201
+ ##
202
+ # Provisions the project resource. During the
203
+ # process, related systems will get prepared and initialized.
204
+ #
205
+ # Caller must read the [Terms for data
206
+ # use](https://cloud.google.com/retail/data-use-terms), and optionally
207
+ # specify in request to provide consent to that service terms.
208
+ #
209
+ # @overload provision_project(request, options = nil)
210
+ # Pass arguments to `provision_project` via a request object, either of type
211
+ # {::Google::Cloud::DiscoveryEngine::V1::ProvisionProjectRequest} or an equivalent Hash.
212
+ #
213
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ProvisionProjectRequest, ::Hash]
214
+ # A request object representing the call parameters. Required. To specify no
215
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
216
+ # @param options [::Gapic::CallOptions, ::Hash]
217
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
218
+ #
219
+ # @overload provision_project(name: nil, accept_data_use_terms: nil, data_use_terms_version: nil)
220
+ # Pass arguments to `provision_project` via keyword arguments. Note that at
221
+ # least one keyword argument is required. To specify no parameters, or to keep all
222
+ # the default parameter values, pass an empty Hash as a request object (see above).
223
+ #
224
+ # @param name [::String]
225
+ # Required. Full resource name of a
226
+ # {::Google::Cloud::DiscoveryEngine::V1::Project Project}, such as
227
+ # `projects/{project_id_or_number}`.
228
+ # @param accept_data_use_terms [::Boolean]
229
+ # Required. Set to `true` to specify that caller has read and would like to
230
+ # give consent to the [Terms for data
231
+ # use](https://cloud.google.com/retail/data-use-terms).
232
+ # @param data_use_terms_version [::String]
233
+ # Required. The version of the [Terms for data
234
+ # use](https://cloud.google.com/retail/data-use-terms) that caller has read
235
+ # and would like to give consent to.
236
+ #
237
+ # Acceptable version is `2022-11-23`, and this may change over time.
238
+ #
239
+ # @yield [response, operation] Access the result along with the RPC operation
240
+ # @yieldparam response [::Gapic::Operation]
241
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
242
+ #
243
+ # @return [::Gapic::Operation]
244
+ #
245
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
246
+ #
247
+ # @example Basic example
248
+ # require "google/cloud/discovery_engine/v1"
249
+ #
250
+ # # Create a client object. The client can be reused for multiple calls.
251
+ # client = Google::Cloud::DiscoveryEngine::V1::ProjectService::Client.new
252
+ #
253
+ # # Create a request. To set request fields, pass in keyword arguments.
254
+ # request = Google::Cloud::DiscoveryEngine::V1::ProvisionProjectRequest.new
255
+ #
256
+ # # Call the provision_project method.
257
+ # result = client.provision_project request
258
+ #
259
+ # # The returned object is of type Gapic::Operation. You can use it to
260
+ # # check the status of an operation, cancel it, or wait for results.
261
+ # # Here is how to wait for a response.
262
+ # result.wait_until_done! timeout: 60
263
+ # if result.response?
264
+ # p result.response
265
+ # else
266
+ # puts "No response received."
267
+ # end
268
+ #
269
+ def provision_project request, options = nil
270
+ raise ::ArgumentError, "request must be provided" if request.nil?
271
+
272
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ProvisionProjectRequest
273
+
274
+ # Converts hash and nil to an options object
275
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
276
+
277
+ # Customize the options with defaults
278
+ metadata = @config.rpcs.provision_project.metadata.to_h
279
+
280
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
281
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
282
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
283
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
284
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
285
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
286
+
287
+ header_params = {}
288
+ if request.name
289
+ header_params["name"] = request.name
290
+ end
291
+
292
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
293
+ metadata[:"x-goog-request-params"] ||= request_params_header
294
+
295
+ options.apply_defaults timeout: @config.rpcs.provision_project.timeout,
296
+ metadata: metadata,
297
+ retry_policy: @config.rpcs.provision_project.retry_policy
298
+
299
+ options.apply_defaults timeout: @config.timeout,
300
+ metadata: @config.metadata,
301
+ retry_policy: @config.retry_policy
302
+
303
+ @project_service_stub.call_rpc :provision_project, request, options: options do |response, operation|
304
+ response = ::Gapic::Operation.new response, @operations_client, options: options
305
+ yield response, operation if block_given?
306
+ return response
307
+ end
308
+ rescue ::GRPC::BadStatus => e
309
+ raise ::Google::Cloud::Error.from_error(e)
310
+ end
311
+
312
+ ##
313
+ # Configuration class for the ProjectService API.
314
+ #
315
+ # This class represents the configuration for ProjectService,
316
+ # providing control over timeouts, retry behavior, logging, transport
317
+ # parameters, and other low-level controls. Certain parameters can also be
318
+ # applied individually to specific RPCs. See
319
+ # {::Google::Cloud::DiscoveryEngine::V1::ProjectService::Client::Configuration::Rpcs}
320
+ # for a list of RPCs that can be configured independently.
321
+ #
322
+ # Configuration can be applied globally to all clients, or to a single client
323
+ # on construction.
324
+ #
325
+ # @example
326
+ #
327
+ # # Modify the global config, setting the timeout for
328
+ # # provision_project to 20 seconds,
329
+ # # and all remaining timeouts to 10 seconds.
330
+ # ::Google::Cloud::DiscoveryEngine::V1::ProjectService::Client.configure do |config|
331
+ # config.timeout = 10.0
332
+ # config.rpcs.provision_project.timeout = 20.0
333
+ # end
334
+ #
335
+ # # Apply the above configuration only to a new client.
336
+ # client = ::Google::Cloud::DiscoveryEngine::V1::ProjectService::Client.new do |config|
337
+ # config.timeout = 10.0
338
+ # config.rpcs.provision_project.timeout = 20.0
339
+ # end
340
+ #
341
+ # @!attribute [rw] endpoint
342
+ # A custom service endpoint, as a hostname or hostname:port. The default is
343
+ # nil, indicating to use the default endpoint in the current universe domain.
344
+ # @return [::String,nil]
345
+ # @!attribute [rw] credentials
346
+ # Credentials to send with calls. You may provide any of the following types:
347
+ # * (`String`) The path to a service account key file in JSON format
348
+ # * (`Hash`) A service account key as a Hash
349
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
350
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
351
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
352
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
353
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
354
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
355
+ # * (`nil`) indicating no credentials
356
+ # @return [::Object]
357
+ # @!attribute [rw] scope
358
+ # The OAuth scopes
359
+ # @return [::Array<::String>]
360
+ # @!attribute [rw] lib_name
361
+ # The library name as recorded in instrumentation and logging
362
+ # @return [::String]
363
+ # @!attribute [rw] lib_version
364
+ # The library version as recorded in instrumentation and logging
365
+ # @return [::String]
366
+ # @!attribute [rw] channel_args
367
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
368
+ # `GRPC::Core::Channel` object is provided as the credential.
369
+ # @return [::Hash]
370
+ # @!attribute [rw] interceptors
371
+ # An array of interceptors that are run before calls are executed.
372
+ # @return [::Array<::GRPC::ClientInterceptor>]
373
+ # @!attribute [rw] timeout
374
+ # The call timeout in seconds.
375
+ # @return [::Numeric]
376
+ # @!attribute [rw] metadata
377
+ # Additional gRPC headers to be sent with the call.
378
+ # @return [::Hash{::Symbol=>::String}]
379
+ # @!attribute [rw] retry_policy
380
+ # The retry policy. The value is a hash with the following keys:
381
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
382
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
383
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
384
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
385
+ # trigger a retry.
386
+ # @return [::Hash]
387
+ # @!attribute [rw] quota_project
388
+ # A separate project against which to charge quota.
389
+ # @return [::String]
390
+ # @!attribute [rw] universe_domain
391
+ # The universe domain within which to make requests. This determines the
392
+ # default endpoint URL. The default value of nil uses the environment
393
+ # universe (usually the default "googleapis.com" universe).
394
+ # @return [::String,nil]
395
+ #
396
+ class Configuration
397
+ extend ::Gapic::Config
398
+
399
+ # @private
400
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
401
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
402
+
403
+ config_attr :endpoint, nil, ::String, nil
404
+ config_attr :credentials, nil do |value|
405
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
406
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
407
+ allowed.any? { |klass| klass === value }
408
+ end
409
+ config_attr :scope, nil, ::String, ::Array, nil
410
+ config_attr :lib_name, nil, ::String, nil
411
+ config_attr :lib_version, nil, ::String, nil
412
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
413
+ config_attr :interceptors, nil, ::Array, nil
414
+ config_attr :timeout, nil, ::Numeric, nil
415
+ config_attr :metadata, nil, ::Hash, nil
416
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
417
+ config_attr :quota_project, nil, ::String, nil
418
+ config_attr :universe_domain, nil, ::String, nil
419
+
420
+ # @private
421
+ def initialize parent_config = nil
422
+ @parent_config = parent_config unless parent_config.nil?
423
+
424
+ yield self if block_given?
425
+ end
426
+
427
+ ##
428
+ # Configurations for individual RPCs
429
+ # @return [Rpcs]
430
+ #
431
+ def rpcs
432
+ @rpcs ||= begin
433
+ parent_rpcs = nil
434
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
435
+ Rpcs.new parent_rpcs
436
+ end
437
+ end
438
+
439
+ ##
440
+ # Configuration for the channel pool
441
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
442
+ #
443
+ def channel_pool
444
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
445
+ end
446
+
447
+ ##
448
+ # Configuration RPC class for the ProjectService API.
449
+ #
450
+ # Includes fields providing the configuration for each RPC in this service.
451
+ # Each configuration object is of type `Gapic::Config::Method` and includes
452
+ # the following configuration fields:
453
+ #
454
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
455
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
456
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
457
+ # include the following keys:
458
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
459
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
460
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
461
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
462
+ # trigger a retry.
463
+ #
464
+ class Rpcs
465
+ ##
466
+ # RPC-specific configuration for `provision_project`
467
+ # @return [::Gapic::Config::Method]
468
+ #
469
+ attr_reader :provision_project
470
+
471
+ # @private
472
+ def initialize parent_rpcs = nil
473
+ provision_project_config = parent_rpcs.provision_project if parent_rpcs.respond_to? :provision_project
474
+ @provision_project = ::Gapic::Config::Method.new provision_project_config
475
+
476
+ yield self if block_given?
477
+ end
478
+ end
479
+ end
480
+ end
481
+ end
482
+ end
483
+ end
484
+ end
485
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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 DiscoveryEngine
24
+ module V1
25
+ module ProjectService
26
+ # Credentials for the ProjectService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "GOOGLE_CLOUD_CREDENTIALS",
33
+ "GOOGLE_CLOUD_KEYFILE",
34
+ "GCLOUD_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
36
+ "GOOGLE_CLOUD_KEYFILE_JSON",
37
+ "GCLOUD_KEYFILE_JSON"
38
+ ]
39
+ self.paths = [
40
+ "~/.config/google_cloud/application_default_credentials.json"
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end