google-cloud-database_center-v1beta 0.a → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/database_center/v1beta/database_center/client.rb +841 -0
  6. data/lib/google/cloud/database_center/v1beta/database_center/credentials.rb +47 -0
  7. data/lib/google/cloud/database_center/v1beta/database_center/rest/client.rb +801 -0
  8. data/lib/google/cloud/database_center/v1beta/database_center/rest/service_stub.rb +259 -0
  9. data/lib/google/cloud/database_center/v1beta/database_center/rest.rb +51 -0
  10. data/lib/google/cloud/database_center/v1beta/database_center.rb +54 -0
  11. data/lib/google/cloud/database_center/v1beta/rest.rb +37 -0
  12. data/lib/google/cloud/database_center/v1beta/version.rb +8 -3
  13. data/lib/google/cloud/database_center/v1beta.rb +45 -0
  14. data/lib/google/cloud/databasecenter/v1beta/machine_config_pb.rb +44 -0
  15. data/lib/google/cloud/databasecenter/v1beta/maintenance_pb.rb +52 -0
  16. data/lib/google/cloud/databasecenter/v1beta/metric_data_pb.rb +47 -0
  17. data/lib/google/cloud/databasecenter/v1beta/operation_error_type_pb.rb +42 -0
  18. data/lib/google/cloud/databasecenter/v1beta/product_pb.rb +46 -0
  19. data/lib/google/cloud/databasecenter/v1beta/service_pb.rb +76 -0
  20. data/lib/google/cloud/databasecenter/v1beta/service_services_pb.rb +51 -0
  21. data/lib/google/cloud/databasecenter/v1beta/signals_pb.rb +78 -0
  22. data/lib/google/cloud/databasecenter/v1beta/suspension_reason_pb.rb +42 -0
  23. data/lib/google-cloud-database_center-v1beta.rb +21 -0
  24. data/proto_docs/README.md +4 -0
  25. data/proto_docs/google/api/client.rb +473 -0
  26. data/proto_docs/google/api/field_behavior.rb +85 -0
  27. data/proto_docs/google/api/launch_stage.rb +71 -0
  28. data/proto_docs/google/api/resource.rb +227 -0
  29. data/proto_docs/google/cloud/databasecenter/v1beta/machine_config.rb +43 -0
  30. data/proto_docs/google/cloud/databasecenter/v1beta/maintenance.rb +105 -0
  31. data/proto_docs/google/cloud/databasecenter/v1beta/metric_data.rb +92 -0
  32. data/proto_docs/google/cloud/databasecenter/v1beta/operation_error_type.rb +53 -0
  33. data/proto_docs/google/cloud/databasecenter/v1beta/product.rb +132 -0
  34. data/proto_docs/google/cloud/databasecenter/v1beta/service.rb +706 -0
  35. data/proto_docs/google/cloud/databasecenter/v1beta/signals.rb +848 -0
  36. data/proto_docs/google/cloud/databasecenter/v1beta/suspension_reason.rb +50 -0
  37. data/proto_docs/google/protobuf/duration.rb +98 -0
  38. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  39. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  40. data/proto_docs/google/type/date.rb +53 -0
  41. data/proto_docs/google/type/dayofweek.rb +49 -0
  42. data/proto_docs/google/type/timeofday.rb +45 -0
  43. metadata +82 -9
