google-cloud-discovery_engine-v1beta 0.11.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +9 -3
  3. data/lib/google/cloud/discovery_engine/v1beta/completion_service/operations.rb +13 -5
  4. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +9 -3
  5. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/operations.rb +35 -6
  6. data/lib/google/cloud/discovery_engine/v1beta/control_service/client.rb +875 -0
  7. data/lib/google/cloud/discovery_engine/v1beta/control_service/credentials.rb +47 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/control_service/paths.rb +167 -0
  9. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/client.rb +814 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/service_stub.rb +440 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1beta/control_service.rb +58 -0
  13. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +31 -15
  14. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +31 -15
  15. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/client.rb +15 -7
  16. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/operations.rb +13 -5
  17. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/client.rb +15 -7
  18. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/operations.rb +35 -6
  19. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +24 -15
  20. data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +13 -5
  21. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +24 -15
  22. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +35 -6
  23. data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +19 -8
  24. data/lib/google/cloud/discovery_engine/v1beta/engine_service/operations.rb +13 -5
  25. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +19 -8
  26. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/operations.rb +35 -6
  27. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/client.rb +824 -0
  28. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/credentials.rb +47 -0
  29. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/operations.rb +809 -0
  30. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/paths.rb +250 -0
  31. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/client.rb +770 -0
  32. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/operations.rb +1106 -0
  33. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/service_stub.rb +306 -0
  34. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest.rb +54 -0
  35. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service.rb +57 -0
  36. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +25 -3
  37. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +25 -3
  38. data/lib/google/cloud/discovery_engine/v1beta/project_service/client.rb +485 -0
  39. data/lib/google/cloud/discovery_engine/v1beta/project_service/credentials.rb +47 -0
  40. data/lib/google/cloud/discovery_engine/v1beta/project_service/operations.rb +809 -0
  41. data/lib/google/cloud/discovery_engine/v1beta/project_service/paths.rb +47 -0
  42. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/client.rb +452 -0
  43. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/operations.rb +1106 -0
  44. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/service_stub.rb +129 -0
  45. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest.rb +54 -0
  46. data/lib/google/cloud/discovery_engine/v1beta/project_service.rb +57 -0
  47. data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +24 -2
  48. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +24 -2
  49. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +24 -19
  50. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/paths.rb +66 -0
  51. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +24 -19
  52. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +5 -0
  53. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/client.rb +1035 -0
  54. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/credentials.rb +47 -0
  55. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/operations.rb +809 -0
  56. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/paths.rb +73 -0
  57. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/client.rb +967 -0
  58. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/operations.rb +1106 -0
  59. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/service_stub.rb +426 -0
  60. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest.rb +54 -0
  61. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service.rb +57 -0
  62. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/client.rb +911 -0
  63. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/credentials.rb +47 -0
  64. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/paths.rb +69 -0
  65. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/client.rb +850 -0
  66. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/service_stub.rb +366 -0
  67. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest.rb +53 -0
  68. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service.rb +56 -0
  69. data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +18 -10
  70. data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +13 -5
  71. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +18 -10
  72. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +35 -6
  73. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +25 -12
  74. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +25 -12
  75. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/client.rb +104 -2
  76. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/operations.rb +13 -5
  77. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/client.rb +97 -2
  78. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/operations.rb +35 -6
  79. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/service_stub.rb +59 -0
  80. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/client.rb +9 -3
  81. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/client.rb +9 -3
  82. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/client.rb +27 -12
  83. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/operations.rb +13 -5
  84. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/client.rb +27 -12
  85. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/operations.rb +35 -6
  86. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +23 -6
  87. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +13 -5
  88. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/paths.rb +21 -0
  89. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +23 -6
  90. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +35 -6
  91. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +8 -0
  92. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  93. data/lib/google/cloud/discovery_engine/v1beta.rb +5 -0
  94. data/lib/google/cloud/discoveryengine/v1beta/answer_pb.rb +3 -1
  95. data/lib/google/cloud/discoveryengine/v1beta/chunk_pb.rb +50 -0
  96. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +2 -1
  97. data/lib/google/cloud/discoveryengine/v1beta/control_pb.rb +55 -0
  98. data/lib/google/cloud/discoveryengine/v1beta/control_service_pb.rb +57 -0
  99. data/lib/google/cloud/discoveryengine/v1beta/control_service_services_pb.rb +69 -0
  100. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +1 -1
  101. data/lib/google/cloud/discoveryengine/v1beta/custom_tuning_model_pb.rb +48 -0
  102. data/lib/google/cloud/discoveryengine/v1beta/document_processing_config_pb.rb +4 -1
  103. data/lib/google/cloud/discoveryengine/v1beta/document_service_services_pb.rb +1 -1
  104. data/lib/google/cloud/discoveryengine/v1beta/engine_pb.rb +1 -1
  105. data/lib/google/cloud/discoveryengine/v1beta/evaluation_pb.rb +56 -0
  106. data/lib/google/cloud/discoveryengine/v1beta/evaluation_service_pb.rb +59 -0
  107. data/lib/google/cloud/discoveryengine/v1beta/evaluation_service_services_pb.rb +57 -0
  108. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_pb.rb +1 -1
  109. data/lib/google/cloud/discoveryengine/v1beta/grounding_pb.rb +1 -1
  110. data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +7 -1
  111. data/lib/google/cloud/discoveryengine/v1beta/project_pb.rb +49 -0
  112. data/lib/google/cloud/discoveryengine/v1beta/project_service_pb.rb +50 -0
  113. data/lib/google/cloud/discoveryengine/v1beta/project_service_services_pb.rb +51 -0
  114. data/lib/google/cloud/discoveryengine/v1beta/rank_service_pb.rb +1 -1
  115. data/lib/google/cloud/discoveryengine/v1beta/sample_query_pb.rb +49 -0
  116. data/lib/google/cloud/discoveryengine/v1beta/sample_query_service_pb.rb +59 -0
  117. data/lib/google/cloud/discoveryengine/v1beta/sample_query_service_services_pb.rb +63 -0
  118. data/lib/google/cloud/discoveryengine/v1beta/sample_query_set_pb.rb +47 -0
  119. data/lib/google/cloud/discoveryengine/v1beta/sample_query_set_service_pb.rb +57 -0
  120. data/lib/google/cloud/discoveryengine/v1beta/sample_query_set_service_services_pb.rb +59 -0
  121. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +5 -1
  122. data/lib/google/cloud/discoveryengine/v1beta/search_tuning_service_pb.rb +5 -1
  123. data/lib/google/cloud/discoveryengine/v1beta/search_tuning_service_services_pb.rb +2 -0
  124. data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_pb.rb +1 -1
  125. data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +1 -1
  126. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_pb.rb +1 -1
  127. data/lib/google/cloud/discoveryengine/v1beta/user_event_service_services_pb.rb +1 -1
  128. data/proto_docs/google/api/client.rb +14 -10
  129. data/proto_docs/google/api/resource.rb +7 -2
  130. data/proto_docs/google/cloud/discoveryengine/v1beta/answer.rb +9 -1
  131. data/proto_docs/google/cloud/discoveryengine/v1beta/chunk.rb +119 -0
  132. data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +16 -0
  133. data/proto_docs/google/cloud/discoveryengine/v1beta/control.rb +209 -0
  134. data/proto_docs/google/cloud/discoveryengine/v1beta/control_service.rb +126 -0
  135. data/proto_docs/google/cloud/discoveryengine/v1beta/conversation.rb +2 -2
  136. data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +29 -5
  137. data/proto_docs/google/cloud/discoveryengine/v1beta/custom_tuning_model.rb +75 -0
  138. data/proto_docs/google/cloud/discoveryengine/v1beta/data_store_service.rb +2 -2
  139. data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +1 -1
  140. data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +44 -2
  141. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +6 -7
  142. data/proto_docs/google/cloud/discoveryengine/v1beta/engine.rb +3 -3
  143. data/proto_docs/google/cloud/discoveryengine/v1beta/evaluation.rb +223 -0
  144. data/proto_docs/google/cloud/discoveryengine/v1beta/evaluation_service.rb +194 -0
  145. data/proto_docs/google/cloud/discoveryengine/v1beta/grounded_generation_service.rb +39 -1
  146. data/proto_docs/google/cloud/discoveryengine/v1beta/grounding.rb +3 -0
  147. data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +89 -4
  148. data/proto_docs/google/cloud/discoveryengine/v1beta/project.rb +106 -0
  149. data/proto_docs/google/cloud/discoveryengine/v1beta/project_service.rb +57 -0
  150. data/proto_docs/google/cloud/discoveryengine/v1beta/rank_service.rb +28 -0
  151. data/proto_docs/google/cloud/discoveryengine/v1beta/recommendation_service.rb +20 -19
  152. data/proto_docs/google/cloud/discoveryengine/v1beta/sample_query.rb +82 -0
  153. data/proto_docs/google/cloud/discoveryengine/v1beta/sample_query_service.rb +179 -0
  154. data/proto_docs/google/cloud/discoveryengine/v1beta/sample_query_set.rb +57 -0
  155. data/proto_docs/google/cloud/discoveryengine/v1beta/sample_query_set_service.rb +186 -0
  156. data/proto_docs/google/cloud/discoveryengine/v1beta/schema_service.rb +5 -5
  157. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +95 -28
  158. data/proto_docs/google/cloud/discoveryengine/v1beta/search_tuning_service.rb +31 -0
  159. data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config.rb +11 -5
  160. data/proto_docs/google/cloud/discoveryengine/v1beta/session.rb +4 -1
  161. data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine.rb +3 -0
  162. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +24 -3
  163. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event_service.rb +13 -1
  164. metadata +72 -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 V1beta
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/v1beta/project_service_pb"
21
+ require "google/cloud/discovery_engine/v1beta/project_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module DiscoveryEngine
27
+ module V1beta
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::V1beta::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::V1beta::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::V1beta::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", "V1beta"]
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::V1beta::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::V1beta::ProjectService::Rest::Client.new
124
+ #
125
+ # # Create a client using a custom configuration
126
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::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::V1beta::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::V1beta::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::V1beta::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::V1beta::ProvisionProjectRequest} or an equivalent Hash.
205
+ #
206
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::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::V1beta::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/v1beta"
241
+ #
242
+ # # Create a client object. The client can be reused for multiple calls.
243
+ # client = Google::Cloud::DiscoveryEngine::V1beta::ProjectService::Rest::Client.new
244
+ #
245
+ # # Create a request. To set request fields, pass in keyword arguments.
246
+ # request = Google::Cloud::DiscoveryEngine::V1beta::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::V1beta::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::V1beta::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::V1beta::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::V1beta::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::V1beta::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