google-cloud-logging-v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +75 -0
  6. data/lib/google-cloud-logging-v2.rb +21 -0
  7. data/lib/google/cloud/logging/v2.rb +37 -0
  8. data/lib/google/cloud/logging/v2/config_service.rb +49 -0
  9. data/lib/google/cloud/logging/v2/config_service/client.rb +1723 -0
  10. data/lib/google/cloud/logging/v2/config_service/credentials.rb +54 -0
  11. data/lib/google/cloud/logging/v2/config_service/paths.rb +413 -0
  12. data/lib/google/cloud/logging/v2/logging_service.rb +49 -0
  13. data/lib/google/cloud/logging/v2/logging_service/client.rb +826 -0
  14. data/lib/google/cloud/logging/v2/logging_service/credentials.rb +55 -0
  15. data/lib/google/cloud/logging/v2/logging_service/paths.rb +154 -0
  16. data/lib/google/cloud/logging/v2/metrics_service.rb +49 -0
  17. data/lib/google/cloud/logging/v2/metrics_service/client.rb +726 -0
  18. data/lib/google/cloud/logging/v2/metrics_service/credentials.rb +55 -0
  19. data/lib/google/cloud/logging/v2/metrics_service/paths.rb +64 -0
  20. data/lib/google/cloud/logging/v2/version.rb +28 -0
  21. data/lib/google/logging/type/http_request_pb.rb +38 -0
  22. data/lib/google/logging/type/log_severity_pb.rb +31 -0
  23. data/lib/google/logging/v2/log_entry_pb.rb +62 -0
  24. data/lib/google/logging/v2/logging_config_pb.rb +176 -0
  25. data/lib/google/logging/v2/logging_config_services_pb.rb +113 -0
  26. data/lib/google/logging/v2/logging_metrics_pb.rb +75 -0
  27. data/lib/google/logging/v2/logging_metrics_services_pb.rb +53 -0
  28. data/lib/google/logging/v2/logging_pb.rb +83 -0
  29. data/lib/google/logging/v2/logging_services_pb.rb +65 -0
  30. data/proto_docs/README.md +4 -0
  31. data/proto_docs/google/api/distribution.rb +225 -0
  32. data/proto_docs/google/api/field_behavior.rb +59 -0
  33. data/proto_docs/google/api/label.rb +49 -0
  34. data/proto_docs/google/api/metric.rb +203 -0
  35. data/proto_docs/google/api/monitored_resource.rb +137 -0
  36. data/proto_docs/google/api/resource.rb +247 -0
  37. data/proto_docs/google/logging/type/http_request.rb +95 -0
  38. data/proto_docs/google/logging/type/log_severity.rb +71 -0
  39. data/proto_docs/google/logging/v2/log_entry.rb +203 -0
  40. data/proto_docs/google/logging/v2/logging.rb +303 -0
  41. data/proto_docs/google/logging/v2/logging_config.rb +735 -0
  42. data/proto_docs/google/logging/v2/logging_metrics.rb +256 -0
  43. data/proto_docs/google/protobuf/any.rb +138 -0
  44. data/proto_docs/google/protobuf/duration.rb +98 -0
  45. data/proto_docs/google/protobuf/empty.rb +36 -0
  46. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  47. data/proto_docs/google/protobuf/struct.rb +96 -0
  48. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  49. data/proto_docs/google/rpc/status.rb +46 -0
  50. metadata +231 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/logging/v2"
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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/logging/v2/config_service"
20
+ require "google/cloud/logging/v2/logging_service"
21
+ require "google/cloud/logging/v2/metrics_service"
22
+ require "google/cloud/logging/v2/version"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Logging
27
+ ##
28
+ # To load this package, including all its services, and instantiate a client:
29
+ #
30
+ # require "google/cloud/logging/v2"
31
+ # client = ::Google::Cloud::Logging::V2::ConfigService::Client.new
32
+ #
33
+ module V2
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/logging/v2/version"
24
+
25
+ require "google/cloud/logging/v2/config_service/credentials"
26
+ require "google/cloud/logging/v2/config_service/paths"
27
+ require "google/cloud/logging/v2/config_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Logging
32
+ module V2
33
+ ##
34
+ # Service for configuring sinks used to route log entries.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/logging/v2/config_service"
39
+ # client = ::Google::Cloud::Logging::V2::ConfigService::Client.new
40
+ #
41
+ module ConfigService
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "config_service", "helpers.rb"
49
+ require "google/cloud/logging/v2/config_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,1723 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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/logging/v2/logging_config_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Logging
25
+ module V2
26
+ module ConfigService
27
+ ##
28
+ # Client for the ConfigService service.
29
+ #
30
+ # Service for configuring sinks used to route log entries.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :config_service_stub
37
+
38
+ ##
39
+ # Configure the ConfigService Client class.
40
+ #
41
+ # See {::Google::Cloud::Logging::V2::ConfigService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all ConfigService clients:
47
+ #
48
+ # ::Google::Cloud::Logging::V2::ConfigService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Logging", "V2"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const&.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.list_sinks.timeout = 60.0
69
+ default_config.rpcs.list_sinks.retry_policy = {
70
+ initial_delay: 0.1,
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
74
+ }
75
+
76
+ default_config.rpcs.get_sink.timeout = 60.0
77
+ default_config.rpcs.get_sink.retry_policy = {
78
+ initial_delay: 0.1,
79
+ max_delay: 60.0,
80
+ multiplier: 1.3,
81
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
82
+ }
83
+
84
+ default_config.rpcs.create_sink.timeout = 120.0
85
+
86
+ default_config.rpcs.update_sink.timeout = 60.0
87
+ default_config.rpcs.update_sink.retry_policy = {
88
+ initial_delay: 0.1,
89
+ max_delay: 60.0,
90
+ multiplier: 1.3,
91
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
92
+ }
93
+
94
+ default_config.rpcs.delete_sink.timeout = 60.0
95
+ default_config.rpcs.delete_sink.retry_policy = {
96
+ initial_delay: 0.1,
97
+ max_delay: 60.0,
98
+ multiplier: 1.3,
99
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
100
+ }
101
+
102
+ default_config.rpcs.list_exclusions.timeout = 60.0
103
+ default_config.rpcs.list_exclusions.retry_policy = {
104
+ initial_delay: 0.1,
105
+ max_delay: 60.0,
106
+ multiplier: 1.3,
107
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
108
+ }
109
+
110
+ default_config.rpcs.get_exclusion.timeout = 60.0
111
+ default_config.rpcs.get_exclusion.retry_policy = {
112
+ initial_delay: 0.1,
113
+ max_delay: 60.0,
114
+ multiplier: 1.3,
115
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
116
+ }
117
+
118
+ default_config.rpcs.create_exclusion.timeout = 120.0
119
+
120
+ default_config.rpcs.update_exclusion.timeout = 120.0
121
+
122
+ default_config.rpcs.delete_exclusion.timeout = 60.0
123
+ default_config.rpcs.delete_exclusion.retry_policy = {
124
+ initial_delay: 0.1,
125
+ max_delay: 60.0,
126
+ multiplier: 1.3,
127
+ retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
128
+ }
129
+
130
+ default_config
131
+ end
132
+ yield @configure if block_given?
133
+ @configure
134
+ end
135
+
136
+ ##
137
+ # Configure the ConfigService Client instance.
138
+ #
139
+ # The configuration is set to the derived mode, meaning that values can be changed,
140
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
141
+ # should be made on {Client.configure}.
142
+ #
143
+ # See {::Google::Cloud::Logging::V2::ConfigService::Client::Configuration}
144
+ # for a description of the configuration fields.
145
+ #
146
+ # @yield [config] Configure the Client client.
147
+ # @yieldparam config [Client::Configuration]
148
+ #
149
+ # @return [Client::Configuration]
150
+ #
151
+ def configure
152
+ yield @config if block_given?
153
+ @config
154
+ end
155
+
156
+ ##
157
+ # Create a new ConfigService client object.
158
+ #
159
+ # ## Examples
160
+ #
161
+ # To create a new ConfigService client with the default
162
+ # configuration:
163
+ #
164
+ # client = ::Google::Cloud::Logging::V2::ConfigService::Client.new
165
+ #
166
+ # To create a new ConfigService client with a custom
167
+ # configuration:
168
+ #
169
+ # client = ::Google::Cloud::Logging::V2::ConfigService::Client.new do |config|
170
+ # config.timeout = 10.0
171
+ # end
172
+ #
173
+ # @yield [config] Configure the ConfigService client.
174
+ # @yieldparam config [Client::Configuration]
175
+ #
176
+ def initialize
177
+ # These require statements are intentionally placed here to initialize
178
+ # the gRPC module only when it's required.
179
+ # See https://github.com/googleapis/toolkit/issues/446
180
+ require "gapic/grpc"
181
+ require "google/logging/v2/logging_config_services_pb"
182
+
183
+ # Create the configuration object
184
+ @config = Configuration.new Client.configure
185
+
186
+ # Yield the configuration if needed
187
+ yield @config if block_given?
188
+
189
+ # Create credentials
190
+ credentials = @config.credentials
191
+ credentials ||= Credentials.default scope: @config.scope
192
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
193
+ credentials = Credentials.new credentials, scope: @config.scope
194
+ end
195
+ @quota_project_id = @config.quota_project
196
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
197
+
198
+ @config_service_stub = ::Gapic::ServiceStub.new(
199
+ ::Google::Cloud::Logging::V2::ConfigServiceV2::Stub,
200
+ credentials: credentials,
201
+ endpoint: @config.endpoint,
202
+ channel_args: @config.channel_args,
203
+ interceptors: @config.interceptors
204
+ )
205
+ end
206
+
207
+ # Service calls
208
+
209
+ ##
210
+ # Lists buckets (Beta).
211
+ #
212
+ # @overload list_buckets(request, options = nil)
213
+ # Pass arguments to `list_buckets` via a request object, either of type
214
+ # {::Google::Cloud::Logging::V2::ListBucketsRequest} or an equivalent Hash.
215
+ #
216
+ # @param request [::Google::Cloud::Logging::V2::ListBucketsRequest, ::Hash]
217
+ # A request object representing the call parameters. Required. To specify no
218
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
219
+ # @param options [::Gapic::CallOptions, ::Hash]
220
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
221
+ #
222
+ # @overload list_buckets(parent: nil, page_token: nil, page_size: nil)
223
+ # Pass arguments to `list_buckets` via keyword arguments. Note that at
224
+ # least one keyword argument is required. To specify no parameters, or to keep all
225
+ # the default parameter values, pass an empty Hash as a request object (see above).
226
+ #
227
+ # @param parent [::String]
228
+ # Required. The parent resource whose buckets are to be listed:
229
+ #
230
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
231
+ # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
232
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
233
+ # "folders/[FOLDER_ID]/locations/[LOCATION_ID]"
234
+ #
235
+ # Note: The locations portion of the resource must be specified, but
236
+ # supplying the character `-` in place of [LOCATION_ID] will return all
237
+ # buckets.
238
+ # @param page_token [::String]
239
+ # Optional. If present, then retrieve the next batch of results from the
240
+ # preceding call to this method. `pageToken` must be the value of
241
+ # `nextPageToken` from the previous response. The values of other method
242
+ # parameters should be identical to those in the previous call.
243
+ # @param page_size [::Integer]
244
+ # Optional. The maximum number of results to return from this request.
245
+ # Non-positive values are ignored. The presence of `nextPageToken` in the
246
+ # response indicates that more results might be available.
247
+ #
248
+ # @yield [response, operation] Access the result along with the RPC operation
249
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogBucket>]
250
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
251
+ #
252
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogBucket>]
253
+ #
254
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
255
+ #
256
+ def list_buckets request, options = nil
257
+ raise ::ArgumentError, "request must be provided" if request.nil?
258
+
259
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListBucketsRequest
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.list_buckets.metadata.to_h
266
+
267
+ # Set x-goog-api-client and x-goog-user-project 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::Logging::V2::VERSION
271
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
272
+
273
+ header_params = {
274
+ "parent" => request.parent
275
+ }
276
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
277
+ metadata[:"x-goog-request-params"] ||= request_params_header
278
+
279
+ options.apply_defaults timeout: @config.rpcs.list_buckets.timeout,
280
+ metadata: metadata,
281
+ retry_policy: @config.rpcs.list_buckets.retry_policy
282
+ options.apply_defaults metadata: @config.metadata,
283
+ retry_policy: @config.retry_policy
284
+
285
+ @config_service_stub.call_rpc :list_buckets, request, options: options do |response, operation|
286
+ response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_buckets, request, response, operation, options
287
+ yield response, operation if block_given?
288
+ return response
289
+ end
290
+ rescue ::GRPC::BadStatus => e
291
+ raise ::Google::Cloud::Error.from_error(e)
292
+ end
293
+
294
+ ##
295
+ # Gets a bucket (Beta).
296
+ #
297
+ # @overload get_bucket(request, options = nil)
298
+ # Pass arguments to `get_bucket` via a request object, either of type
299
+ # {::Google::Cloud::Logging::V2::GetBucketRequest} or an equivalent Hash.
300
+ #
301
+ # @param request [::Google::Cloud::Logging::V2::GetBucketRequest, ::Hash]
302
+ # A request object representing the call parameters. Required. To specify no
303
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
304
+ # @param options [::Gapic::CallOptions, ::Hash]
305
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
306
+ #
307
+ # @overload get_bucket(name: nil)
308
+ # Pass arguments to `get_bucket` via keyword arguments. Note that at
309
+ # least one keyword argument is required. To specify no parameters, or to keep all
310
+ # the default parameter values, pass an empty Hash as a request object (see above).
311
+ #
312
+ # @param name [::String]
313
+ # Required. The resource name of the bucket:
314
+ #
315
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
316
+ # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
317
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
318
+ # "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
319
+ #
320
+ # Example:
321
+ # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id"`.
322
+ #
323
+ # @yield [response, operation] Access the result along with the RPC operation
324
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogBucket]
325
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
326
+ #
327
+ # @return [::Google::Cloud::Logging::V2::LogBucket]
328
+ #
329
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
330
+ #
331
+ def get_bucket request, options = nil
332
+ raise ::ArgumentError, "request must be provided" if request.nil?
333
+
334
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetBucketRequest
335
+
336
+ # Converts hash and nil to an options object
337
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
338
+
339
+ # Customize the options with defaults
340
+ metadata = @config.rpcs.get_bucket.metadata.to_h
341
+
342
+ # Set x-goog-api-client and x-goog-user-project headers
343
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
344
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
345
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
346
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
347
+
348
+ header_params = {
349
+ "name" => request.name
350
+ }
351
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
352
+ metadata[:"x-goog-request-params"] ||= request_params_header
353
+
354
+ options.apply_defaults timeout: @config.rpcs.get_bucket.timeout,
355
+ metadata: metadata,
356
+ retry_policy: @config.rpcs.get_bucket.retry_policy
357
+ options.apply_defaults metadata: @config.metadata,
358
+ retry_policy: @config.retry_policy
359
+
360
+ @config_service_stub.call_rpc :get_bucket, request, options: options do |response, operation|
361
+ yield response, operation if block_given?
362
+ return response
363
+ end
364
+ rescue ::GRPC::BadStatus => e
365
+ raise ::Google::Cloud::Error.from_error(e)
366
+ end
367
+
368
+ ##
369
+ # Updates a bucket. This method replaces the following fields in the
370
+ # existing bucket with values from the new bucket: `retention_period`
371
+ #
372
+ # If the retention period is decreased and the bucket is locked,
373
+ # FAILED_PRECONDITION will be returned.
374
+ #
375
+ # If the bucket has a LifecycleState of DELETE_REQUESTED, FAILED_PRECONDITION
376
+ # will be returned.
377
+ #
378
+ # A buckets region may not be modified after it is created.
379
+ # This method is in Beta.
380
+ #
381
+ # @overload update_bucket(request, options = nil)
382
+ # Pass arguments to `update_bucket` via a request object, either of type
383
+ # {::Google::Cloud::Logging::V2::UpdateBucketRequest} or an equivalent Hash.
384
+ #
385
+ # @param request [::Google::Cloud::Logging::V2::UpdateBucketRequest, ::Hash]
386
+ # A request object representing the call parameters. Required. To specify no
387
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
388
+ # @param options [::Gapic::CallOptions, ::Hash]
389
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
390
+ #
391
+ # @overload update_bucket(name: nil, bucket: nil, update_mask: nil)
392
+ # Pass arguments to `update_bucket` via keyword arguments. Note that at
393
+ # least one keyword argument is required. To specify no parameters, or to keep all
394
+ # the default parameter values, pass an empty Hash as a request object (see above).
395
+ #
396
+ # @param name [::String]
397
+ # Required. The full resource name of the bucket to update.
398
+ #
399
+ # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
400
+ # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
401
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
402
+ # "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
403
+ #
404
+ # Example:
405
+ # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id"`. Also
406
+ # requires permission "resourcemanager.projects.updateLiens" to set the
407
+ # locked property
408
+ # @param bucket [::Google::Cloud::Logging::V2::LogBucket, ::Hash]
409
+ # Required. The updated bucket.
410
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
411
+ # Required. Field mask that specifies the fields in `bucket` that need an update. A
412
+ # bucket field will be overwritten if, and only if, it is in the update
413
+ # mask. `name` and output only fields cannot be updated.
414
+ #
415
+ # For a detailed `FieldMask` definition, see
416
+ # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
417
+ #
418
+ # Example: `updateMask=retention_days`.
419
+ #
420
+ # @yield [response, operation] Access the result along with the RPC operation
421
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogBucket]
422
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
423
+ #
424
+ # @return [::Google::Cloud::Logging::V2::LogBucket]
425
+ #
426
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
427
+ #
428
+ def update_bucket request, options = nil
429
+ raise ::ArgumentError, "request must be provided" if request.nil?
430
+
431
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateBucketRequest
432
+
433
+ # Converts hash and nil to an options object
434
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
435
+
436
+ # Customize the options with defaults
437
+ metadata = @config.rpcs.update_bucket.metadata.to_h
438
+
439
+ # Set x-goog-api-client and x-goog-user-project headers
440
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
441
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
442
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
443
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
444
+
445
+ header_params = {
446
+ "name" => request.name
447
+ }
448
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
449
+ metadata[:"x-goog-request-params"] ||= request_params_header
450
+
451
+ options.apply_defaults timeout: @config.rpcs.update_bucket.timeout,
452
+ metadata: metadata,
453
+ retry_policy: @config.rpcs.update_bucket.retry_policy
454
+ options.apply_defaults metadata: @config.metadata,
455
+ retry_policy: @config.retry_policy
456
+
457
+ @config_service_stub.call_rpc :update_bucket, request, options: options do |response, operation|
458
+ yield response, operation if block_given?
459
+ return response
460
+ end
461
+ rescue ::GRPC::BadStatus => e
462
+ raise ::Google::Cloud::Error.from_error(e)
463
+ end
464
+
465
+ ##
466
+ # Lists sinks.
467
+ #
468
+ # @overload list_sinks(request, options = nil)
469
+ # Pass arguments to `list_sinks` via a request object, either of type
470
+ # {::Google::Cloud::Logging::V2::ListSinksRequest} or an equivalent Hash.
471
+ #
472
+ # @param request [::Google::Cloud::Logging::V2::ListSinksRequest, ::Hash]
473
+ # A request object representing the call parameters. Required. To specify no
474
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
475
+ # @param options [::Gapic::CallOptions, ::Hash]
476
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
477
+ #
478
+ # @overload list_sinks(parent: nil, page_token: nil, page_size: nil)
479
+ # Pass arguments to `list_sinks` via keyword arguments. Note that at
480
+ # least one keyword argument is required. To specify no parameters, or to keep all
481
+ # the default parameter values, pass an empty Hash as a request object (see above).
482
+ #
483
+ # @param parent [::String]
484
+ # Required. The parent resource whose sinks are to be listed:
485
+ #
486
+ # "projects/[PROJECT_ID]"
487
+ # "organizations/[ORGANIZATION_ID]"
488
+ # "billingAccounts/[BILLING_ACCOUNT_ID]"
489
+ # "folders/[FOLDER_ID]"
490
+ # @param page_token [::String]
491
+ # Optional. If present, then retrieve the next batch of results from the
492
+ # preceding call to this method. `pageToken` must be the value of
493
+ # `nextPageToken` from the previous response. The values of other method
494
+ # parameters should be identical to those in the previous call.
495
+ # @param page_size [::Integer]
496
+ # Optional. The maximum number of results to return from this request.
497
+ # Non-positive values are ignored. The presence of `nextPageToken` in the
498
+ # response indicates that more results might be available.
499
+ #
500
+ # @yield [response, operation] Access the result along with the RPC operation
501
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogSink>]
502
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
503
+ #
504
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogSink>]
505
+ #
506
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
507
+ #
508
+ def list_sinks request, options = nil
509
+ raise ::ArgumentError, "request must be provided" if request.nil?
510
+
511
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListSinksRequest
512
+
513
+ # Converts hash and nil to an options object
514
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
515
+
516
+ # Customize the options with defaults
517
+ metadata = @config.rpcs.list_sinks.metadata.to_h
518
+
519
+ # Set x-goog-api-client and x-goog-user-project headers
520
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
521
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
522
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
523
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
524
+
525
+ header_params = {
526
+ "parent" => request.parent
527
+ }
528
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
529
+ metadata[:"x-goog-request-params"] ||= request_params_header
530
+
531
+ options.apply_defaults timeout: @config.rpcs.list_sinks.timeout,
532
+ metadata: metadata,
533
+ retry_policy: @config.rpcs.list_sinks.retry_policy
534
+ options.apply_defaults metadata: @config.metadata,
535
+ retry_policy: @config.retry_policy
536
+
537
+ @config_service_stub.call_rpc :list_sinks, request, options: options do |response, operation|
538
+ response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_sinks, request, response, operation, options
539
+ yield response, operation if block_given?
540
+ return response
541
+ end
542
+ rescue ::GRPC::BadStatus => e
543
+ raise ::Google::Cloud::Error.from_error(e)
544
+ end
545
+
546
+ ##
547
+ # Gets a sink.
548
+ #
549
+ # @overload get_sink(request, options = nil)
550
+ # Pass arguments to `get_sink` via a request object, either of type
551
+ # {::Google::Cloud::Logging::V2::GetSinkRequest} or an equivalent Hash.
552
+ #
553
+ # @param request [::Google::Cloud::Logging::V2::GetSinkRequest, ::Hash]
554
+ # A request object representing the call parameters. Required. To specify no
555
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
556
+ # @param options [::Gapic::CallOptions, ::Hash]
557
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
558
+ #
559
+ # @overload get_sink(sink_name: nil)
560
+ # Pass arguments to `get_sink` via keyword arguments. Note that at
561
+ # least one keyword argument is required. To specify no parameters, or to keep all
562
+ # the default parameter values, pass an empty Hash as a request object (see above).
563
+ #
564
+ # @param sink_name [::String]
565
+ # Required. The resource name of the sink:
566
+ #
567
+ # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
568
+ # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
569
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
570
+ # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
571
+ #
572
+ # Example: `"projects/my-project-id/sinks/my-sink-id"`.
573
+ #
574
+ # @yield [response, operation] Access the result along with the RPC operation
575
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogSink]
576
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
577
+ #
578
+ # @return [::Google::Cloud::Logging::V2::LogSink]
579
+ #
580
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
581
+ #
582
+ def get_sink request, options = nil
583
+ raise ::ArgumentError, "request must be provided" if request.nil?
584
+
585
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetSinkRequest
586
+
587
+ # Converts hash and nil to an options object
588
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
589
+
590
+ # Customize the options with defaults
591
+ metadata = @config.rpcs.get_sink.metadata.to_h
592
+
593
+ # Set x-goog-api-client and x-goog-user-project headers
594
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
595
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
596
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
597
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
598
+
599
+ header_params = {
600
+ "sink_name" => request.sink_name
601
+ }
602
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
603
+ metadata[:"x-goog-request-params"] ||= request_params_header
604
+
605
+ options.apply_defaults timeout: @config.rpcs.get_sink.timeout,
606
+ metadata: metadata,
607
+ retry_policy: @config.rpcs.get_sink.retry_policy
608
+ options.apply_defaults metadata: @config.metadata,
609
+ retry_policy: @config.retry_policy
610
+
611
+ @config_service_stub.call_rpc :get_sink, request, options: options do |response, operation|
612
+ yield response, operation if block_given?
613
+ return response
614
+ end
615
+ rescue ::GRPC::BadStatus => e
616
+ raise ::Google::Cloud::Error.from_error(e)
617
+ end
618
+
619
+ ##
620
+ # Creates a sink that exports specified log entries to a destination. The
621
+ # export of newly-ingested log entries begins immediately, unless the sink's
622
+ # `writer_identity` is not permitted to write to the destination. A sink can
623
+ # export log entries only from the resource owning the sink.
624
+ #
625
+ # @overload create_sink(request, options = nil)
626
+ # Pass arguments to `create_sink` via a request object, either of type
627
+ # {::Google::Cloud::Logging::V2::CreateSinkRequest} or an equivalent Hash.
628
+ #
629
+ # @param request [::Google::Cloud::Logging::V2::CreateSinkRequest, ::Hash]
630
+ # A request object representing the call parameters. Required. To specify no
631
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
632
+ # @param options [::Gapic::CallOptions, ::Hash]
633
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
634
+ #
635
+ # @overload create_sink(parent: nil, sink: nil, unique_writer_identity: nil)
636
+ # Pass arguments to `create_sink` via keyword arguments. Note that at
637
+ # least one keyword argument is required. To specify no parameters, or to keep all
638
+ # the default parameter values, pass an empty Hash as a request object (see above).
639
+ #
640
+ # @param parent [::String]
641
+ # Required. The resource in which to create the sink:
642
+ #
643
+ # "projects/[PROJECT_ID]"
644
+ # "organizations/[ORGANIZATION_ID]"
645
+ # "billingAccounts/[BILLING_ACCOUNT_ID]"
646
+ # "folders/[FOLDER_ID]"
647
+ #
648
+ # Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
649
+ # @param sink [::Google::Cloud::Logging::V2::LogSink, ::Hash]
650
+ # Required. The new sink, whose `name` parameter is a sink identifier that
651
+ # is not already in use.
652
+ # @param unique_writer_identity [::Boolean]
653
+ # Optional. Determines the kind of IAM identity returned as `writer_identity`
654
+ # in the new sink. If this value is omitted or set to false, and if the
655
+ # sink's parent is a project, then the value returned as `writer_identity` is
656
+ # the same group or service account used by Logging before the addition of
657
+ # writer identities to this API. The sink's destination must be in the same
658
+ # project as the sink itself.
659
+ #
660
+ # If this field is set to true, or if the sink is owned by a non-project
661
+ # resource such as an organization, then the value of `writer_identity` will
662
+ # be a unique service account used only for exports from the new sink. For
663
+ # more information, see `writer_identity` in {::Google::Cloud::Logging::V2::LogSink LogSink}.
664
+ #
665
+ # @yield [response, operation] Access the result along with the RPC operation
666
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogSink]
667
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
668
+ #
669
+ # @return [::Google::Cloud::Logging::V2::LogSink]
670
+ #
671
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
672
+ #
673
+ def create_sink request, options = nil
674
+ raise ::ArgumentError, "request must be provided" if request.nil?
675
+
676
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateSinkRequest
677
+
678
+ # Converts hash and nil to an options object
679
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
680
+
681
+ # Customize the options with defaults
682
+ metadata = @config.rpcs.create_sink.metadata.to_h
683
+
684
+ # Set x-goog-api-client and x-goog-user-project headers
685
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
686
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
687
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
688
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
689
+
690
+ header_params = {
691
+ "parent" => request.parent
692
+ }
693
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
694
+ metadata[:"x-goog-request-params"] ||= request_params_header
695
+
696
+ options.apply_defaults timeout: @config.rpcs.create_sink.timeout,
697
+ metadata: metadata,
698
+ retry_policy: @config.rpcs.create_sink.retry_policy
699
+ options.apply_defaults metadata: @config.metadata,
700
+ retry_policy: @config.retry_policy
701
+
702
+ @config_service_stub.call_rpc :create_sink, request, options: options do |response, operation|
703
+ yield response, operation if block_given?
704
+ return response
705
+ end
706
+ rescue ::GRPC::BadStatus => e
707
+ raise ::Google::Cloud::Error.from_error(e)
708
+ end
709
+
710
+ ##
711
+ # Updates a sink. This method replaces the following fields in the existing
712
+ # sink with values from the new sink: `destination`, and `filter`.
713
+ #
714
+ # The updated sink might also have a new `writer_identity`; see the
715
+ # `unique_writer_identity` field.
716
+ #
717
+ # @overload update_sink(request, options = nil)
718
+ # Pass arguments to `update_sink` via a request object, either of type
719
+ # {::Google::Cloud::Logging::V2::UpdateSinkRequest} or an equivalent Hash.
720
+ #
721
+ # @param request [::Google::Cloud::Logging::V2::UpdateSinkRequest, ::Hash]
722
+ # A request object representing the call parameters. Required. To specify no
723
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
724
+ # @param options [::Gapic::CallOptions, ::Hash]
725
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
726
+ #
727
+ # @overload update_sink(sink_name: nil, sink: nil, unique_writer_identity: nil, update_mask: nil)
728
+ # Pass arguments to `update_sink` via keyword arguments. Note that at
729
+ # least one keyword argument is required. To specify no parameters, or to keep all
730
+ # the default parameter values, pass an empty Hash as a request object (see above).
731
+ #
732
+ # @param sink_name [::String]
733
+ # Required. The full resource name of the sink to update, including the parent
734
+ # resource and the sink identifier:
735
+ #
736
+ # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
737
+ # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
738
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
739
+ # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
740
+ #
741
+ # Example: `"projects/my-project-id/sinks/my-sink-id"`.
742
+ # @param sink [::Google::Cloud::Logging::V2::LogSink, ::Hash]
743
+ # Required. The updated sink, whose name is the same identifier that appears as part
744
+ # of `sink_name`.
745
+ # @param unique_writer_identity [::Boolean]
746
+ # Optional. See {::Google::Cloud::Logging::V2::ConfigServiceV2::Client#create_sink sinks.create}
747
+ # for a description of this field. When updating a sink, the effect of this
748
+ # field on the value of `writer_identity` in the updated sink depends on both
749
+ # the old and new values of this field:
750
+ #
751
+ # + If the old and new values of this field are both false or both true,
752
+ # then there is no change to the sink's `writer_identity`.
753
+ # + If the old value is false and the new value is true, then
754
+ # `writer_identity` is changed to a unique service account.
755
+ # + It is an error if the old value is true and the new value is
756
+ # set to false or defaulted to false.
757
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
758
+ # Optional. Field mask that specifies the fields in `sink` that need
759
+ # an update. A sink field will be overwritten if, and only if, it is
760
+ # in the update mask. `name` and output only fields cannot be updated.
761
+ #
762
+ # An empty updateMask is temporarily treated as using the following mask
763
+ # for backwards compatibility purposes:
764
+ # destination,filter,includeChildren
765
+ # At some point in the future, behavior will be removed and specifying an
766
+ # empty updateMask will be an error.
767
+ #
768
+ # For a detailed `FieldMask` definition, see
769
+ # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
770
+ #
771
+ # Example: `updateMask=filter`.
772
+ #
773
+ # @yield [response, operation] Access the result along with the RPC operation
774
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogSink]
775
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
776
+ #
777
+ # @return [::Google::Cloud::Logging::V2::LogSink]
778
+ #
779
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
780
+ #
781
+ def update_sink request, options = nil
782
+ raise ::ArgumentError, "request must be provided" if request.nil?
783
+
784
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateSinkRequest
785
+
786
+ # Converts hash and nil to an options object
787
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
788
+
789
+ # Customize the options with defaults
790
+ metadata = @config.rpcs.update_sink.metadata.to_h
791
+
792
+ # Set x-goog-api-client and x-goog-user-project headers
793
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
794
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
795
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
796
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
797
+
798
+ header_params = {
799
+ "sink_name" => request.sink_name
800
+ }
801
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
802
+ metadata[:"x-goog-request-params"] ||= request_params_header
803
+
804
+ options.apply_defaults timeout: @config.rpcs.update_sink.timeout,
805
+ metadata: metadata,
806
+ retry_policy: @config.rpcs.update_sink.retry_policy
807
+ options.apply_defaults metadata: @config.metadata,
808
+ retry_policy: @config.retry_policy
809
+
810
+ @config_service_stub.call_rpc :update_sink, request, options: options do |response, operation|
811
+ yield response, operation if block_given?
812
+ return response
813
+ end
814
+ rescue ::GRPC::BadStatus => e
815
+ raise ::Google::Cloud::Error.from_error(e)
816
+ end
817
+
818
+ ##
819
+ # Deletes a sink. If the sink has a unique `writer_identity`, then that
820
+ # service account is also deleted.
821
+ #
822
+ # @overload delete_sink(request, options = nil)
823
+ # Pass arguments to `delete_sink` via a request object, either of type
824
+ # {::Google::Cloud::Logging::V2::DeleteSinkRequest} or an equivalent Hash.
825
+ #
826
+ # @param request [::Google::Cloud::Logging::V2::DeleteSinkRequest, ::Hash]
827
+ # A request object representing the call parameters. Required. To specify no
828
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
829
+ # @param options [::Gapic::CallOptions, ::Hash]
830
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
831
+ #
832
+ # @overload delete_sink(sink_name: nil)
833
+ # Pass arguments to `delete_sink` via keyword arguments. Note that at
834
+ # least one keyword argument is required. To specify no parameters, or to keep all
835
+ # the default parameter values, pass an empty Hash as a request object (see above).
836
+ #
837
+ # @param sink_name [::String]
838
+ # Required. The full resource name of the sink to delete, including the parent
839
+ # resource and the sink identifier:
840
+ #
841
+ # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
842
+ # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
843
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
844
+ # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
845
+ #
846
+ # Example: `"projects/my-project-id/sinks/my-sink-id"`.
847
+ #
848
+ # @yield [response, operation] Access the result along with the RPC operation
849
+ # @yieldparam response [::Google::Protobuf::Empty]
850
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
851
+ #
852
+ # @return [::Google::Protobuf::Empty]
853
+ #
854
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
855
+ #
856
+ def delete_sink request, options = nil
857
+ raise ::ArgumentError, "request must be provided" if request.nil?
858
+
859
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteSinkRequest
860
+
861
+ # Converts hash and nil to an options object
862
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
863
+
864
+ # Customize the options with defaults
865
+ metadata = @config.rpcs.delete_sink.metadata.to_h
866
+
867
+ # Set x-goog-api-client and x-goog-user-project headers
868
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
869
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
870
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
871
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
872
+
873
+ header_params = {
874
+ "sink_name" => request.sink_name
875
+ }
876
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
877
+ metadata[:"x-goog-request-params"] ||= request_params_header
878
+
879
+ options.apply_defaults timeout: @config.rpcs.delete_sink.timeout,
880
+ metadata: metadata,
881
+ retry_policy: @config.rpcs.delete_sink.retry_policy
882
+ options.apply_defaults metadata: @config.metadata,
883
+ retry_policy: @config.retry_policy
884
+
885
+ @config_service_stub.call_rpc :delete_sink, request, options: options do |response, operation|
886
+ yield response, operation if block_given?
887
+ return response
888
+ end
889
+ rescue ::GRPC::BadStatus => e
890
+ raise ::Google::Cloud::Error.from_error(e)
891
+ end
892
+
893
+ ##
894
+ # Lists all the exclusions in a parent resource.
895
+ #
896
+ # @overload list_exclusions(request, options = nil)
897
+ # Pass arguments to `list_exclusions` via a request object, either of type
898
+ # {::Google::Cloud::Logging::V2::ListExclusionsRequest} or an equivalent Hash.
899
+ #
900
+ # @param request [::Google::Cloud::Logging::V2::ListExclusionsRequest, ::Hash]
901
+ # A request object representing the call parameters. Required. To specify no
902
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
903
+ # @param options [::Gapic::CallOptions, ::Hash]
904
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
905
+ #
906
+ # @overload list_exclusions(parent: nil, page_token: nil, page_size: nil)
907
+ # Pass arguments to `list_exclusions` via keyword arguments. Note that at
908
+ # least one keyword argument is required. To specify no parameters, or to keep all
909
+ # the default parameter values, pass an empty Hash as a request object (see above).
910
+ #
911
+ # @param parent [::String]
912
+ # Required. The parent resource whose exclusions are to be listed.
913
+ #
914
+ # "projects/[PROJECT_ID]"
915
+ # "organizations/[ORGANIZATION_ID]"
916
+ # "billingAccounts/[BILLING_ACCOUNT_ID]"
917
+ # "folders/[FOLDER_ID]"
918
+ # @param page_token [::String]
919
+ # Optional. If present, then retrieve the next batch of results from the
920
+ # preceding call to this method. `pageToken` must be the value of
921
+ # `nextPageToken` from the previous response. The values of other method
922
+ # parameters should be identical to those in the previous call.
923
+ # @param page_size [::Integer]
924
+ # Optional. The maximum number of results to return from this request.
925
+ # Non-positive values are ignored. The presence of `nextPageToken` in the
926
+ # response indicates that more results might be available.
927
+ #
928
+ # @yield [response, operation] Access the result along with the RPC operation
929
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogExclusion>]
930
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
931
+ #
932
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogExclusion>]
933
+ #
934
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
935
+ #
936
+ def list_exclusions request, options = nil
937
+ raise ::ArgumentError, "request must be provided" if request.nil?
938
+
939
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListExclusionsRequest
940
+
941
+ # Converts hash and nil to an options object
942
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
943
+
944
+ # Customize the options with defaults
945
+ metadata = @config.rpcs.list_exclusions.metadata.to_h
946
+
947
+ # Set x-goog-api-client and x-goog-user-project headers
948
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
949
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
950
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
951
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
952
+
953
+ header_params = {
954
+ "parent" => request.parent
955
+ }
956
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
957
+ metadata[:"x-goog-request-params"] ||= request_params_header
958
+
959
+ options.apply_defaults timeout: @config.rpcs.list_exclusions.timeout,
960
+ metadata: metadata,
961
+ retry_policy: @config.rpcs.list_exclusions.retry_policy
962
+ options.apply_defaults metadata: @config.metadata,
963
+ retry_policy: @config.retry_policy
964
+
965
+ @config_service_stub.call_rpc :list_exclusions, request, options: options do |response, operation|
966
+ response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_exclusions, request, response, operation, options
967
+ yield response, operation if block_given?
968
+ return response
969
+ end
970
+ rescue ::GRPC::BadStatus => e
971
+ raise ::Google::Cloud::Error.from_error(e)
972
+ end
973
+
974
+ ##
975
+ # Gets the description of an exclusion.
976
+ #
977
+ # @overload get_exclusion(request, options = nil)
978
+ # Pass arguments to `get_exclusion` via a request object, either of type
979
+ # {::Google::Cloud::Logging::V2::GetExclusionRequest} or an equivalent Hash.
980
+ #
981
+ # @param request [::Google::Cloud::Logging::V2::GetExclusionRequest, ::Hash]
982
+ # A request object representing the call parameters. Required. To specify no
983
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
984
+ # @param options [::Gapic::CallOptions, ::Hash]
985
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
986
+ #
987
+ # @overload get_exclusion(name: nil)
988
+ # Pass arguments to `get_exclusion` via keyword arguments. Note that at
989
+ # least one keyword argument is required. To specify no parameters, or to keep all
990
+ # the default parameter values, pass an empty Hash as a request object (see above).
991
+ #
992
+ # @param name [::String]
993
+ # Required. The resource name of an existing exclusion:
994
+ #
995
+ # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
996
+ # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
997
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
998
+ # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
999
+ #
1000
+ # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
1001
+ #
1002
+ # @yield [response, operation] Access the result along with the RPC operation
1003
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogExclusion]
1004
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1005
+ #
1006
+ # @return [::Google::Cloud::Logging::V2::LogExclusion]
1007
+ #
1008
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1009
+ #
1010
+ def get_exclusion request, options = nil
1011
+ raise ::ArgumentError, "request must be provided" if request.nil?
1012
+
1013
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetExclusionRequest
1014
+
1015
+ # Converts hash and nil to an options object
1016
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1017
+
1018
+ # Customize the options with defaults
1019
+ metadata = @config.rpcs.get_exclusion.metadata.to_h
1020
+
1021
+ # Set x-goog-api-client and x-goog-user-project headers
1022
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1023
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1024
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
1025
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1026
+
1027
+ header_params = {
1028
+ "name" => request.name
1029
+ }
1030
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1031
+ metadata[:"x-goog-request-params"] ||= request_params_header
1032
+
1033
+ options.apply_defaults timeout: @config.rpcs.get_exclusion.timeout,
1034
+ metadata: metadata,
1035
+ retry_policy: @config.rpcs.get_exclusion.retry_policy
1036
+ options.apply_defaults metadata: @config.metadata,
1037
+ retry_policy: @config.retry_policy
1038
+
1039
+ @config_service_stub.call_rpc :get_exclusion, request, options: options do |response, operation|
1040
+ yield response, operation if block_given?
1041
+ return response
1042
+ end
1043
+ rescue ::GRPC::BadStatus => e
1044
+ raise ::Google::Cloud::Error.from_error(e)
1045
+ end
1046
+
1047
+ ##
1048
+ # Creates a new exclusion in a specified parent resource.
1049
+ # Only log entries belonging to that resource can be excluded.
1050
+ # You can have up to 10 exclusions in a resource.
1051
+ #
1052
+ # @overload create_exclusion(request, options = nil)
1053
+ # Pass arguments to `create_exclusion` via a request object, either of type
1054
+ # {::Google::Cloud::Logging::V2::CreateExclusionRequest} or an equivalent Hash.
1055
+ #
1056
+ # @param request [::Google::Cloud::Logging::V2::CreateExclusionRequest, ::Hash]
1057
+ # A request object representing the call parameters. Required. To specify no
1058
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1059
+ # @param options [::Gapic::CallOptions, ::Hash]
1060
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1061
+ #
1062
+ # @overload create_exclusion(parent: nil, exclusion: nil)
1063
+ # Pass arguments to `create_exclusion` via keyword arguments. Note that at
1064
+ # least one keyword argument is required. To specify no parameters, or to keep all
1065
+ # the default parameter values, pass an empty Hash as a request object (see above).
1066
+ #
1067
+ # @param parent [::String]
1068
+ # Required. The parent resource in which to create the exclusion:
1069
+ #
1070
+ # "projects/[PROJECT_ID]"
1071
+ # "organizations/[ORGANIZATION_ID]"
1072
+ # "billingAccounts/[BILLING_ACCOUNT_ID]"
1073
+ # "folders/[FOLDER_ID]"
1074
+ #
1075
+ # Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
1076
+ # @param exclusion [::Google::Cloud::Logging::V2::LogExclusion, ::Hash]
1077
+ # Required. The new exclusion, whose `name` parameter is an exclusion name
1078
+ # that is not already used in the parent resource.
1079
+ #
1080
+ # @yield [response, operation] Access the result along with the RPC operation
1081
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogExclusion]
1082
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1083
+ #
1084
+ # @return [::Google::Cloud::Logging::V2::LogExclusion]
1085
+ #
1086
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1087
+ #
1088
+ def create_exclusion request, options = nil
1089
+ raise ::ArgumentError, "request must be provided" if request.nil?
1090
+
1091
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateExclusionRequest
1092
+
1093
+ # Converts hash and nil to an options object
1094
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1095
+
1096
+ # Customize the options with defaults
1097
+ metadata = @config.rpcs.create_exclusion.metadata.to_h
1098
+
1099
+ # Set x-goog-api-client and x-goog-user-project headers
1100
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1101
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1102
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
1103
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1104
+
1105
+ header_params = {
1106
+ "parent" => request.parent
1107
+ }
1108
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1109
+ metadata[:"x-goog-request-params"] ||= request_params_header
1110
+
1111
+ options.apply_defaults timeout: @config.rpcs.create_exclusion.timeout,
1112
+ metadata: metadata,
1113
+ retry_policy: @config.rpcs.create_exclusion.retry_policy
1114
+ options.apply_defaults metadata: @config.metadata,
1115
+ retry_policy: @config.retry_policy
1116
+
1117
+ @config_service_stub.call_rpc :create_exclusion, request, options: options do |response, operation|
1118
+ yield response, operation if block_given?
1119
+ return response
1120
+ end
1121
+ rescue ::GRPC::BadStatus => e
1122
+ raise ::Google::Cloud::Error.from_error(e)
1123
+ end
1124
+
1125
+ ##
1126
+ # Changes one or more properties of an existing exclusion.
1127
+ #
1128
+ # @overload update_exclusion(request, options = nil)
1129
+ # Pass arguments to `update_exclusion` via a request object, either of type
1130
+ # {::Google::Cloud::Logging::V2::UpdateExclusionRequest} or an equivalent Hash.
1131
+ #
1132
+ # @param request [::Google::Cloud::Logging::V2::UpdateExclusionRequest, ::Hash]
1133
+ # A request object representing the call parameters. Required. To specify no
1134
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1135
+ # @param options [::Gapic::CallOptions, ::Hash]
1136
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1137
+ #
1138
+ # @overload update_exclusion(name: nil, exclusion: nil, update_mask: nil)
1139
+ # Pass arguments to `update_exclusion` via keyword arguments. Note that at
1140
+ # least one keyword argument is required. To specify no parameters, or to keep all
1141
+ # the default parameter values, pass an empty Hash as a request object (see above).
1142
+ #
1143
+ # @param name [::String]
1144
+ # Required. The resource name of the exclusion to update:
1145
+ #
1146
+ # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
1147
+ # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
1148
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
1149
+ # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
1150
+ #
1151
+ # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
1152
+ # @param exclusion [::Google::Cloud::Logging::V2::LogExclusion, ::Hash]
1153
+ # Required. New values for the existing exclusion. Only the fields specified in
1154
+ # `update_mask` are relevant.
1155
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1156
+ # Required. A non-empty list of fields to change in the existing exclusion. New values
1157
+ # for the fields are taken from the corresponding fields in the
1158
+ # {::Google::Cloud::Logging::V2::LogExclusion LogExclusion} included in this request. Fields not mentioned in
1159
+ # `update_mask` are not changed and are ignored in the request.
1160
+ #
1161
+ # For example, to change the filter and description of an exclusion,
1162
+ # specify an `update_mask` of `"filter,description"`.
1163
+ #
1164
+ # @yield [response, operation] Access the result along with the RPC operation
1165
+ # @yieldparam response [::Google::Cloud::Logging::V2::LogExclusion]
1166
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1167
+ #
1168
+ # @return [::Google::Cloud::Logging::V2::LogExclusion]
1169
+ #
1170
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1171
+ #
1172
+ def update_exclusion request, options = nil
1173
+ raise ::ArgumentError, "request must be provided" if request.nil?
1174
+
1175
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateExclusionRequest
1176
+
1177
+ # Converts hash and nil to an options object
1178
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1179
+
1180
+ # Customize the options with defaults
1181
+ metadata = @config.rpcs.update_exclusion.metadata.to_h
1182
+
1183
+ # Set x-goog-api-client and x-goog-user-project headers
1184
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1185
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1186
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
1187
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1188
+
1189
+ header_params = {
1190
+ "name" => request.name
1191
+ }
1192
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1193
+ metadata[:"x-goog-request-params"] ||= request_params_header
1194
+
1195
+ options.apply_defaults timeout: @config.rpcs.update_exclusion.timeout,
1196
+ metadata: metadata,
1197
+ retry_policy: @config.rpcs.update_exclusion.retry_policy
1198
+ options.apply_defaults metadata: @config.metadata,
1199
+ retry_policy: @config.retry_policy
1200
+
1201
+ @config_service_stub.call_rpc :update_exclusion, request, options: options do |response, operation|
1202
+ yield response, operation if block_given?
1203
+ return response
1204
+ end
1205
+ rescue ::GRPC::BadStatus => e
1206
+ raise ::Google::Cloud::Error.from_error(e)
1207
+ end
1208
+
1209
+ ##
1210
+ # Deletes an exclusion.
1211
+ #
1212
+ # @overload delete_exclusion(request, options = nil)
1213
+ # Pass arguments to `delete_exclusion` via a request object, either of type
1214
+ # {::Google::Cloud::Logging::V2::DeleteExclusionRequest} or an equivalent Hash.
1215
+ #
1216
+ # @param request [::Google::Cloud::Logging::V2::DeleteExclusionRequest, ::Hash]
1217
+ # A request object representing the call parameters. Required. To specify no
1218
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1219
+ # @param options [::Gapic::CallOptions, ::Hash]
1220
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1221
+ #
1222
+ # @overload delete_exclusion(name: nil)
1223
+ # Pass arguments to `delete_exclusion` via keyword arguments. Note that at
1224
+ # least one keyword argument is required. To specify no parameters, or to keep all
1225
+ # the default parameter values, pass an empty Hash as a request object (see above).
1226
+ #
1227
+ # @param name [::String]
1228
+ # Required. The resource name of an existing exclusion to delete:
1229
+ #
1230
+ # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
1231
+ # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
1232
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
1233
+ # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
1234
+ #
1235
+ # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
1236
+ #
1237
+ # @yield [response, operation] Access the result along with the RPC operation
1238
+ # @yieldparam response [::Google::Protobuf::Empty]
1239
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1240
+ #
1241
+ # @return [::Google::Protobuf::Empty]
1242
+ #
1243
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1244
+ #
1245
+ def delete_exclusion request, options = nil
1246
+ raise ::ArgumentError, "request must be provided" if request.nil?
1247
+
1248
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteExclusionRequest
1249
+
1250
+ # Converts hash and nil to an options object
1251
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1252
+
1253
+ # Customize the options with defaults
1254
+ metadata = @config.rpcs.delete_exclusion.metadata.to_h
1255
+
1256
+ # Set x-goog-api-client and x-goog-user-project headers
1257
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1258
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1259
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
1260
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1261
+
1262
+ header_params = {
1263
+ "name" => request.name
1264
+ }
1265
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1266
+ metadata[:"x-goog-request-params"] ||= request_params_header
1267
+
1268
+ options.apply_defaults timeout: @config.rpcs.delete_exclusion.timeout,
1269
+ metadata: metadata,
1270
+ retry_policy: @config.rpcs.delete_exclusion.retry_policy
1271
+ options.apply_defaults metadata: @config.metadata,
1272
+ retry_policy: @config.retry_policy
1273
+
1274
+ @config_service_stub.call_rpc :delete_exclusion, request, options: options do |response, operation|
1275
+ yield response, operation if block_given?
1276
+ return response
1277
+ end
1278
+ rescue ::GRPC::BadStatus => e
1279
+ raise ::Google::Cloud::Error.from_error(e)
1280
+ end
1281
+
1282
+ ##
1283
+ # Gets the Logs Router CMEK settings for the given resource.
1284
+ #
1285
+ # Note: CMEK for the Logs Router can currently only be configured for GCP
1286
+ # organizations. Once configured, it applies to all projects and folders in
1287
+ # the GCP organization.
1288
+ #
1289
+ # See [Enabling CMEK for Logs
1290
+ # Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
1291
+ #
1292
+ # @overload get_cmek_settings(request, options = nil)
1293
+ # Pass arguments to `get_cmek_settings` via a request object, either of type
1294
+ # {::Google::Cloud::Logging::V2::GetCmekSettingsRequest} or an equivalent Hash.
1295
+ #
1296
+ # @param request [::Google::Cloud::Logging::V2::GetCmekSettingsRequest, ::Hash]
1297
+ # A request object representing the call parameters. Required. To specify no
1298
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1299
+ # @param options [::Gapic::CallOptions, ::Hash]
1300
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1301
+ #
1302
+ # @overload get_cmek_settings(name: nil)
1303
+ # Pass arguments to `get_cmek_settings` via keyword arguments. Note that at
1304
+ # least one keyword argument is required. To specify no parameters, or to keep all
1305
+ # the default parameter values, pass an empty Hash as a request object (see above).
1306
+ #
1307
+ # @param name [::String]
1308
+ # Required. The resource for which to retrieve CMEK settings.
1309
+ #
1310
+ # "projects/[PROJECT_ID]/cmekSettings"
1311
+ # "organizations/[ORGANIZATION_ID]/cmekSettings"
1312
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
1313
+ # "folders/[FOLDER_ID]/cmekSettings"
1314
+ #
1315
+ # Example: `"organizations/12345/cmekSettings"`.
1316
+ #
1317
+ # Note: CMEK for the Logs Router can currently only be configured for GCP
1318
+ # organizations. Once configured, it applies to all projects and folders in
1319
+ # the GCP organization.
1320
+ #
1321
+ # @yield [response, operation] Access the result along with the RPC operation
1322
+ # @yieldparam response [::Google::Cloud::Logging::V2::CmekSettings]
1323
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1324
+ #
1325
+ # @return [::Google::Cloud::Logging::V2::CmekSettings]
1326
+ #
1327
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1328
+ #
1329
+ def get_cmek_settings request, options = nil
1330
+ raise ::ArgumentError, "request must be provided" if request.nil?
1331
+
1332
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetCmekSettingsRequest
1333
+
1334
+ # Converts hash and nil to an options object
1335
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1336
+
1337
+ # Customize the options with defaults
1338
+ metadata = @config.rpcs.get_cmek_settings.metadata.to_h
1339
+
1340
+ # Set x-goog-api-client and x-goog-user-project headers
1341
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1342
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1343
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
1344
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1345
+
1346
+ header_params = {
1347
+ "name" => request.name
1348
+ }
1349
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1350
+ metadata[:"x-goog-request-params"] ||= request_params_header
1351
+
1352
+ options.apply_defaults timeout: @config.rpcs.get_cmek_settings.timeout,
1353
+ metadata: metadata,
1354
+ retry_policy: @config.rpcs.get_cmek_settings.retry_policy
1355
+ options.apply_defaults metadata: @config.metadata,
1356
+ retry_policy: @config.retry_policy
1357
+
1358
+ @config_service_stub.call_rpc :get_cmek_settings, request, options: options do |response, operation|
1359
+ yield response, operation if block_given?
1360
+ return response
1361
+ end
1362
+ rescue ::GRPC::BadStatus => e
1363
+ raise ::Google::Cloud::Error.from_error(e)
1364
+ end
1365
+
1366
+ ##
1367
+ # Updates the Logs Router CMEK settings for the given resource.
1368
+ #
1369
+ # Note: CMEK for the Logs Router can currently only be configured for GCP
1370
+ # organizations. Once configured, it applies to all projects and folders in
1371
+ # the GCP organization.
1372
+ #
1373
+ # {::Google::Cloud::Logging::V2::ConfigServiceV2::Client#update_cmek_settings UpdateCmekSettings}
1374
+ # will fail if 1) `kms_key_name` is invalid, or 2) the associated service
1375
+ # account does not have the required
1376
+ # `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or
1377
+ # 3) access to the key is disabled.
1378
+ #
1379
+ # See [Enabling CMEK for Logs
1380
+ # Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
1381
+ #
1382
+ # @overload update_cmek_settings(request, options = nil)
1383
+ # Pass arguments to `update_cmek_settings` via a request object, either of type
1384
+ # {::Google::Cloud::Logging::V2::UpdateCmekSettingsRequest} or an equivalent Hash.
1385
+ #
1386
+ # @param request [::Google::Cloud::Logging::V2::UpdateCmekSettingsRequest, ::Hash]
1387
+ # A request object representing the call parameters. Required. To specify no
1388
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1389
+ # @param options [::Gapic::CallOptions, ::Hash]
1390
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1391
+ #
1392
+ # @overload update_cmek_settings(name: nil, cmek_settings: nil, update_mask: nil)
1393
+ # Pass arguments to `update_cmek_settings` via keyword arguments. Note that at
1394
+ # least one keyword argument is required. To specify no parameters, or to keep all
1395
+ # the default parameter values, pass an empty Hash as a request object (see above).
1396
+ #
1397
+ # @param name [::String]
1398
+ # Required. The resource name for the CMEK settings to update.
1399
+ #
1400
+ # "projects/[PROJECT_ID]/cmekSettings"
1401
+ # "organizations/[ORGANIZATION_ID]/cmekSettings"
1402
+ # "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
1403
+ # "folders/[FOLDER_ID]/cmekSettings"
1404
+ #
1405
+ # Example: `"organizations/12345/cmekSettings"`.
1406
+ #
1407
+ # Note: CMEK for the Logs Router can currently only be configured for GCP
1408
+ # organizations. Once configured, it applies to all projects and folders in
1409
+ # the GCP organization.
1410
+ # @param cmek_settings [::Google::Cloud::Logging::V2::CmekSettings, ::Hash]
1411
+ # Required. The CMEK settings to update.
1412
+ #
1413
+ # See [Enabling CMEK for Logs
1414
+ # Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
1415
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1416
+ # Optional. Field mask identifying which fields from `cmek_settings` should
1417
+ # be updated. A field will be overwritten if and only if it is in the update
1418
+ # mask. Output only fields cannot be updated.
1419
+ #
1420
+ # See {::Google::Protobuf::FieldMask FieldMask} for more information.
1421
+ #
1422
+ # Example: `"updateMask=kmsKeyName"`
1423
+ #
1424
+ # @yield [response, operation] Access the result along with the RPC operation
1425
+ # @yieldparam response [::Google::Cloud::Logging::V2::CmekSettings]
1426
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1427
+ #
1428
+ # @return [::Google::Cloud::Logging::V2::CmekSettings]
1429
+ #
1430
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1431
+ #
1432
+ def update_cmek_settings request, options = nil
1433
+ raise ::ArgumentError, "request must be provided" if request.nil?
1434
+
1435
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateCmekSettingsRequest
1436
+
1437
+ # Converts hash and nil to an options object
1438
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1439
+
1440
+ # Customize the options with defaults
1441
+ metadata = @config.rpcs.update_cmek_settings.metadata.to_h
1442
+
1443
+ # Set x-goog-api-client and x-goog-user-project headers
1444
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1445
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1446
+ gapic_version: ::Google::Cloud::Logging::V2::VERSION
1447
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1448
+
1449
+ header_params = {
1450
+ "name" => request.name
1451
+ }
1452
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1453
+ metadata[:"x-goog-request-params"] ||= request_params_header
1454
+
1455
+ options.apply_defaults timeout: @config.rpcs.update_cmek_settings.timeout,
1456
+ metadata: metadata,
1457
+ retry_policy: @config.rpcs.update_cmek_settings.retry_policy
1458
+ options.apply_defaults metadata: @config.metadata,
1459
+ retry_policy: @config.retry_policy
1460
+
1461
+ @config_service_stub.call_rpc :update_cmek_settings, request, options: options do |response, operation|
1462
+ yield response, operation if block_given?
1463
+ return response
1464
+ end
1465
+ rescue ::GRPC::BadStatus => e
1466
+ raise ::Google::Cloud::Error.from_error(e)
1467
+ end
1468
+
1469
+ ##
1470
+ # Configuration class for the ConfigService API.
1471
+ #
1472
+ # This class represents the configuration for ConfigService,
1473
+ # providing control over timeouts, retry behavior, logging, transport
1474
+ # parameters, and other low-level controls. Certain parameters can also be
1475
+ # applied individually to specific RPCs. See
1476
+ # {::Google::Cloud::Logging::V2::ConfigService::Client::Configuration::Rpcs}
1477
+ # for a list of RPCs that can be configured independently.
1478
+ #
1479
+ # Configuration can be applied globally to all clients, or to a single client
1480
+ # on construction.
1481
+ #
1482
+ # # Examples
1483
+ #
1484
+ # To modify the global config, setting the timeout for list_buckets
1485
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
1486
+ #
1487
+ # ::Google::Cloud::Logging::V2::ConfigService::Client.configure do |config|
1488
+ # config.timeout = 10.0
1489
+ # config.rpcs.list_buckets.timeout = 20.0
1490
+ # end
1491
+ #
1492
+ # To apply the above configuration only to a new client:
1493
+ #
1494
+ # client = ::Google::Cloud::Logging::V2::ConfigService::Client.new do |config|
1495
+ # config.timeout = 10.0
1496
+ # config.rpcs.list_buckets.timeout = 20.0
1497
+ # end
1498
+ #
1499
+ # @!attribute [rw] endpoint
1500
+ # The hostname or hostname:port of the service endpoint.
1501
+ # Defaults to `"logging.googleapis.com"`.
1502
+ # @return [::String]
1503
+ # @!attribute [rw] credentials
1504
+ # Credentials to send with calls. You may provide any of the following types:
1505
+ # * (`String`) The path to a service account key file in JSON format
1506
+ # * (`Hash`) A service account key as a Hash
1507
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1508
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1509
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1510
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1511
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1512
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1513
+ # * (`nil`) indicating no credentials
1514
+ # @return [::Object]
1515
+ # @!attribute [rw] scope
1516
+ # The OAuth scopes
1517
+ # @return [::Array<::String>]
1518
+ # @!attribute [rw] lib_name
1519
+ # The library name as recorded in instrumentation and logging
1520
+ # @return [::String]
1521
+ # @!attribute [rw] lib_version
1522
+ # The library version as recorded in instrumentation and logging
1523
+ # @return [::String]
1524
+ # @!attribute [rw] channel_args
1525
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1526
+ # `GRPC::Core::Channel` object is provided as the credential.
1527
+ # @return [::Hash]
1528
+ # @!attribute [rw] interceptors
1529
+ # An array of interceptors that are run before calls are executed.
1530
+ # @return [::Array<::GRPC::ClientInterceptor>]
1531
+ # @!attribute [rw] timeout
1532
+ # The call timeout in seconds.
1533
+ # @return [::Numeric]
1534
+ # @!attribute [rw] metadata
1535
+ # Additional gRPC headers to be sent with the call.
1536
+ # @return [::Hash{::Symbol=>::String}]
1537
+ # @!attribute [rw] retry_policy
1538
+ # The retry policy. The value is a hash with the following keys:
1539
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1540
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1541
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1542
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1543
+ # trigger a retry.
1544
+ # @return [::Hash]
1545
+ # @!attribute [rw] quota_project
1546
+ # A separate project against which to charge quota.
1547
+ # @return [::String]
1548
+ #
1549
+ class Configuration
1550
+ extend ::Gapic::Config
1551
+
1552
+ config_attr :endpoint, "logging.googleapis.com", ::String
1553
+ config_attr :credentials, nil do |value|
1554
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1555
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1556
+ allowed.any? { |klass| klass === value }
1557
+ end
1558
+ config_attr :scope, nil, ::String, ::Array, nil
1559
+ config_attr :lib_name, nil, ::String, nil
1560
+ config_attr :lib_version, nil, ::String, nil
1561
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1562
+ config_attr :interceptors, nil, ::Array, nil
1563
+ config_attr :timeout, nil, ::Numeric, nil
1564
+ config_attr :metadata, nil, ::Hash, nil
1565
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1566
+ config_attr :quota_project, nil, ::String, nil
1567
+
1568
+ # @private
1569
+ def initialize parent_config = nil
1570
+ @parent_config = parent_config unless parent_config.nil?
1571
+
1572
+ yield self if block_given?
1573
+ end
1574
+
1575
+ ##
1576
+ # Configurations for individual RPCs
1577
+ # @return [Rpcs]
1578
+ #
1579
+ def rpcs
1580
+ @rpcs ||= begin
1581
+ parent_rpcs = nil
1582
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1583
+ Rpcs.new parent_rpcs
1584
+ end
1585
+ end
1586
+
1587
+ ##
1588
+ # Configuration RPC class for the ConfigService API.
1589
+ #
1590
+ # Includes fields providing the configuration for each RPC in this service.
1591
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1592
+ # the following configuration fields:
1593
+ #
1594
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1595
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1596
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1597
+ # include the following keys:
1598
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1599
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1600
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1601
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1602
+ # trigger a retry.
1603
+ #
1604
+ class Rpcs
1605
+ ##
1606
+ # RPC-specific configuration for `list_buckets`
1607
+ # @return [::Gapic::Config::Method]
1608
+ #
1609
+ attr_reader :list_buckets
1610
+ ##
1611
+ # RPC-specific configuration for `get_bucket`
1612
+ # @return [::Gapic::Config::Method]
1613
+ #
1614
+ attr_reader :get_bucket
1615
+ ##
1616
+ # RPC-specific configuration for `update_bucket`
1617
+ # @return [::Gapic::Config::Method]
1618
+ #
1619
+ attr_reader :update_bucket
1620
+ ##
1621
+ # RPC-specific configuration for `list_sinks`
1622
+ # @return [::Gapic::Config::Method]
1623
+ #
1624
+ attr_reader :list_sinks
1625
+ ##
1626
+ # RPC-specific configuration for `get_sink`
1627
+ # @return [::Gapic::Config::Method]
1628
+ #
1629
+ attr_reader :get_sink
1630
+ ##
1631
+ # RPC-specific configuration for `create_sink`
1632
+ # @return [::Gapic::Config::Method]
1633
+ #
1634
+ attr_reader :create_sink
1635
+ ##
1636
+ # RPC-specific configuration for `update_sink`
1637
+ # @return [::Gapic::Config::Method]
1638
+ #
1639
+ attr_reader :update_sink
1640
+ ##
1641
+ # RPC-specific configuration for `delete_sink`
1642
+ # @return [::Gapic::Config::Method]
1643
+ #
1644
+ attr_reader :delete_sink
1645
+ ##
1646
+ # RPC-specific configuration for `list_exclusions`
1647
+ # @return [::Gapic::Config::Method]
1648
+ #
1649
+ attr_reader :list_exclusions
1650
+ ##
1651
+ # RPC-specific configuration for `get_exclusion`
1652
+ # @return [::Gapic::Config::Method]
1653
+ #
1654
+ attr_reader :get_exclusion
1655
+ ##
1656
+ # RPC-specific configuration for `create_exclusion`
1657
+ # @return [::Gapic::Config::Method]
1658
+ #
1659
+ attr_reader :create_exclusion
1660
+ ##
1661
+ # RPC-specific configuration for `update_exclusion`
1662
+ # @return [::Gapic::Config::Method]
1663
+ #
1664
+ attr_reader :update_exclusion
1665
+ ##
1666
+ # RPC-specific configuration for `delete_exclusion`
1667
+ # @return [::Gapic::Config::Method]
1668
+ #
1669
+ attr_reader :delete_exclusion
1670
+ ##
1671
+ # RPC-specific configuration for `get_cmek_settings`
1672
+ # @return [::Gapic::Config::Method]
1673
+ #
1674
+ attr_reader :get_cmek_settings
1675
+ ##
1676
+ # RPC-specific configuration for `update_cmek_settings`
1677
+ # @return [::Gapic::Config::Method]
1678
+ #
1679
+ attr_reader :update_cmek_settings
1680
+
1681
+ # @private
1682
+ def initialize parent_rpcs = nil
1683
+ list_buckets_config = parent_rpcs&.list_buckets if parent_rpcs&.respond_to? :list_buckets
1684
+ @list_buckets = ::Gapic::Config::Method.new list_buckets_config
1685
+ get_bucket_config = parent_rpcs&.get_bucket if parent_rpcs&.respond_to? :get_bucket
1686
+ @get_bucket = ::Gapic::Config::Method.new get_bucket_config
1687
+ update_bucket_config = parent_rpcs&.update_bucket if parent_rpcs&.respond_to? :update_bucket
1688
+ @update_bucket = ::Gapic::Config::Method.new update_bucket_config
1689
+ list_sinks_config = parent_rpcs&.list_sinks if parent_rpcs&.respond_to? :list_sinks
1690
+ @list_sinks = ::Gapic::Config::Method.new list_sinks_config
1691
+ get_sink_config = parent_rpcs&.get_sink if parent_rpcs&.respond_to? :get_sink
1692
+ @get_sink = ::Gapic::Config::Method.new get_sink_config
1693
+ create_sink_config = parent_rpcs&.create_sink if parent_rpcs&.respond_to? :create_sink
1694
+ @create_sink = ::Gapic::Config::Method.new create_sink_config
1695
+ update_sink_config = parent_rpcs&.update_sink if parent_rpcs&.respond_to? :update_sink
1696
+ @update_sink = ::Gapic::Config::Method.new update_sink_config
1697
+ delete_sink_config = parent_rpcs&.delete_sink if parent_rpcs&.respond_to? :delete_sink
1698
+ @delete_sink = ::Gapic::Config::Method.new delete_sink_config
1699
+ list_exclusions_config = parent_rpcs&.list_exclusions if parent_rpcs&.respond_to? :list_exclusions
1700
+ @list_exclusions = ::Gapic::Config::Method.new list_exclusions_config
1701
+ get_exclusion_config = parent_rpcs&.get_exclusion if parent_rpcs&.respond_to? :get_exclusion
1702
+ @get_exclusion = ::Gapic::Config::Method.new get_exclusion_config
1703
+ create_exclusion_config = parent_rpcs&.create_exclusion if parent_rpcs&.respond_to? :create_exclusion
1704
+ @create_exclusion = ::Gapic::Config::Method.new create_exclusion_config
1705
+ update_exclusion_config = parent_rpcs&.update_exclusion if parent_rpcs&.respond_to? :update_exclusion
1706
+ @update_exclusion = ::Gapic::Config::Method.new update_exclusion_config
1707
+ delete_exclusion_config = parent_rpcs&.delete_exclusion if parent_rpcs&.respond_to? :delete_exclusion
1708
+ @delete_exclusion = ::Gapic::Config::Method.new delete_exclusion_config
1709
+ get_cmek_settings_config = parent_rpcs&.get_cmek_settings if parent_rpcs&.respond_to? :get_cmek_settings
1710
+ @get_cmek_settings = ::Gapic::Config::Method.new get_cmek_settings_config
1711
+ update_cmek_settings_config = parent_rpcs&.update_cmek_settings if parent_rpcs&.respond_to? :update_cmek_settings
1712
+ @update_cmek_settings = ::Gapic::Config::Method.new update_cmek_settings_config
1713
+
1714
+ yield self if block_given?
1715
+ end
1716
+ end
1717
+ end
1718
+ end
1719
+ end
1720
+ end
1721
+ end
1722
+ end
1723
+ end