@@ -0,0 +1,841 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/databasecenter/v1beta/service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module DatabaseCenter
25
+ module V1beta
26
+ module DatabaseCenter
27
+ ##
28
+ # Client for the DatabaseCenter service.
29
+ #
30
+ # DatabaseCenter contains methods to query fleet view for database resources.
31
+ #
32
+ class Client
33
+ # @private
34
+ API_VERSION = ""
35
+
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "databasecenter.$UNIVERSE_DOMAIN$"
38
+
39
+ # @private
40
+ attr_reader :database_center_stub
41
+
42
+ ##
43
+ # Configure the DatabaseCenter Client class.
44
+ #
45
+ # See {::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all DatabaseCenter clients
51
+ # ::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "DatabaseCenter", "V1beta"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config
72
+ end
73
+ yield @configure if block_given?
74
+ @configure
75
+ end
76
+
77
+ ##
78
+ # Configure the DatabaseCenter Client instance.
79
+ #
80
+ # The configuration is set to the derived mode, meaning that values can be changed,
81
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
82
+ # should be made on {Client.configure}.
83
+ #
84
+ # See {::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client::Configuration}
85
+ # for a description of the configuration fields.
86
+ #
87
+ # @yield [config] Configure the Client client.
88
+ # @yieldparam config [Client::Configuration]
89
+ #
90
+ # @return [Client::Configuration]
91
+ #
92
+ def configure
93
+ yield @config if block_given?
94
+ @config
95
+ end
96
+
97
+ ##
98
+ # The effective universe domain
99
+ #
100
+ # @return [String]
101
+ #
102
+ def universe_domain
103
+ @database_center_stub.universe_domain
104
+ end
105
+
106
+ ##
107
+ # Create a new DatabaseCenter client object.
108
+ #
109
+ # @example
110
+ #
111
+ # # Create a client using the default configuration
112
+ # client = ::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.new
113
+ #
114
+ # # Create a client using a custom configuration
115
+ # client = ::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.new do |config|
116
+ # config.timeout = 10.0
117
+ # end
118
+ #
119
+ # @yield [config] Configure the DatabaseCenter client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ def initialize
123
+ # These require statements are intentionally placed here to initialize
124
+ # the gRPC module only when it's required.
125
+ # See https://github.com/googleapis/toolkit/issues/446
126
+ require "gapic/grpc"
127
+ require "google/cloud/databasecenter/v1beta/service_services_pb"
128
+
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
+ # but only if the default endpoint does not have a region prefix.
139
+ enable_self_signed_jwt = @config.endpoint.nil? ||
140
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
+ !@config.endpoint.split(".").first.include?("-"))
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+ @quota_project_id = @config.quota_project
148
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
149
+
150
+ @database_center_stub = ::Gapic::ServiceStub.new(
151
+ ::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Stub,
152
+ credentials: credentials,
153
+ endpoint: @config.endpoint,
154
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
155
+ universe_domain: @config.universe_domain,
156
+ channel_args: @config.channel_args,
157
+ interceptors: @config.interceptors,
158
+ channel_pool_config: @config.channel_pool,
159
+ logger: @config.logger
160
+ )
161
+
162
+ @database_center_stub.stub_logger&.info do |entry|
163
+ entry.set_system_name
164
+ entry.set_service
165
+ entry.message = "Created client for #{entry.service}"
166
+ entry.set_credentials_fields credentials
167
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
168
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
169
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
170
+ end
171
+ end
172
+
173
+ ##
174
+ # The logger used for request/response debug logging.
175
+ #
176
+ # @return [Logger]
177
+ #
178
+ def logger
179
+ @database_center_stub.logger
180
+ end
181
+
182
+ # Service calls
183
+
184
+ ##
185
+ # QueryProducts provides a list of all possible products which can be used to
186
+ # filter database resources.
187
+ #
188
+ # @overload query_products(request, options = nil)
189
+ # Pass arguments to `query_products` via a request object, either of type
190
+ # {::Google::Cloud::DatabaseCenter::V1beta::QueryProductsRequest} or an equivalent Hash.
191
+ #
192
+ # @param request [::Google::Cloud::DatabaseCenter::V1beta::QueryProductsRequest, ::Hash]
193
+ # A request object representing the call parameters. Required. To specify no
194
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
195
+ # @param options [::Gapic::CallOptions, ::Hash]
196
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
197
+ #
198
+ # @overload query_products(parent: nil, page_size: nil, page_token: nil)
199
+ # Pass arguments to `query_products` via keyword arguments. Note that at
200
+ # least one keyword argument is required. To specify no parameters, or to keep all
201
+ # the default parameter values, pass an empty Hash as a request object (see above).
202
+ #
203
+ # @param parent [::String]
204
+ # Required. Parent can be a project, a folder, or an organization.
205
+ #
206
+ # The allowed values are:
207
+ #
208
+ # * projects/\\{PROJECT_ID}/locations/\\{LOCATION}
209
+ # (e.g.,"projects/foo-bar/locations/us-central1")
210
+ # * projects/\\{PROJECT_NUMBER}/locations/\\{LOCATION}
211
+ # (e.g.,"projects/12345678/locations/us-central1")
212
+ # * folders/\\{FOLDER_NUMBER}/locations/\\{LOCATION}
213
+ # (e.g.,"folders/1234567/locations/us-central1")
214
+ # * organizations/\\{ORGANIZATION_NUMBER}/locations/\\{LOCATION}
215
+ # (e.g.,"organizations/123456/locations/us-central1")
216
+ # * projects/\\{PROJECT_ID} (e.g., "projects/foo-bar")
217
+ # * projects/\\{PROJECT_NUMBER} (e.g., "projects/12345678")
218
+ # * folders/\\{FOLDER_NUMBER} (e.g., "folders/1234567")
219
+ # * organizations/\\{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
220
+ # @param page_size [::Integer]
221
+ # Optional. If unspecified, at most 50 products will be returned.
222
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
223
+ # @param page_token [::String]
224
+ # Optional. A page token, received from a previous `ListLocations` call.
225
+ # Provide this to retrieve the subsequent page.
226
+ # All other parameters except page size should match the call that provided
227
+ # the page page token.
228
+ #
229
+ # @yield [response, operation] Access the result along with the RPC operation
230
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DatabaseCenter::V1beta::Product>]
231
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
232
+ #
233
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DatabaseCenter::V1beta::Product>]
234
+ #
235
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
236
+ #
237
+ # @example Basic example
238
+ # require "google/cloud/database_center/v1beta"
239
+ #
240
+ # # Create a client object. The client can be reused for multiple calls.
241
+ # client = Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.new
242
+ #
243
+ # # Create a request. To set request fields, pass in keyword arguments.
244
+ # request = Google::Cloud::DatabaseCenter::V1beta::QueryProductsRequest.new
245
+ #
246
+ # # Call the query_products method.
247
+ # result = client.query_products request
248
+ #
249
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
250
+ # # over elements, and API calls will be issued to fetch pages as needed.
251
+ # result.each do |item|
252
+ # # Each element is of type ::Google::Cloud::DatabaseCenter::V1beta::Product.
253
+ # p item
254
+ # end
255
+ #
256
+ def query_products request, options = nil
257
+ raise ::ArgumentError, "request must be provided" if request.nil?
258
+
259
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DatabaseCenter::V1beta::QueryProductsRequest
260
+
261
+ # Converts hash and nil to an options object
262
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
263
+
264
+ # Customize the options with defaults
265
+ metadata = @config.rpcs.query_products.metadata.to_h
266
+
267
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
268
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
269
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
270
+ gapic_version: ::Google::Cloud::DatabaseCenter::V1beta::VERSION
271
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
272
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
273
+
274
+ options.apply_defaults timeout: @config.rpcs.query_products.timeout,
275
+ metadata: metadata,
276
+ retry_policy: @config.rpcs.query_products.retry_policy
277
+
278
+ options.apply_defaults timeout: @config.timeout,
279
+ metadata: @config.metadata,
280
+ retry_policy: @config.retry_policy
281
+
282
+ @database_center_stub.call_rpc :query_products, request, options: options do |response, operation|
283
+ response = ::Gapic::PagedEnumerable.new @database_center_stub, :query_products, request, response, operation, options
284
+ yield response, operation if block_given?
285
+ throw :response, response
286
+ end
287
+ rescue ::GRPC::BadStatus => e
288
+ raise ::Google::Cloud::Error.from_error(e)
289
+ end
290
+
291
+ ##
292
+ # AggregateFleet provides statistics about the fleet grouped by various
293
+ # fields.
294
+ #
295
+ # @overload aggregate_fleet(request, options = nil)
296
+ # Pass arguments to `aggregate_fleet` via a request object, either of type
297
+ # {::Google::Cloud::DatabaseCenter::V1beta::AggregateFleetRequest} or an equivalent Hash.
298
+ #
299
+ # @param request [::Google::Cloud::DatabaseCenter::V1beta::AggregateFleetRequest, ::Hash]
300
+ # A request object representing the call parameters. Required. To specify no
301
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
302
+ # @param options [::Gapic::CallOptions, ::Hash]
303
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
304
+ #
305
+ # @overload aggregate_fleet(parent: nil, filter: nil, group_by: nil, order_by: nil, page_size: nil, page_token: nil, baseline_date: nil)
306
+ # Pass arguments to `aggregate_fleet` via keyword arguments. Note that at
307
+ # least one keyword argument is required. To specify no parameters, or to keep all
308
+ # the default parameter values, pass an empty Hash as a request object (see above).
309
+ #
310
+ # @param parent [::String]
311
+ # Required. Parent can be a project, a folder, or an organization. The search
312
+ # is limited to the resources within the `scope`.
313
+ #
314
+ # The allowed values are:
315
+ #
316
+ # * projects/\\{PROJECT_ID} (e.g., "projects/foo-bar")
317
+ # * projects/\\{PROJECT_NUMBER} (e.g., "projects/12345678")
318
+ # * folders/\\{FOLDER_NUMBER} (e.g., "folders/1234567")
319
+ # * organizations/\\{ORGANIZATION_NUMBER} (e.g.,
320
+ # "organizations/123456")
321
+ # @param filter [::String]
322
+ # Optional. The expression to filter resources.
323
+ #
324
+ # Supported fields are: `full_resource_name`, `resource_type`, `container`,
325
+ # `product.type`, `product.engine`, `product.version`, `location`,
326
+ # `labels`, `issues`, fields of availability_info, data_protection_info,
327
+ # 'resource_name', etc.
328
+ #
329
+ # The expression is a list of zero or more restrictions combined via logical
330
+ # operators `AND` and `OR`. When `AND` and `OR` are both used in the
331
+ # expression, parentheses must be appropriately used to group the
332
+ # combinations.
333
+ #
334
+ # Example: location="us-east1"
335
+ # Example: container="projects/123" OR container="projects/456"
336
+ # Example: (container="projects/123" OR
337
+ # container="projects/456") AND location="us-east1"
338
+ # @param group_by [::String]
339
+ # Optional. A field that statistics are grouped by.
340
+ # Valid values are any combination of the following:
341
+ # * container
342
+ # * product.type
343
+ # * product.engine
344
+ # * product.version
345
+ # * location
346
+ # * sub_resource_type
347
+ # * management_type
348
+ # * tag.key
349
+ # * tag.value
350
+ # * tag.source
351
+ # * tag.inherited
352
+ # * label.key
353
+ # * label.value
354
+ # * label.source
355
+ # * has_maintenance_schedule
356
+ # * has_deny_maintenance_schedules
357
+ # Comma separated list.
358
+ # @param order_by [::String]
359
+ # Optional. Valid values to order by are:
360
+ # * resource_groups_count
361
+ # * resources_count
362
+ # * and all fields supported by `group_by`
363
+ # The default order is ascending. Add "DESC" after the field name to indicate
364
+ # descending order. Add "ASC" after the field name to indicate ascending
365
+ # order. It supports ordering using multiple fields.
366
+ # For example:
367
+ # order_by = "resource_groups_count" sorts response in ascending order
368
+ # order_by = "resource_groups_count DESC" sorts response in descending order
369
+ # order_by = "product.type, product.version DESC, location" orders by type
370
+ # in ascending order, version in descending order and location in ascending
371
+ # order
372
+ # @param page_size [::Integer]
373
+ # Optional. If unspecified, at most 50 items will be returned.
374
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
375
+ # @param page_token [::String]
376
+ # Optional. A page token, received from a previous `AggregateFleet` call.
377
+ # Provide this to retrieve the subsequent page.
378
+ # All other parameters should match the parameters in the call that provided
379
+ # the page token except for page_size which can be different.
380
+ # @param baseline_date [::Google::Type::Date, ::Hash]
381
+ # Optional. The baseline date w.r.t. which the delta counts are calculated.
382
+ # If not set, delta counts are not included in the response and the response
383
+ # indicates the current state of the fleet.
384
+ #
385
+ # @yield [response, operation] Access the result along with the RPC operation
386
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DatabaseCenter::V1beta::AggregateFleetRow>]
387
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
388
+ #
389
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DatabaseCenter::V1beta::AggregateFleetRow>]
390
+ #
391
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
392
+ #
393
+ # @example Basic example
394
+ # require "google/cloud/database_center/v1beta"
395
+ #
396
+ # # Create a client object. The client can be reused for multiple calls.
397
+ # client = Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.new
398
+ #
399
+ # # Create a request. To set request fields, pass in keyword arguments.
400
+ # request = Google::Cloud::DatabaseCenter::V1beta::AggregateFleetRequest.new
401
+ #
402
+ # # Call the aggregate_fleet method.
403
+ # result = client.aggregate_fleet request
404
+ #
405
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
406
+ # # over elements, and API calls will be issued to fetch pages as needed.
407
+ # result.each do |item|
408
+ # # Each element is of type ::Google::Cloud::DatabaseCenter::V1beta::AggregateFleetRow.
409
+ # p item
410
+ # end
411
+ #
412
+ def aggregate_fleet request, options = nil
413
+ raise ::ArgumentError, "request must be provided" if request.nil?
414
+
415
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DatabaseCenter::V1beta::AggregateFleetRequest
416
+
417
+ # Converts hash and nil to an options object
418
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
419
+
420
+ # Customize the options with defaults
421
+ metadata = @config.rpcs.aggregate_fleet.metadata.to_h
422
+
423
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
424
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
425
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
426
+ gapic_version: ::Google::Cloud::DatabaseCenter::V1beta::VERSION
427
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
428
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
429
+
430
+ options.apply_defaults timeout: @config.rpcs.aggregate_fleet.timeout,
431
+ metadata: metadata,
432
+ retry_policy: @config.rpcs.aggregate_fleet.retry_policy
433
+
434
+ options.apply_defaults timeout: @config.timeout,
435
+ metadata: @config.metadata,
436
+ retry_policy: @config.retry_policy
437
+
438
+ @database_center_stub.call_rpc :aggregate_fleet, request, options: options do |response, operation|
439
+ response = ::Gapic::PagedEnumerable.new @database_center_stub, :aggregate_fleet, request, response, operation, options
440
+ yield response, operation if block_given?
441
+ throw :response, response
442
+ end
443
+ rescue ::GRPC::BadStatus => e
444
+ raise ::Google::Cloud::Error.from_error(e)
445
+ end
446
+
447
+ ##
448
+ # QueryDatabaseResourceGroups returns paginated results of database groups.
449
+ #
450
+ # @overload query_database_resource_groups(request, options = nil)
451
+ # Pass arguments to `query_database_resource_groups` via a request object, either of type
452
+ # {::Google::Cloud::DatabaseCenter::V1beta::QueryDatabaseResourceGroupsRequest} or an equivalent Hash.
453
+ #
454
+ # @param request [::Google::Cloud::DatabaseCenter::V1beta::QueryDatabaseResourceGroupsRequest, ::Hash]
455
+ # A request object representing the call parameters. Required. To specify no
456
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
457
+ # @param options [::Gapic::CallOptions, ::Hash]
458
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
459
+ #
460
+ # @overload query_database_resource_groups(parent: nil, filter: nil, signal_type_groups: nil, signal_filters: nil, order_by: nil, page_size: nil, page_token: nil)
461
+ # Pass arguments to `query_database_resource_groups` via keyword arguments. Note that at
462
+ # least one keyword argument is required. To specify no parameters, or to keep all
463
+ # the default parameter values, pass an empty Hash as a request object (see above).
464
+ #
465
+ # @param parent [::String]
466
+ # Required. Parent can be a project, a folder, or an organization. The search
467
+ # is limited to the resources within the `scope`.
468
+ #
469
+ # The allowed values are:
470
+ #
471
+ # * projects/\\{PROJECT_ID} (e.g., "projects/foo-bar")
472
+ # * projects/\\{PROJECT_NUMBER} (e.g., "projects/12345678")
473
+ # * folders/\\{FOLDER_NUMBER} (e.g., "folders/1234567")
474
+ # * organizations/\\{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
475
+ # @param filter [::String]
476
+ # Optional. The expression to filter resources.
477
+ #
478
+ # The following fields are filterable:
479
+ # * full_resource_name
480
+ # * resource_type
481
+ # * container
482
+ # * product.type
483
+ # * product.engine
484
+ # * product.version
485
+ # * location
486
+ # * labels
487
+ # * resource_category
488
+ # * machine_config.cpu_count
489
+ # * machine_config.memory_size_bytes
490
+ # * machine_config.shard_count
491
+ # * resource_name
492
+ # * tags
493
+ # * backupdr_config.backupdr_managed
494
+ # * edition
495
+ #
496
+ # The expression is a list of zero or more restrictions combined via logical
497
+ # operators `AND` and `OR`. When `AND` and `OR` are both used in the
498
+ # expression, parentheses must be appropriately used to group the
499
+ # combinations.
500
+ #
501
+ # Example: location="us-east1"
502
+ # Example: container="projects/123" OR container="projects/456"
503
+ # Example: (container="projects/123" OR
504
+ # container="projects/456") AND location="us-east1"
505
+ # Example: full_resource_name=~"test"
506
+ # Example: full_resource_name=~"test.*master"
507
+ # @param signal_type_groups [::Array<::Google::Cloud::DatabaseCenter::V1beta::SignalTypeGroup, ::Hash>]
508
+ # Optional. Groups of signal types that are requested.
509
+ # @param signal_filters [::Array<::Google::Cloud::DatabaseCenter::V1beta::SignalFilter, ::Hash>]
510
+ # Optional. Filters based on signals. The list will be ORed together and then
511
+ # ANDed with the `filters` field above.
512
+ # @param order_by [::String]
513
+ # Optional. A field that specifies the sort order of the results.
514
+ #
515
+ # The following fields are sortable:
516
+ # * full_resource_name
517
+ # * product.type
518
+ # * product.engine
519
+ # * product.version
520
+ # * container
521
+ # * issue_count
522
+ # * machine_config.vcpu_count
523
+ # * machine_config.memory_size_bytes
524
+ # * machine_config.shard_count
525
+ # * resource_name
526
+ # * issue_severity
527
+ # * signal_type
528
+ # * location
529
+ # * resource_type
530
+ # * instance_type
531
+ # * edition
532
+ # * metrics.p99_cpu_utilization
533
+ # * metrics.p95_cpu_utilization
534
+ # * metrics.current_storage_used_bytes
535
+ # * metrics.node_count
536
+ # * metrics.processing_unit_count
537
+ # * metrics.current_memory_used_bytes
538
+ # * metrics.peak_storage_utilization
539
+ # * metrics.peak_number_connections
540
+ # * metrics.peak_memory_utilization
541
+ #
542
+ # The default order is ascending. Add "DESC" after the field name to indicate
543
+ # descending order. Add "ASC" after the field name to indicate ascending
544
+ # order. It only supports a single field at a time.
545
+ #
546
+ # For example:
547
+ # order_by = "full_resource_name" sorts response in ascending order
548
+ # order_by = "full_resource_name DESC" sorts response in descending order
549
+ # order_by = "issue_count DESC" sorts response in descending order of
550
+ # count of all issues associated with a resource.
551
+ #
552
+ # More explicitly, order_by = "full_resource_name, product" is not supported.
553
+ # @param page_size [::Integer]
554
+ # Optional. If unspecified, at most 50 resource groups will be returned.
555
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
556
+ # @param page_token [::String]
557
+ # Optional. A page token, received from a previous
558
+ # `QueryDatabaseResourceGroupsRequest` call. Provide this to retrieve the
559
+ # subsequent page. All parameters except page_token should match the
560
+ # parameters in the call that provided the page page token.
561
+ #
562
+ # @yield [response, operation] Access the result along with the RPC operation
563
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DatabaseCenter::V1beta::DatabaseResourceGroup>]
564
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
565
+ #
566
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DatabaseCenter::V1beta::DatabaseResourceGroup>]
567
+ #
568
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
569
+ #
570
+ # @example Basic example
571
+ # require "google/cloud/database_center/v1beta"
572
+ #
573
+ # # Create a client object. The client can be reused for multiple calls.
574
+ # client = Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.new
575
+ #
576
+ # # Create a request. To set request fields, pass in keyword arguments.
577
+ # request = Google::Cloud::DatabaseCenter::V1beta::QueryDatabaseResourceGroupsRequest.new
578
+ #
579
+ # # Call the query_database_resource_groups method.
580
+ # result = client.query_database_resource_groups request
581
+ #
582
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
583
+ # # over elements, and API calls will be issued to fetch pages as needed.
584
+ # result.each do |item|
585
+ # # Each element is of type ::Google::Cloud::DatabaseCenter::V1beta::DatabaseResourceGroup.
586
+ # p item
587
+ # end
588
+ #
589
+ def query_database_resource_groups request, options = nil
590
+ raise ::ArgumentError, "request must be provided" if request.nil?
591
+
592
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DatabaseCenter::V1beta::QueryDatabaseResourceGroupsRequest
593
+
594
+ # Converts hash and nil to an options object
595
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
596
+
597
+ # Customize the options with defaults
598
+ metadata = @config.rpcs.query_database_resource_groups.metadata.to_h
599
+
600
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
601
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
602
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
603
+ gapic_version: ::Google::Cloud::DatabaseCenter::V1beta::VERSION
604
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
605
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
606
+
607
+ options.apply_defaults timeout: @config.rpcs.query_database_resource_groups.timeout,
608
+ metadata: metadata,
609
+ retry_policy: @config.rpcs.query_database_resource_groups.retry_policy
610
+
611
+ options.apply_defaults timeout: @config.timeout,
612
+ metadata: @config.metadata,
613
+ retry_policy: @config.retry_policy
614
+
615
+ @database_center_stub.call_rpc :query_database_resource_groups, request, options: options do |response, operation|
616
+ response = ::Gapic::PagedEnumerable.new @database_center_stub, :query_database_resource_groups, request, response, operation, options
617
+ yield response, operation if block_given?
618
+ throw :response, response
619
+ end
620
+ rescue ::GRPC::BadStatus => e
621
+ raise ::Google::Cloud::Error.from_error(e)
622
+ end
623
+
624
+ ##
625
+ # Configuration class for the DatabaseCenter API.
626
+ #
627
+ # This class represents the configuration for DatabaseCenter,
628
+ # providing control over timeouts, retry behavior, logging, transport
629
+ # parameters, and other low-level controls. Certain parameters can also be
630
+ # applied individually to specific RPCs. See
631
+ # {::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client::Configuration::Rpcs}
632
+ # for a list of RPCs that can be configured independently.
633
+ #
634
+ # Configuration can be applied globally to all clients, or to a single client
635
+ # on construction.
636
+ #
637
+ # @example
638
+ #
639
+ # # Modify the global config, setting the timeout for
640
+ # # query_products to 20 seconds,
641
+ # # and all remaining timeouts to 10 seconds.
642
+ # ::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.configure do |config|
643
+ # config.timeout = 10.0
644
+ # config.rpcs.query_products.timeout = 20.0
645
+ # end
646
+ #
647
+ # # Apply the above configuration only to a new client.
648
+ # client = ::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.new do |config|
649
+ # config.timeout = 10.0
650
+ # config.rpcs.query_products.timeout = 20.0
651
+ # end
652
+ #
653
+ # @!attribute [rw] endpoint
654
+ # A custom service endpoint, as a hostname or hostname:port. The default is
655
+ # nil, indicating to use the default endpoint in the current universe domain.
656
+ # @return [::String,nil]
657
+ # @!attribute [rw] credentials
658
+ # Credentials to send with calls. You may provide any of the following types:
659
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
660
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
661
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
662
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
663
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
664
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
665
+ # * (`nil`) indicating no credentials
666
+ #
667
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
668
+ # is deprecated. Providing an unvalidated credential configuration to
669
+ # Google APIs can compromise the security of your systems and data.
670
+ #
671
+ # @example
672
+ #
673
+ # # The recommended way to provide credentials is to use the `make_creds` method
674
+ # # on the appropriate credentials class for your environment.
675
+ #
676
+ # require "googleauth"
677
+ #
678
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
679
+ # json_key_io: ::File.open("/path/to/keyfile.json")
680
+ # )
681
+ #
682
+ # client = ::Google::Cloud::DatabaseCenter::V1beta::DatabaseCenter::Client.new do |config|
683
+ # config.credentials = credentials
684
+ # end
685
+ #
686
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
687
+ # external source for authentication to Google Cloud, you must validate it before
688
+ # providing it to a Google API client library. Providing an unvalidated credential
689
+ # configuration to Google APIs can compromise the security of your systems and data.
690
+ # For more information, refer to [Validate credential configurations from external
691
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
692
+ # @return [::Object]
693
+ # @!attribute [rw] scope
694
+ # The OAuth scopes
695
+ # @return [::Array<::String>]
696
+ # @!attribute [rw] lib_name
697
+ # The library name as recorded in instrumentation and logging
698
+ # @return [::String]
699
+ # @!attribute [rw] lib_version
700
+ # The library version as recorded in instrumentation and logging
701
+ # @return [::String]
702
+ # @!attribute [rw] channel_args
703
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
704
+ # `GRPC::Core::Channel` object is provided as the credential.
705
+ # @return [::Hash]
706
+ # @!attribute [rw] interceptors
707
+ # An array of interceptors that are run before calls are executed.
708
+ # @return [::Array<::GRPC::ClientInterceptor>]
709
+ # @!attribute [rw] timeout
710
+ # The call timeout in seconds.
711
+ # @return [::Numeric]
712
+ # @!attribute [rw] metadata
713
+ # Additional gRPC headers to be sent with the call.
714
+ # @return [::Hash{::Symbol=>::String}]
715
+ # @!attribute [rw] retry_policy
716
+ # The retry policy. The value is a hash with the following keys:
717
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
718
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
719
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
720
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
721
+ # trigger a retry.
722
+ # @return [::Hash]
723
+ # @!attribute [rw] quota_project
724
+ # A separate project against which to charge quota.
725
+ # @return [::String]
726
+ # @!attribute [rw] universe_domain
727
+ # The universe domain within which to make requests. This determines the
728
+ # default endpoint URL. The default value of nil uses the environment
729
+ # universe (usually the default "googleapis.com" universe).
730
+ # @return [::String,nil]
731
+ # @!attribute [rw] logger
732
+ # A custom logger to use for request/response debug logging, or the value
733
+ # `:default` (the default) to construct a default logger, or `nil` to
734
+ # explicitly disable logging.
735
+ # @return [::Logger,:default,nil]
736
+ #
737
+ class Configuration
738
+ extend ::Gapic::Config
739
+
740
+ # @private
741
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
742
+ DEFAULT_ENDPOINT = "databasecenter.googleapis.com"
743
+
744
+ config_attr :endpoint, nil, ::String, nil
745
+ config_attr :credentials, nil do |value|
746
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
747
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
748
+ allowed.any? { |klass| klass === value }
749
+ end
750
+ config_attr :scope, nil, ::String, ::Array, nil
751
+ config_attr :lib_name, nil, ::String, nil
752
+ config_attr :lib_version, nil, ::String, nil
753
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
754
+ config_attr :interceptors, nil, ::Array, nil
755
+ config_attr :timeout, nil, ::Numeric, nil
756
+ config_attr :metadata, nil, ::Hash, nil
757
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
758
+ config_attr :quota_project, nil, ::String, nil
759
+ config_attr :universe_domain, nil, ::String, nil
760
+ config_attr :logger, :default, ::Logger, nil, :default
761
+
762
+ # @private
763
+ def initialize parent_config = nil
764
+ @parent_config = parent_config unless parent_config.nil?
765
+
766
+ yield self if block_given?
767
+ end
768
+
769
+ ##
770
+ # Configurations for individual RPCs
771
+ # @return [Rpcs]
772
+ #
773
+ def rpcs
774
+ @rpcs ||= begin
775
+ parent_rpcs = nil
776
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
777
+ Rpcs.new parent_rpcs
778
+ end
779
+ end
780
+
781
+ ##
782
+ # Configuration for the channel pool
783
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
784
+ #
785
+ def channel_pool
786
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
787
+ end
788
+
789
+ ##
790
+ # Configuration RPC class for the DatabaseCenter API.
791
+ #
792
+ # Includes fields providing the configuration for each RPC in this service.
793
+ # Each configuration object is of type `Gapic::Config::Method` and includes
794
+ # the following configuration fields:
795
+ #
796
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
797
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
798
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
799
+ # include the following keys:
800
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
801
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
802
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
803
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
804
+ # trigger a retry.
805
+ #
806
+ class Rpcs
807
+ ##
808
+ # RPC-specific configuration for `query_products`
809
+ # @return [::Gapic::Config::Method]
810
+ #
811
+ attr_reader :query_products
812
+ ##
813
+ # RPC-specific configuration for `aggregate_fleet`
814
+ # @return [::Gapic::Config::Method]
815
+ #
816
+ attr_reader :aggregate_fleet
817
+ ##
818
+ # RPC-specific configuration for `query_database_resource_groups`
819
+ # @return [::Gapic::Config::Method]
820
+ #
821
+ attr_reader :query_database_resource_groups
822
+
823
+ # @private
824
+ def initialize parent_rpcs = nil
825
+ query_products_config = parent_rpcs.query_products if parent_rpcs.respond_to? :query_products
826
+ @query_products = ::Gapic::Config::Method.new query_products_config
827
+ aggregate_fleet_config = parent_rpcs.aggregate_fleet if parent_rpcs.respond_to? :aggregate_fleet
828
+ @aggregate_fleet = ::Gapic::Config::Method.new aggregate_fleet_config
829
+ query_database_resource_groups_config = parent_rpcs.query_database_resource_groups if parent_rpcs.respond_to? :query_database_resource_groups
830
+ @query_database_resource_groups = ::Gapic::Config::Method.new query_database_resource_groups_config
831
+
832
+ yield self if block_given?
833
+ end
834
+ end
835
+ end
836
+ end
837
+ end
838
+ end
839
+ end
840
+ end
841
+ end