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