google-cloud-logging 1.10.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +2 -1
  3. data/CHANGELOG.md +47 -0
  4. data/TROUBLESHOOTING.md +2 -8
  5. data/lib/google-cloud-logging.rb +14 -15
  6. data/lib/google/cloud/logging.rb +12 -13
  7. data/lib/google/cloud/logging/credentials.rb +2 -2
  8. data/lib/google/cloud/logging/entry.rb +5 -5
  9. data/lib/google/cloud/logging/entry/http_request.rb +3 -3
  10. data/lib/google/cloud/logging/entry/list.rb +1 -1
  11. data/lib/google/cloud/logging/entry/operation.rb +3 -3
  12. data/lib/google/cloud/logging/entry/source_location.rb +3 -3
  13. data/lib/google/cloud/logging/log/list.rb +1 -1
  14. data/lib/google/cloud/logging/metric.rb +2 -2
  15. data/lib/google/cloud/logging/metric/list.rb +1 -1
  16. data/lib/google/cloud/logging/resource_descriptor/list.rb +1 -1
  17. data/lib/google/cloud/logging/service.rb +70 -173
  18. data/lib/google/cloud/logging/sink.rb +2 -2
  19. data/lib/google/cloud/logging/sink/list.rb +1 -1
  20. data/lib/google/cloud/logging/version.rb +1 -1
  21. metadata +11 -81
  22. data/lib/google/cloud/logging/v2.rb +0 -18
  23. data/lib/google/cloud/logging/v2/config_service_v2_client.rb +0 -1368
  24. data/lib/google/cloud/logging/v2/config_service_v2_client_config.json +0 -101
  25. data/lib/google/cloud/logging/v2/credentials.rb +0 -39
  26. data/lib/google/cloud/logging/v2/doc/google/api/distribution.rb +0 -164
  27. data/lib/google/cloud/logging/v2/doc/google/api/label.rb +0 -42
  28. data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +0 -233
  29. data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +0 -85
  30. data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +0 -86
  31. data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +0 -179
  32. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +0 -238
  33. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +0 -660
  34. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +0 -220
  35. data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +0 -131
  36. data/lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb +0 -91
  37. data/lib/google/cloud/logging/v2/doc/google/protobuf/empty.rb +0 -29
  38. data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +0 -222
  39. data/lib/google/cloud/logging/v2/doc/google/protobuf/struct.rb +0 -74
  40. data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +0 -113
  41. data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +0 -680
  42. data/lib/google/cloud/logging/v2/logging_service_v2_client_config.json +0 -56
  43. data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +0 -475
  44. data/lib/google/cloud/logging/v2/metrics_service_v2_client_config.json +0 -51
  45. data/lib/google/logging/v2/log_entry_pb.rb +0 -59
  46. data/lib/google/logging/v2/logging_config_pb.rb +0 -173
  47. data/lib/google/logging/v2/logging_config_services_pb.rb +0 -112
  48. data/lib/google/logging/v2/logging_metrics_pb.rb +0 -72
  49. data/lib/google/logging/v2/logging_metrics_services_pb.rb +0 -52
  50. data/lib/google/logging/v2/logging_pb.rb +0 -80
  51. data/lib/google/logging/v2/logging_services_pb.rb +0 -64
@@ -68,7 +68,7 @@ module Google
68
68
  # @private Create an empty Sink object.
69
69
  def initialize
70
70
  @service = nil
71
- @grpc = Google::Logging::V2::LogSink.new
71
+ @grpc = Google::Cloud::Logging::V2::LogSink.new
72
72
  end
73
73
 
74
74
  ##
@@ -275,7 +275,7 @@ module Google
275
275
  end
276
276
 
277
277
  ##
278
- # @private New Sink from a Google::Logging::V2::LogSink object.
278
+ # @private New Sink from a Google::Cloud::Logging::V2::LogSink object.
279
279
  def self.from_grpc grpc, service
280
280
  new.tap do |f|
281
281
  f.grpc = grpc
@@ -141,7 +141,7 @@ module Google
141
141
 
142
142
  ##
143
143
  # @private New Sink::List from a
144
- # Google::Logging::V2::ListSinksResponse object.
144
+ # Google::Cloud::Logging::V2::ListSinksResponse object.
145
145
  def self.from_grpc grpc_list, service, max = nil
146
146
  sinks = new(Array(grpc_list.sinks).map do |grpc|
147
147
  Sink.from_grpc grpc, service
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Logging
19
- VERSION = "1.10.5".freeze
19
+ VERSION = "2.0.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-05-05 00:00:00.000000000 Z
12
+ date: 2020-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -17,82 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.2'
20
+ version: '1.5'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.2'
27
+ version: '1.5'
28
28
  - !ruby/object:Gem::Dependency
29
- name: stackdriver-core
29
+ name: google-cloud-logging-v2
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.3'
34
+ version: '0.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.3'
41
+ version: '0.0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: google-gax
43
+ name: stackdriver-core
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '1.8'
48
+ version: '1.3'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '1.8'
56
- - !ruby/object:Gem::Dependency
57
- name: googleapis-common-protos
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 1.3.9
63
- - - "<"
64
- - !ruby/object:Gem::Version
65
- version: '2.0'
66
- type: :runtime
67
- prerelease: false
68
- version_requirements: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 1.3.9
73
- - - "<"
74
- - !ruby/object:Gem::Version
75
- version: '2.0'
76
- - !ruby/object:Gem::Dependency
77
- name: googleapis-common-protos-types
78
- requirement: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 1.0.4
83
- - - "<"
84
- - !ruby/object:Gem::Version
85
- version: '2.0'
86
- type: :runtime
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 1.0.4
93
- - - "<"
94
- - !ruby/object:Gem::Version
95
- version: '2.0'
55
+ version: '1.3'
96
56
  - !ruby/object:Gem::Dependency
97
57
  name: concurrent-ruby
98
58
  requirement: !ruby/object:Gem::Requirement
@@ -317,37 +277,7 @@ files:
317
277
  - lib/google/cloud/logging/service.rb
318
278
  - lib/google/cloud/logging/sink.rb
319
279
  - lib/google/cloud/logging/sink/list.rb
320
- - lib/google/cloud/logging/v2.rb
321
- - lib/google/cloud/logging/v2/config_service_v2_client.rb
322
- - lib/google/cloud/logging/v2/config_service_v2_client_config.json
323
- - lib/google/cloud/logging/v2/credentials.rb
324
- - lib/google/cloud/logging/v2/doc/google/api/distribution.rb
325
- - lib/google/cloud/logging/v2/doc/google/api/label.rb
326
- - lib/google/cloud/logging/v2/doc/google/api/metric.rb
327
- - lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb
328
- - lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb
329
- - lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb
330
- - lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb
331
- - lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb
332
- - lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb
333
- - lib/google/cloud/logging/v2/doc/google/protobuf/any.rb
334
- - lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb
335
- - lib/google/cloud/logging/v2/doc/google/protobuf/empty.rb
336
- - lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb
337
- - lib/google/cloud/logging/v2/doc/google/protobuf/struct.rb
338
- - lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb
339
- - lib/google/cloud/logging/v2/logging_service_v2_client.rb
340
- - lib/google/cloud/logging/v2/logging_service_v2_client_config.json
341
- - lib/google/cloud/logging/v2/metrics_service_v2_client.rb
342
- - lib/google/cloud/logging/v2/metrics_service_v2_client_config.json
343
280
  - lib/google/cloud/logging/version.rb
344
- - lib/google/logging/v2/log_entry_pb.rb
345
- - lib/google/logging/v2/logging_config_pb.rb
346
- - lib/google/logging/v2/logging_config_services_pb.rb
347
- - lib/google/logging/v2/logging_metrics_pb.rb
348
- - lib/google/logging/v2/logging_metrics_services_pb.rb
349
- - lib/google/logging/v2/logging_pb.rb
350
- - lib/google/logging/v2/logging_services_pb.rb
351
281
  homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-logging
352
282
  licenses:
353
283
  - Apache-2.0
@@ -367,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
297
  - !ruby/object:Gem::Version
368
298
  version: '0'
369
299
  requirements: []
370
- rubygems_version: 3.0.6
300
+ rubygems_version: 3.1.3
371
301
  signing_key:
372
302
  specification_version: 4
373
303
  summary: API Client library for Stackdriver Logging
@@ -1,18 +0,0 @@
1
- # Copyright 2016 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- require "google/cloud/logging/v2/config_service_v2_client"
17
- require "google/cloud/logging/v2/logging_service_v2_client"
18
- require "google/cloud/logging/v2/metrics_service_v2_client"
@@ -1,1368 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/logging/v2/logging_config.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/logging/v2/logging_config_pb"
29
- require "google/cloud/logging/v2/credentials"
30
- require "google/cloud/logging/version"
31
-
32
- module Google
33
- module Cloud
34
- module Logging
35
- module V2
36
- # Service for configuring sinks used to route log entries.
37
- #
38
- # @!attribute [r] config_service_v2_stub
39
- # @return [Google::Logging::V2::ConfigServiceV2::Stub]
40
- class ConfigServiceV2Client
41
- # @private
42
- attr_reader :config_service_v2_stub
43
-
44
- # The default address of the service.
45
- SERVICE_ADDRESS = "logging.googleapis.com".freeze
46
-
47
- # The default port of the service.
48
- DEFAULT_SERVICE_PORT = 443
49
-
50
- # The default set of gRPC interceptors.
51
- GRPC_INTERCEPTORS = []
52
-
53
- DEFAULT_TIMEOUT = 30
54
-
55
- PAGE_DESCRIPTORS = {
56
- "list_buckets" => Google::Gax::PageDescriptor.new(
57
- "page_token",
58
- "next_page_token",
59
- "buckets"),
60
- "list_sinks" => Google::Gax::PageDescriptor.new(
61
- "page_token",
62
- "next_page_token",
63
- "sinks"),
64
- "list_exclusions" => Google::Gax::PageDescriptor.new(
65
- "page_token",
66
- "next_page_token",
67
- "exclusions")
68
- }.freeze
69
-
70
- private_constant :PAGE_DESCRIPTORS
71
-
72
- # The scopes needed to make gRPC calls to all of the methods defined in
73
- # this service.
74
- ALL_SCOPES = [
75
- "https://www.googleapis.com/auth/cloud-platform",
76
- "https://www.googleapis.com/auth/cloud-platform.read-only",
77
- "https://www.googleapis.com/auth/logging.admin",
78
- "https://www.googleapis.com/auth/logging.read",
79
- "https://www.googleapis.com/auth/logging.write"
80
- ].freeze
81
-
82
-
83
- BILLING_ACCOUNT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
84
- "billingAccounts/{billing_account}"
85
- )
86
-
87
- private_constant :BILLING_ACCOUNT_PATH_TEMPLATE
88
-
89
- BILLING_ACCOUNT_LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
90
- "billingAccounts/{billing_account}/locations/{location}"
91
- )
92
-
93
- private_constant :BILLING_ACCOUNT_LOCATION_PATH_TEMPLATE
94
-
95
- CMEK_SETTINGS_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
96
- "projects/{project}/cmekSettings"
97
- )
98
-
99
- private_constant :CMEK_SETTINGS_PATH_TEMPLATE
100
-
101
- FOLDER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
102
- "folders/{folder}"
103
- )
104
-
105
- private_constant :FOLDER_PATH_TEMPLATE
106
-
107
- FOLDER_LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
108
- "folders/{folder}/locations/{location}"
109
- )
110
-
111
- private_constant :FOLDER_LOCATION_PATH_TEMPLATE
112
-
113
- LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
114
- "projects/{project}/locations/{location}"
115
- )
116
-
117
- private_constant :LOCATION_PATH_TEMPLATE
118
-
119
- LOG_BUCKET_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
120
- "projects/{project}/locations/{location}/buckets/{bucket}"
121
- )
122
-
123
- private_constant :LOG_BUCKET_PATH_TEMPLATE
124
-
125
- LOG_EXCLUSION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
126
- "projects/{project}/exclusions/{exclusion}"
127
- )
128
-
129
- private_constant :LOG_EXCLUSION_PATH_TEMPLATE
130
-
131
- LOG_SINK_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
132
- "projects/{project}/sinks/{sink}"
133
- )
134
-
135
- private_constant :LOG_SINK_PATH_TEMPLATE
136
-
137
- ORGANIZATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
138
- "organizations/{organization}"
139
- )
140
-
141
- private_constant :ORGANIZATION_PATH_TEMPLATE
142
-
143
- ORGANIZATION_LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
144
- "organizations/{organization}/locations/{location}"
145
- )
146
-
147
- private_constant :ORGANIZATION_LOCATION_PATH_TEMPLATE
148
-
149
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
150
- "projects/{project}"
151
- )
152
-
153
- private_constant :PROJECT_PATH_TEMPLATE
154
-
155
- # Returns a fully-qualified billing_account resource name string.
156
- # @param billing_account [String]
157
- # @return [String]
158
- def self.billing_account_path billing_account
159
- BILLING_ACCOUNT_PATH_TEMPLATE.render(
160
- :"billing_account" => billing_account
161
- )
162
- end
163
-
164
- # Returns a fully-qualified billing_account_location resource name string.
165
- # @param billing_account [String]
166
- # @param location [String]
167
- # @return [String]
168
- def self.billing_account_location_path billing_account, location
169
- BILLING_ACCOUNT_LOCATION_PATH_TEMPLATE.render(
170
- :"billing_account" => billing_account,
171
- :"location" => location
172
- )
173
- end
174
-
175
- # Returns a fully-qualified cmek_settings resource name string.
176
- # @param project [String]
177
- # @return [String]
178
- def self.cmek_settings_path project
179
- CMEK_SETTINGS_PATH_TEMPLATE.render(
180
- :"project" => project
181
- )
182
- end
183
-
184
- # Returns a fully-qualified folder resource name string.
185
- # @param folder [String]
186
- # @return [String]
187
- def self.folder_path folder
188
- FOLDER_PATH_TEMPLATE.render(
189
- :"folder" => folder
190
- )
191
- end
192
-
193
- # Returns a fully-qualified folder_location resource name string.
194
- # @param folder [String]
195
- # @param location [String]
196
- # @return [String]
197
- def self.folder_location_path folder, location
198
- FOLDER_LOCATION_PATH_TEMPLATE.render(
199
- :"folder" => folder,
200
- :"location" => location
201
- )
202
- end
203
-
204
- # Returns a fully-qualified location resource name string.
205
- # @param project [String]
206
- # @param location [String]
207
- # @return [String]
208
- def self.location_path project, location
209
- LOCATION_PATH_TEMPLATE.render(
210
- :"project" => project,
211
- :"location" => location
212
- )
213
- end
214
-
215
- # Returns a fully-qualified log_bucket resource name string.
216
- # @param project [String]
217
- # @param location [String]
218
- # @param bucket [String]
219
- # @return [String]
220
- def self.log_bucket_path project, location, bucket
221
- LOG_BUCKET_PATH_TEMPLATE.render(
222
- :"project" => project,
223
- :"location" => location,
224
- :"bucket" => bucket
225
- )
226
- end
227
-
228
- # Returns a fully-qualified log_exclusion resource name string.
229
- # @param project [String]
230
- # @param exclusion [String]
231
- # @return [String]
232
- def self.log_exclusion_path project, exclusion
233
- LOG_EXCLUSION_PATH_TEMPLATE.render(
234
- :"project" => project,
235
- :"exclusion" => exclusion
236
- )
237
- end
238
-
239
- # Returns a fully-qualified log_sink resource name string.
240
- # @param project [String]
241
- # @param sink [String]
242
- # @return [String]
243
- def self.log_sink_path project, sink
244
- LOG_SINK_PATH_TEMPLATE.render(
245
- :"project" => project,
246
- :"sink" => sink
247
- )
248
- end
249
-
250
- # Returns a fully-qualified organization resource name string.
251
- # @param organization [String]
252
- # @return [String]
253
- def self.organization_path organization
254
- ORGANIZATION_PATH_TEMPLATE.render(
255
- :"organization" => organization
256
- )
257
- end
258
-
259
- # Returns a fully-qualified organization_location resource name string.
260
- # @param organization [String]
261
- # @param location [String]
262
- # @return [String]
263
- def self.organization_location_path organization, location
264
- ORGANIZATION_LOCATION_PATH_TEMPLATE.render(
265
- :"organization" => organization,
266
- :"location" => location
267
- )
268
- end
269
-
270
- # Returns a fully-qualified project resource name string.
271
- # @param project [String]
272
- # @return [String]
273
- def self.project_path project
274
- PROJECT_PATH_TEMPLATE.render(
275
- :"project" => project
276
- )
277
- end
278
-
279
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
280
- # Provides the means for authenticating requests made by the client. This parameter can
281
- # be many types.
282
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
283
- # authenticating requests made by this client.
284
- # A `String` will be treated as the path to the keyfile to be used for the construction of
285
- # credentials for this client.
286
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
287
- # credentials for this client.
288
- # A `GRPC::Core::Channel` will be used to make calls through.
289
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
290
- # should already be composed with a `GRPC::Core::CallCredentials` object.
291
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
292
- # metadata for requests, generally, to give OAuth credentials.
293
- # @param scopes [Array<String>]
294
- # The OAuth scopes for this service. This parameter is ignored if
295
- # an updater_proc is supplied.
296
- # @param client_config [Hash]
297
- # A Hash for call options for each method. See
298
- # Google::Gax#construct_settings for the structure of
299
- # this data. Falls back to the default config if not specified
300
- # or the specified config is missing data points.
301
- # @param timeout [Numeric]
302
- # The default timeout, in seconds, for calls made through this client.
303
- # @param metadata [Hash]
304
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
305
- # @param service_address [String]
306
- # Override for the service hostname, or `nil` to leave as the default.
307
- # @param service_port [Integer]
308
- # Override for the service port, or `nil` to leave as the default.
309
- # @param exception_transformer [Proc]
310
- # An optional proc that intercepts any exceptions raised during an API call to inject
311
- # custom error handling.
312
- def initialize \
313
- credentials: nil,
314
- scopes: ALL_SCOPES,
315
- client_config: {},
316
- timeout: DEFAULT_TIMEOUT,
317
- metadata: nil,
318
- service_address: nil,
319
- service_port: nil,
320
- exception_transformer: nil,
321
- lib_name: nil,
322
- lib_version: ""
323
- # These require statements are intentionally placed here to initialize
324
- # the gRPC module only when it's required.
325
- # See https://github.com/googleapis/toolkit/issues/446
326
- require "google/gax/grpc"
327
- require "google/logging/v2/logging_config_services_pb"
328
-
329
- credentials ||= Google::Cloud::Logging::V2::Credentials.default
330
-
331
- if credentials.is_a?(String) || credentials.is_a?(Hash)
332
- updater_proc = Google::Cloud::Logging::V2::Credentials.new(credentials).updater_proc
333
- end
334
- if credentials.is_a?(GRPC::Core::Channel)
335
- channel = credentials
336
- end
337
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
338
- chan_creds = credentials
339
- end
340
- if credentials.is_a?(Proc)
341
- updater_proc = credentials
342
- end
343
- if credentials.is_a?(Google::Auth::Credentials)
344
- updater_proc = credentials.updater_proc
345
- end
346
-
347
- package_version = Google::Cloud::Logging::VERSION
348
-
349
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
350
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
351
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
352
- google_api_client << " grpc/#{GRPC::VERSION}"
353
- google_api_client.freeze
354
-
355
- headers = { :"x-goog-api-client" => google_api_client }
356
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
357
- headers[:"x-goog-user-project"] = credentials.quota_project_id
358
- end
359
- headers.merge!(metadata) unless metadata.nil?
360
- client_config_file = Pathname.new(__dir__).join(
361
- "config_service_v2_client_config.json"
362
- )
363
- defaults = client_config_file.open do |f|
364
- Google::Gax.construct_settings(
365
- "google.logging.v2.ConfigServiceV2",
366
- JSON.parse(f.read),
367
- client_config,
368
- Google::Gax::Grpc::STATUS_CODE_NAMES,
369
- timeout,
370
- page_descriptors: PAGE_DESCRIPTORS,
371
- errors: Google::Gax::Grpc::API_ERRORS,
372
- metadata: headers
373
- )
374
- end
375
-
376
- # Allow overriding the service path/port in subclasses.
377
- service_path = service_address || self.class::SERVICE_ADDRESS
378
- port = service_port || self.class::DEFAULT_SERVICE_PORT
379
- interceptors = self.class::GRPC_INTERCEPTORS
380
- @config_service_v2_stub = Google::Gax::Grpc.create_stub(
381
- service_path,
382
- port,
383
- chan_creds: chan_creds,
384
- channel: channel,
385
- updater_proc: updater_proc,
386
- scopes: scopes,
387
- interceptors: interceptors,
388
- &Google::Logging::V2::ConfigServiceV2::Stub.method(:new)
389
- )
390
-
391
- @list_buckets = Google::Gax.create_api_call(
392
- @config_service_v2_stub.method(:list_buckets),
393
- defaults["list_buckets"],
394
- exception_transformer: exception_transformer,
395
- params_extractor: proc do |request|
396
- {'parent' => request.parent}
397
- end
398
- )
399
- @get_bucket = Google::Gax.create_api_call(
400
- @config_service_v2_stub.method(:get_bucket),
401
- defaults["get_bucket"],
402
- exception_transformer: exception_transformer,
403
- params_extractor: proc do |request|
404
- {'name' => request.name}
405
- end
406
- )
407
- @update_bucket = Google::Gax.create_api_call(
408
- @config_service_v2_stub.method(:update_bucket),
409
- defaults["update_bucket"],
410
- exception_transformer: exception_transformer,
411
- params_extractor: proc do |request|
412
- {'name' => request.name}
413
- end
414
- )
415
- @list_sinks = Google::Gax.create_api_call(
416
- @config_service_v2_stub.method(:list_sinks),
417
- defaults["list_sinks"],
418
- exception_transformer: exception_transformer,
419
- params_extractor: proc do |request|
420
- {'parent' => request.parent}
421
- end
422
- )
423
- @get_sink = Google::Gax.create_api_call(
424
- @config_service_v2_stub.method(:get_sink),
425
- defaults["get_sink"],
426
- exception_transformer: exception_transformer,
427
- params_extractor: proc do |request|
428
- {'sink_name' => request.sink_name}
429
- end
430
- )
431
- @create_sink = Google::Gax.create_api_call(
432
- @config_service_v2_stub.method(:create_sink),
433
- defaults["create_sink"],
434
- exception_transformer: exception_transformer,
435
- params_extractor: proc do |request|
436
- {'parent' => request.parent}
437
- end
438
- )
439
- @update_sink = Google::Gax.create_api_call(
440
- @config_service_v2_stub.method(:update_sink),
441
- defaults["update_sink"],
442
- exception_transformer: exception_transformer,
443
- params_extractor: proc do |request|
444
- {'sink_name' => request.sink_name}
445
- end
446
- )
447
- @delete_sink = Google::Gax.create_api_call(
448
- @config_service_v2_stub.method(:delete_sink),
449
- defaults["delete_sink"],
450
- exception_transformer: exception_transformer,
451
- params_extractor: proc do |request|
452
- {'sink_name' => request.sink_name}
453
- end
454
- )
455
- @list_exclusions = Google::Gax.create_api_call(
456
- @config_service_v2_stub.method(:list_exclusions),
457
- defaults["list_exclusions"],
458
- exception_transformer: exception_transformer,
459
- params_extractor: proc do |request|
460
- {'parent' => request.parent}
461
- end
462
- )
463
- @get_exclusion = Google::Gax.create_api_call(
464
- @config_service_v2_stub.method(:get_exclusion),
465
- defaults["get_exclusion"],
466
- exception_transformer: exception_transformer,
467
- params_extractor: proc do |request|
468
- {'name' => request.name}
469
- end
470
- )
471
- @create_exclusion = Google::Gax.create_api_call(
472
- @config_service_v2_stub.method(:create_exclusion),
473
- defaults["create_exclusion"],
474
- exception_transformer: exception_transformer,
475
- params_extractor: proc do |request|
476
- {'parent' => request.parent}
477
- end
478
- )
479
- @update_exclusion = Google::Gax.create_api_call(
480
- @config_service_v2_stub.method(:update_exclusion),
481
- defaults["update_exclusion"],
482
- exception_transformer: exception_transformer,
483
- params_extractor: proc do |request|
484
- {'name' => request.name}
485
- end
486
- )
487
- @delete_exclusion = Google::Gax.create_api_call(
488
- @config_service_v2_stub.method(:delete_exclusion),
489
- defaults["delete_exclusion"],
490
- exception_transformer: exception_transformer,
491
- params_extractor: proc do |request|
492
- {'name' => request.name}
493
- end
494
- )
495
- @get_cmek_settings = Google::Gax.create_api_call(
496
- @config_service_v2_stub.method(:get_cmek_settings),
497
- defaults["get_cmek_settings"],
498
- exception_transformer: exception_transformer,
499
- params_extractor: proc do |request|
500
- {'name' => request.name}
501
- end
502
- )
503
- @update_cmek_settings = Google::Gax.create_api_call(
504
- @config_service_v2_stub.method(:update_cmek_settings),
505
- defaults["update_cmek_settings"],
506
- exception_transformer: exception_transformer,
507
- params_extractor: proc do |request|
508
- {'name' => request.name}
509
- end
510
- )
511
- end
512
-
513
- # Service calls
514
-
515
- # Lists buckets (Beta).
516
- #
517
- # @param parent [String]
518
- # Required. The parent resource whose buckets are to be listed:
519
- #
520
- # "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
521
- # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
522
- # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
523
- # "folders/[FOLDER_ID]/locations/[LOCATION_ID]"
524
- #
525
- # Note: The locations portion of the resource must be specified, but
526
- # supplying the character `-` in place of [LOCATION_ID] will return all
527
- # buckets.
528
- # @param page_size [Integer]
529
- # The maximum number of resources contained in the underlying API
530
- # response. If page streaming is performed per-resource, this
531
- # parameter does not affect the return value. If page streaming is
532
- # performed per-page, this determines the maximum number of
533
- # resources in a page.
534
- # @param options [Google::Gax::CallOptions]
535
- # Overrides the default settings for this call, e.g, timeout,
536
- # retries, etc.
537
- # @yield [result, operation] Access the result along with the RPC operation
538
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Logging::V2::LogBucket>]
539
- # @yieldparam operation [GRPC::ActiveCall::Operation]
540
- # @return [Google::Gax::PagedEnumerable<Google::Logging::V2::LogBucket>]
541
- # An enumerable of Google::Logging::V2::LogBucket instances.
542
- # See Google::Gax::PagedEnumerable documentation for other
543
- # operations such as per-page iteration or access to the response
544
- # object.
545
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
546
- # @example
547
- # require "google/cloud/logging/v2"
548
- #
549
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
550
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.location_path("[PROJECT]", "[LOCATION]")
551
- #
552
- # # Iterate over all results.
553
- # config_client.list_buckets(formatted_parent).each do |element|
554
- # # Process element.
555
- # end
556
- #
557
- # # Or iterate over results one page at a time.
558
- # config_client.list_buckets(formatted_parent).each_page do |page|
559
- # # Process each page at a time.
560
- # page.each do |element|
561
- # # Process element.
562
- # end
563
- # end
564
-
565
- def list_buckets \
566
- parent,
567
- page_size: nil,
568
- options: nil,
569
- &block
570
- req = {
571
- parent: parent,
572
- page_size: page_size
573
- }.delete_if { |_, v| v.nil? }
574
- req = Google::Gax::to_proto(req, Google::Logging::V2::ListBucketsRequest)
575
- @list_buckets.call(req, options, &block)
576
- end
577
-
578
- # Gets a bucket (Beta).
579
- #
580
- # @param name [String]
581
- # Required. The resource name of the bucket:
582
- #
583
- # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
584
- # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
585
- # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
586
- # "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
587
- #
588
- # Example:
589
- # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id"`.
590
- # @param options [Google::Gax::CallOptions]
591
- # Overrides the default settings for this call, e.g, timeout,
592
- # retries, etc.
593
- # @yield [result, operation] Access the result along with the RPC operation
594
- # @yieldparam result [Google::Logging::V2::LogBucket]
595
- # @yieldparam operation [GRPC::ActiveCall::Operation]
596
- # @return [Google::Logging::V2::LogBucket]
597
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
598
- # @example
599
- # require "google/cloud/logging/v2"
600
- #
601
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
602
- #
603
- # # TODO: Initialize `name`:
604
- # name = ''
605
- # response = config_client.get_bucket(name)
606
-
607
- def get_bucket \
608
- name,
609
- options: nil,
610
- &block
611
- req = {
612
- name: name
613
- }.delete_if { |_, v| v.nil? }
614
- req = Google::Gax::to_proto(req, Google::Logging::V2::GetBucketRequest)
615
- @get_bucket.call(req, options, &block)
616
- end
617
-
618
- # Updates a bucket. This method replaces the following fields in the
619
- # existing bucket with values from the new bucket: `retention_period`
620
- #
621
- # If the retention period is decreased and the bucket is locked,
622
- # FAILED_PRECONDITION will be returned.
623
- #
624
- # If the bucket has a LifecycleState of DELETE_REQUESTED, FAILED_PRECONDITION
625
- # will be returned.
626
- #
627
- # A buckets region may not be modified after it is created.
628
- # This method is in Beta.
629
- #
630
- # @param name [String]
631
- # Required. The full resource name of the bucket to update.
632
- #
633
- # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
634
- # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
635
- # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
636
- # "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
637
- #
638
- # Example:
639
- # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id"`. Also
640
- # requires permission "resourcemanager.projects.updateLiens" to set the
641
- # locked property
642
- # @param bucket [Google::Logging::V2::LogBucket | Hash]
643
- # Required. The updated bucket.
644
- # A hash of the same form as `Google::Logging::V2::LogBucket`
645
- # can also be provided.
646
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
647
- # Required. Field mask that specifies the fields in `bucket` that need an update. A
648
- # bucket field will be overwritten if, and only if, it is in the update
649
- # mask. `name` and output only fields cannot be updated.
650
- #
651
- # For a detailed `FieldMask` definition, see
652
- # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
653
- #
654
- # Example: `updateMask=retention_days`.
655
- # A hash of the same form as `Google::Protobuf::FieldMask`
656
- # can also be provided.
657
- # @param options [Google::Gax::CallOptions]
658
- # Overrides the default settings for this call, e.g, timeout,
659
- # retries, etc.
660
- # @yield [result, operation] Access the result along with the RPC operation
661
- # @yieldparam result [Google::Logging::V2::LogBucket]
662
- # @yieldparam operation [GRPC::ActiveCall::Operation]
663
- # @return [Google::Logging::V2::LogBucket]
664
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
665
- # @example
666
- # require "google/cloud/logging/v2"
667
- #
668
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
669
- #
670
- # # TODO: Initialize `name`:
671
- # name = ''
672
- #
673
- # # TODO: Initialize `bucket`:
674
- # bucket = {}
675
- #
676
- # # TODO: Initialize `update_mask`:
677
- # update_mask = {}
678
- # response = config_client.update_bucket(name, bucket, update_mask)
679
-
680
- def update_bucket \
681
- name,
682
- bucket,
683
- update_mask,
684
- options: nil,
685
- &block
686
- req = {
687
- name: name,
688
- bucket: bucket,
689
- update_mask: update_mask
690
- }.delete_if { |_, v| v.nil? }
691
- req = Google::Gax::to_proto(req, Google::Logging::V2::UpdateBucketRequest)
692
- @update_bucket.call(req, options, &block)
693
- end
694
-
695
- # Lists sinks.
696
- #
697
- # @param parent [String]
698
- # Required. The parent resource whose sinks are to be listed:
699
- #
700
- # "projects/[PROJECT_ID]"
701
- # "organizations/[ORGANIZATION_ID]"
702
- # "billingAccounts/[BILLING_ACCOUNT_ID]"
703
- # "folders/[FOLDER_ID]"
704
- # @param page_size [Integer]
705
- # The maximum number of resources contained in the underlying API
706
- # response. If page streaming is performed per-resource, this
707
- # parameter does not affect the return value. If page streaming is
708
- # performed per-page, this determines the maximum number of
709
- # resources in a page.
710
- # @param options [Google::Gax::CallOptions]
711
- # Overrides the default settings for this call, e.g, timeout,
712
- # retries, etc.
713
- # @yield [result, operation] Access the result along with the RPC operation
714
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Logging::V2::LogSink>]
715
- # @yieldparam operation [GRPC::ActiveCall::Operation]
716
- # @return [Google::Gax::PagedEnumerable<Google::Logging::V2::LogSink>]
717
- # An enumerable of Google::Logging::V2::LogSink instances.
718
- # See Google::Gax::PagedEnumerable documentation for other
719
- # operations such as per-page iteration or access to the response
720
- # object.
721
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
722
- # @example
723
- # require "google/cloud/logging/v2"
724
- #
725
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
726
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
727
- #
728
- # # Iterate over all results.
729
- # config_client.list_sinks(formatted_parent).each do |element|
730
- # # Process element.
731
- # end
732
- #
733
- # # Or iterate over results one page at a time.
734
- # config_client.list_sinks(formatted_parent).each_page do |page|
735
- # # Process each page at a time.
736
- # page.each do |element|
737
- # # Process element.
738
- # end
739
- # end
740
-
741
- def list_sinks \
742
- parent,
743
- page_size: nil,
744
- options: nil,
745
- &block
746
- req = {
747
- parent: parent,
748
- page_size: page_size
749
- }.delete_if { |_, v| v.nil? }
750
- req = Google::Gax::to_proto(req, Google::Logging::V2::ListSinksRequest)
751
- @list_sinks.call(req, options, &block)
752
- end
753
-
754
- # Gets a sink.
755
- #
756
- # @param sink_name [String]
757
- # Required. The resource name of the sink:
758
- #
759
- # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
760
- # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
761
- # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
762
- # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
763
- #
764
- # Example: `"projects/my-project-id/sinks/my-sink-id"`.
765
- # @param options [Google::Gax::CallOptions]
766
- # Overrides the default settings for this call, e.g, timeout,
767
- # retries, etc.
768
- # @yield [result, operation] Access the result along with the RPC operation
769
- # @yieldparam result [Google::Logging::V2::LogSink]
770
- # @yieldparam operation [GRPC::ActiveCall::Operation]
771
- # @return [Google::Logging::V2::LogSink]
772
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
773
- # @example
774
- # require "google/cloud/logging/v2"
775
- #
776
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
777
- #
778
- # # TODO: Initialize `sink_name`:
779
- # sink_name = ''
780
- # response = config_client.get_sink(sink_name)
781
-
782
- def get_sink \
783
- sink_name,
784
- options: nil,
785
- &block
786
- req = {
787
- sink_name: sink_name
788
- }.delete_if { |_, v| v.nil? }
789
- req = Google::Gax::to_proto(req, Google::Logging::V2::GetSinkRequest)
790
- @get_sink.call(req, options, &block)
791
- end
792
-
793
- # Creates a sink that exports specified log entries to a destination. The
794
- # export of newly-ingested log entries begins immediately, unless the sink's
795
- # `writer_identity` is not permitted to write to the destination. A sink can
796
- # export log entries only from the resource owning the sink.
797
- #
798
- # @param parent [String]
799
- # Required. The resource in which to create the sink:
800
- #
801
- # "projects/[PROJECT_ID]"
802
- # "organizations/[ORGANIZATION_ID]"
803
- # "billingAccounts/[BILLING_ACCOUNT_ID]"
804
- # "folders/[FOLDER_ID]"
805
- #
806
- # Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
807
- # @param sink [Google::Logging::V2::LogSink | Hash]
808
- # Required. The new sink, whose `name` parameter is a sink identifier that
809
- # is not already in use.
810
- # A hash of the same form as `Google::Logging::V2::LogSink`
811
- # can also be provided.
812
- # @param unique_writer_identity [true, false]
813
- # Optional. Determines the kind of IAM identity returned as `writer_identity`
814
- # in the new sink. If this value is omitted or set to false, and if the
815
- # sink's parent is a project, then the value returned as `writer_identity` is
816
- # the same group or service account used by Logging before the addition of
817
- # writer identities to this API. The sink's destination must be in the same
818
- # project as the sink itself.
819
- #
820
- # If this field is set to true, or if the sink is owned by a non-project
821
- # resource such as an organization, then the value of `writer_identity` will
822
- # be a unique service account used only for exports from the new sink. For
823
- # more information, see `writer_identity` in {Google::Logging::V2::LogSink LogSink}.
824
- # @param options [Google::Gax::CallOptions]
825
- # Overrides the default settings for this call, e.g, timeout,
826
- # retries, etc.
827
- # @yield [result, operation] Access the result along with the RPC operation
828
- # @yieldparam result [Google::Logging::V2::LogSink]
829
- # @yieldparam operation [GRPC::ActiveCall::Operation]
830
- # @return [Google::Logging::V2::LogSink]
831
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
832
- # @example
833
- # require "google/cloud/logging/v2"
834
- #
835
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
836
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
837
- #
838
- # # TODO: Initialize `sink`:
839
- # sink = {}
840
- # response = config_client.create_sink(formatted_parent, sink)
841
-
842
- def create_sink \
843
- parent,
844
- sink,
845
- unique_writer_identity: nil,
846
- options: nil,
847
- &block
848
- req = {
849
- parent: parent,
850
- sink: sink,
851
- unique_writer_identity: unique_writer_identity
852
- }.delete_if { |_, v| v.nil? }
853
- req = Google::Gax::to_proto(req, Google::Logging::V2::CreateSinkRequest)
854
- @create_sink.call(req, options, &block)
855
- end
856
-
857
- # Updates a sink. This method replaces the following fields in the existing
858
- # sink with values from the new sink: `destination`, and `filter`.
859
- #
860
- # The updated sink might also have a new `writer_identity`; see the
861
- # `unique_writer_identity` field.
862
- #
863
- # @param sink_name [String]
864
- # Required. The full resource name of the sink to update, including the parent
865
- # resource and the sink identifier:
866
- #
867
- # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
868
- # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
869
- # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
870
- # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
871
- #
872
- # Example: `"projects/my-project-id/sinks/my-sink-id"`.
873
- # @param sink [Google::Logging::V2::LogSink | Hash]
874
- # Required. The updated sink, whose name is the same identifier that appears as part
875
- # of `sink_name`.
876
- # A hash of the same form as `Google::Logging::V2::LogSink`
877
- # can also be provided.
878
- # @param unique_writer_identity [true, false]
879
- # Optional. See {Google::Logging::V2::ConfigServiceV2#create_sink}
880
- # for a description of this field. When updating a sink, the effect of this
881
- # field on the value of `writer_identity` in the updated sink depends on both
882
- # the old and new values of this field:
883
- #
884
- # * If the old and new values of this field are both false or both true,
885
- # then there is no change to the sink's `writer_identity`.
886
- # * If the old value is false and the new value is true, then
887
- # `writer_identity` is changed to a unique service account.
888
- # * It is an error if the old value is true and the new value is
889
- # set to false or defaulted to false.
890
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
891
- # Optional. Field mask that specifies the fields in `sink` that need
892
- # an update. A sink field will be overwritten if, and only if, it is
893
- # in the update mask. `name` and output only fields cannot be updated.
894
- #
895
- # An empty updateMask is temporarily treated as using the following mask
896
- # for backwards compatibility purposes:
897
- # destination,filter,includeChildren
898
- # At some point in the future, behavior will be removed and specifying an
899
- # empty updateMask will be an error.
900
- #
901
- # For a detailed `FieldMask` definition, see
902
- # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
903
- #
904
- # Example: `updateMask=filter`.
905
- # A hash of the same form as `Google::Protobuf::FieldMask`
906
- # can also be provided.
907
- # @param options [Google::Gax::CallOptions]
908
- # Overrides the default settings for this call, e.g, timeout,
909
- # retries, etc.
910
- # @yield [result, operation] Access the result along with the RPC operation
911
- # @yieldparam result [Google::Logging::V2::LogSink]
912
- # @yieldparam operation [GRPC::ActiveCall::Operation]
913
- # @return [Google::Logging::V2::LogSink]
914
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
915
- # @example
916
- # require "google/cloud/logging/v2"
917
- #
918
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
919
- #
920
- # # TODO: Initialize `sink_name`:
921
- # sink_name = ''
922
- #
923
- # # TODO: Initialize `sink`:
924
- # sink = {}
925
- # response = config_client.update_sink(sink_name, sink)
926
-
927
- def update_sink \
928
- sink_name,
929
- sink,
930
- unique_writer_identity: nil,
931
- update_mask: nil,
932
- options: nil,
933
- &block
934
- req = {
935
- sink_name: sink_name,
936
- sink: sink,
937
- unique_writer_identity: unique_writer_identity,
938
- update_mask: update_mask
939
- }.delete_if { |_, v| v.nil? }
940
- req = Google::Gax::to_proto(req, Google::Logging::V2::UpdateSinkRequest)
941
- @update_sink.call(req, options, &block)
942
- end
943
-
944
- # Deletes a sink. If the sink has a unique `writer_identity`, then that
945
- # service account is also deleted.
946
- #
947
- # @param sink_name [String]
948
- # Required. The full resource name of the sink to delete, including the parent
949
- # resource and the sink identifier:
950
- #
951
- # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
952
- # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
953
- # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
954
- # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
955
- #
956
- # Example: `"projects/my-project-id/sinks/my-sink-id"`.
957
- # @param options [Google::Gax::CallOptions]
958
- # Overrides the default settings for this call, e.g, timeout,
959
- # retries, etc.
960
- # @yield [result, operation] Access the result along with the RPC operation
961
- # @yieldparam result []
962
- # @yieldparam operation [GRPC::ActiveCall::Operation]
963
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
964
- # @example
965
- # require "google/cloud/logging/v2"
966
- #
967
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
968
- #
969
- # # TODO: Initialize `sink_name`:
970
- # sink_name = ''
971
- # config_client.delete_sink(sink_name)
972
-
973
- def delete_sink \
974
- sink_name,
975
- options: nil,
976
- &block
977
- req = {
978
- sink_name: sink_name
979
- }.delete_if { |_, v| v.nil? }
980
- req = Google::Gax::to_proto(req, Google::Logging::V2::DeleteSinkRequest)
981
- @delete_sink.call(req, options, &block)
982
- nil
983
- end
984
-
985
- # Lists all the exclusions in a parent resource.
986
- #
987
- # @param parent [String]
988
- # Required. The parent resource whose exclusions are to be listed.
989
- #
990
- # "projects/[PROJECT_ID]"
991
- # "organizations/[ORGANIZATION_ID]"
992
- # "billingAccounts/[BILLING_ACCOUNT_ID]"
993
- # "folders/[FOLDER_ID]"
994
- # @param page_size [Integer]
995
- # The maximum number of resources contained in the underlying API
996
- # response. If page streaming is performed per-resource, this
997
- # parameter does not affect the return value. If page streaming is
998
- # performed per-page, this determines the maximum number of
999
- # resources in a page.
1000
- # @param options [Google::Gax::CallOptions]
1001
- # Overrides the default settings for this call, e.g, timeout,
1002
- # retries, etc.
1003
- # @yield [result, operation] Access the result along with the RPC operation
1004
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Logging::V2::LogExclusion>]
1005
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1006
- # @return [Google::Gax::PagedEnumerable<Google::Logging::V2::LogExclusion>]
1007
- # An enumerable of Google::Logging::V2::LogExclusion instances.
1008
- # See Google::Gax::PagedEnumerable documentation for other
1009
- # operations such as per-page iteration or access to the response
1010
- # object.
1011
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1012
- # @example
1013
- # require "google/cloud/logging/v2"
1014
- #
1015
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1016
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
1017
- #
1018
- # # Iterate over all results.
1019
- # config_client.list_exclusions(formatted_parent).each do |element|
1020
- # # Process element.
1021
- # end
1022
- #
1023
- # # Or iterate over results one page at a time.
1024
- # config_client.list_exclusions(formatted_parent).each_page do |page|
1025
- # # Process each page at a time.
1026
- # page.each do |element|
1027
- # # Process element.
1028
- # end
1029
- # end
1030
-
1031
- def list_exclusions \
1032
- parent,
1033
- page_size: nil,
1034
- options: nil,
1035
- &block
1036
- req = {
1037
- parent: parent,
1038
- page_size: page_size
1039
- }.delete_if { |_, v| v.nil? }
1040
- req = Google::Gax::to_proto(req, Google::Logging::V2::ListExclusionsRequest)
1041
- @list_exclusions.call(req, options, &block)
1042
- end
1043
-
1044
- # Gets the description of an exclusion.
1045
- #
1046
- # @param name [String]
1047
- # Required. The resource name of an existing exclusion:
1048
- #
1049
- # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
1050
- # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
1051
- # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
1052
- # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
1053
- #
1054
- # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
1055
- # @param options [Google::Gax::CallOptions]
1056
- # Overrides the default settings for this call, e.g, timeout,
1057
- # retries, etc.
1058
- # @yield [result, operation] Access the result along with the RPC operation
1059
- # @yieldparam result [Google::Logging::V2::LogExclusion]
1060
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1061
- # @return [Google::Logging::V2::LogExclusion]
1062
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1063
- # @example
1064
- # require "google/cloud/logging/v2"
1065
- #
1066
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1067
- #
1068
- # # TODO: Initialize `name`:
1069
- # name = ''
1070
- # response = config_client.get_exclusion(name)
1071
-
1072
- def get_exclusion \
1073
- name,
1074
- options: nil,
1075
- &block
1076
- req = {
1077
- name: name
1078
- }.delete_if { |_, v| v.nil? }
1079
- req = Google::Gax::to_proto(req, Google::Logging::V2::GetExclusionRequest)
1080
- @get_exclusion.call(req, options, &block)
1081
- end
1082
-
1083
- # Creates a new exclusion in a specified parent resource.
1084
- # Only log entries belonging to that resource can be excluded.
1085
- # You can have up to 10 exclusions in a resource.
1086
- #
1087
- # @param parent [String]
1088
- # Required. The parent resource in which to create the exclusion:
1089
- #
1090
- # "projects/[PROJECT_ID]"
1091
- # "organizations/[ORGANIZATION_ID]"
1092
- # "billingAccounts/[BILLING_ACCOUNT_ID]"
1093
- # "folders/[FOLDER_ID]"
1094
- #
1095
- # Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
1096
- # @param exclusion [Google::Logging::V2::LogExclusion | Hash]
1097
- # Required. The new exclusion, whose `name` parameter is an exclusion name
1098
- # that is not already used in the parent resource.
1099
- # A hash of the same form as `Google::Logging::V2::LogExclusion`
1100
- # can also be provided.
1101
- # @param options [Google::Gax::CallOptions]
1102
- # Overrides the default settings for this call, e.g, timeout,
1103
- # retries, etc.
1104
- # @yield [result, operation] Access the result along with the RPC operation
1105
- # @yieldparam result [Google::Logging::V2::LogExclusion]
1106
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1107
- # @return [Google::Logging::V2::LogExclusion]
1108
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1109
- # @example
1110
- # require "google/cloud/logging/v2"
1111
- #
1112
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1113
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
1114
- #
1115
- # # TODO: Initialize `exclusion`:
1116
- # exclusion = {}
1117
- # response = config_client.create_exclusion(formatted_parent, exclusion)
1118
-
1119
- def create_exclusion \
1120
- parent,
1121
- exclusion,
1122
- options: nil,
1123
- &block
1124
- req = {
1125
- parent: parent,
1126
- exclusion: exclusion
1127
- }.delete_if { |_, v| v.nil? }
1128
- req = Google::Gax::to_proto(req, Google::Logging::V2::CreateExclusionRequest)
1129
- @create_exclusion.call(req, options, &block)
1130
- end
1131
-
1132
- # Changes one or more properties of an existing exclusion.
1133
- #
1134
- # @param name [String]
1135
- # Required. The resource name of the exclusion to update:
1136
- #
1137
- # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
1138
- # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
1139
- # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
1140
- # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
1141
- #
1142
- # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
1143
- # @param exclusion [Google::Logging::V2::LogExclusion | Hash]
1144
- # Required. New values for the existing exclusion. Only the fields specified in
1145
- # `update_mask` are relevant.
1146
- # A hash of the same form as `Google::Logging::V2::LogExclusion`
1147
- # can also be provided.
1148
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1149
- # Required. A non-empty list of fields to change in the existing exclusion. New values
1150
- # for the fields are taken from the corresponding fields in the
1151
- # {Google::Logging::V2::LogExclusion LogExclusion} included in this request. Fields not mentioned in
1152
- # `update_mask` are not changed and are ignored in the request.
1153
- #
1154
- # For example, to change the filter and description of an exclusion,
1155
- # specify an `update_mask` of `"filter,description"`.
1156
- # A hash of the same form as `Google::Protobuf::FieldMask`
1157
- # can also be provided.
1158
- # @param options [Google::Gax::CallOptions]
1159
- # Overrides the default settings for this call, e.g, timeout,
1160
- # retries, etc.
1161
- # @yield [result, operation] Access the result along with the RPC operation
1162
- # @yieldparam result [Google::Logging::V2::LogExclusion]
1163
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1164
- # @return [Google::Logging::V2::LogExclusion]
1165
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1166
- # @example
1167
- # require "google/cloud/logging/v2"
1168
- #
1169
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1170
- #
1171
- # # TODO: Initialize `name`:
1172
- # name = ''
1173
- #
1174
- # # TODO: Initialize `exclusion`:
1175
- # exclusion = {}
1176
- #
1177
- # # TODO: Initialize `update_mask`:
1178
- # update_mask = {}
1179
- # response = config_client.update_exclusion(name, exclusion, update_mask)
1180
-
1181
- def update_exclusion \
1182
- name,
1183
- exclusion,
1184
- update_mask,
1185
- options: nil,
1186
- &block
1187
- req = {
1188
- name: name,
1189
- exclusion: exclusion,
1190
- update_mask: update_mask
1191
- }.delete_if { |_, v| v.nil? }
1192
- req = Google::Gax::to_proto(req, Google::Logging::V2::UpdateExclusionRequest)
1193
- @update_exclusion.call(req, options, &block)
1194
- end
1195
-
1196
- # Deletes an exclusion.
1197
- #
1198
- # @param name [String]
1199
- # Required. The resource name of an existing exclusion to delete:
1200
- #
1201
- # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
1202
- # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
1203
- # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
1204
- # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
1205
- #
1206
- # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
1207
- # @param options [Google::Gax::CallOptions]
1208
- # Overrides the default settings for this call, e.g, timeout,
1209
- # retries, etc.
1210
- # @yield [result, operation] Access the result along with the RPC operation
1211
- # @yieldparam result []
1212
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1213
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1214
- # @example
1215
- # require "google/cloud/logging/v2"
1216
- #
1217
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1218
- #
1219
- # # TODO: Initialize `name`:
1220
- # name = ''
1221
- # config_client.delete_exclusion(name)
1222
-
1223
- def delete_exclusion \
1224
- name,
1225
- options: nil,
1226
- &block
1227
- req = {
1228
- name: name
1229
- }.delete_if { |_, v| v.nil? }
1230
- req = Google::Gax::to_proto(req, Google::Logging::V2::DeleteExclusionRequest)
1231
- @delete_exclusion.call(req, options, &block)
1232
- nil
1233
- end
1234
-
1235
- # Gets the Logs Router CMEK settings for the given resource.
1236
- #
1237
- # Note: CMEK for the Logs Router can currently only be configured for GCP
1238
- # organizations. Once configured, it applies to all projects and folders in
1239
- # the GCP organization.
1240
- #
1241
- # See [Enabling CMEK for Logs
1242
- # Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
1243
- #
1244
- # @param name [String]
1245
- # Required. The resource for which to retrieve CMEK settings.
1246
- #
1247
- # "projects/[PROJECT_ID]/cmekSettings"
1248
- # "organizations/[ORGANIZATION_ID]/cmekSettings"
1249
- # "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
1250
- # "folders/[FOLDER_ID]/cmekSettings"
1251
- #
1252
- # Example: `"organizations/12345/cmekSettings"`.
1253
- #
1254
- # Note: CMEK for the Logs Router can currently only be configured for GCP
1255
- # organizations. Once configured, it applies to all projects and folders in
1256
- # the GCP organization.
1257
- # @param options [Google::Gax::CallOptions]
1258
- # Overrides the default settings for this call, e.g, timeout,
1259
- # retries, etc.
1260
- # @yield [result, operation] Access the result along with the RPC operation
1261
- # @yieldparam result [Google::Logging::V2::CmekSettings]
1262
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1263
- # @return [Google::Logging::V2::CmekSettings]
1264
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1265
- # @example
1266
- # require "google/cloud/logging/v2"
1267
- #
1268
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1269
- #
1270
- # # TODO: Initialize `name`:
1271
- # name = ''
1272
- # response = config_client.get_cmek_settings(name)
1273
-
1274
- def get_cmek_settings \
1275
- name,
1276
- options: nil,
1277
- &block
1278
- req = {
1279
- name: name
1280
- }.delete_if { |_, v| v.nil? }
1281
- req = Google::Gax::to_proto(req, Google::Logging::V2::GetCmekSettingsRequest)
1282
- @get_cmek_settings.call(req, options, &block)
1283
- end
1284
-
1285
- # Updates the Logs Router CMEK settings for the given resource.
1286
- #
1287
- # Note: CMEK for the Logs Router can currently only be configured for GCP
1288
- # organizations. Once configured, it applies to all projects and folders in
1289
- # the GCP organization.
1290
- #
1291
- # {Google::Cloud::Logging::V2::ConfigServiceV2Client#update_cmek_settings}
1292
- # will fail if 1) `kms_key_name` is invalid, or 2) the associated service
1293
- # account does not have the required
1294
- # `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or
1295
- # 3) access to the key is disabled.
1296
- #
1297
- # See [Enabling CMEK for Logs
1298
- # Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
1299
- #
1300
- # @param name [String]
1301
- # Required. The resource name for the CMEK settings to update.
1302
- #
1303
- # "projects/[PROJECT_ID]/cmekSettings"
1304
- # "organizations/[ORGANIZATION_ID]/cmekSettings"
1305
- # "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
1306
- # "folders/[FOLDER_ID]/cmekSettings"
1307
- #
1308
- # Example: `"organizations/12345/cmekSettings"`.
1309
- #
1310
- # Note: CMEK for the Logs Router can currently only be configured for GCP
1311
- # organizations. Once configured, it applies to all projects and folders in
1312
- # the GCP organization.
1313
- # @param cmek_settings [Google::Logging::V2::CmekSettings | Hash]
1314
- # Required. The CMEK settings to update.
1315
- #
1316
- # See [Enabling CMEK for Logs
1317
- # Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.
1318
- # A hash of the same form as `Google::Logging::V2::CmekSettings`
1319
- # can also be provided.
1320
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1321
- # Optional. Field mask identifying which fields from `cmek_settings` should
1322
- # be updated. A field will be overwritten if and only if it is in the update
1323
- # mask. Output only fields cannot be updated.
1324
- #
1325
- # See {Google::Protobuf::FieldMask FieldMask} for more information.
1326
- #
1327
- # Example: `"updateMask=kmsKeyName"`
1328
- # A hash of the same form as `Google::Protobuf::FieldMask`
1329
- # can also be provided.
1330
- # @param options [Google::Gax::CallOptions]
1331
- # Overrides the default settings for this call, e.g, timeout,
1332
- # retries, etc.
1333
- # @yield [result, operation] Access the result along with the RPC operation
1334
- # @yieldparam result [Google::Logging::V2::CmekSettings]
1335
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1336
- # @return [Google::Logging::V2::CmekSettings]
1337
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1338
- # @example
1339
- # require "google/cloud/logging/v2"
1340
- #
1341
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1342
- #
1343
- # # TODO: Initialize `name`:
1344
- # name = ''
1345
- #
1346
- # # TODO: Initialize `cmek_settings`:
1347
- # cmek_settings = {}
1348
- # response = config_client.update_cmek_settings(name, cmek_settings)
1349
-
1350
- def update_cmek_settings \
1351
- name,
1352
- cmek_settings,
1353
- update_mask: nil,
1354
- options: nil,
1355
- &block
1356
- req = {
1357
- name: name,
1358
- cmek_settings: cmek_settings,
1359
- update_mask: update_mask
1360
- }.delete_if { |_, v| v.nil? }
1361
- req = Google::Gax::to_proto(req, Google::Logging::V2::UpdateCmekSettingsRequest)
1362
- @update_cmek_settings.call(req, options, &block)
1363
- end
1364
- end
1365
- end
1366
- end
1367
- end
1368
- end