google-cloud-logging 1.10.9 → 2.0.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 +4 -4
  2. data/AUTHENTICATION.md +2 -1
  3. data/CHANGELOG.md +23 -0
  4. data/lib/google-cloud-logging.rb +14 -15
  5. data/lib/google/cloud/logging.rb +12 -13
  6. data/lib/google/cloud/logging/credentials.rb +2 -2
  7. data/lib/google/cloud/logging/entry.rb +5 -5
  8. data/lib/google/cloud/logging/entry/http_request.rb +3 -3
  9. data/lib/google/cloud/logging/entry/list.rb +1 -1
  10. data/lib/google/cloud/logging/entry/operation.rb +3 -3
  11. data/lib/google/cloud/logging/entry/source_location.rb +3 -3
  12. data/lib/google/cloud/logging/log/list.rb +1 -1
  13. data/lib/google/cloud/logging/metric.rb +2 -2
  14. data/lib/google/cloud/logging/metric/list.rb +1 -1
  15. data/lib/google/cloud/logging/resource_descriptor/list.rb +1 -1
  16. data/lib/google/cloud/logging/service.rb +70 -173
  17. data/lib/google/cloud/logging/sink.rb +2 -2
  18. data/lib/google/cloud/logging/sink/list.rb +1 -1
  19. data/lib/google/cloud/logging/version.rb +1 -1
  20. metadata +10 -80
  21. data/lib/google/cloud/logging/v2.rb +0 -18
  22. data/lib/google/cloud/logging/v2/config_service_v2_client.rb +0 -1368
  23. data/lib/google/cloud/logging/v2/config_service_v2_client_config.json +0 -106
  24. data/lib/google/cloud/logging/v2/credentials.rb +0 -39
  25. data/lib/google/cloud/logging/v2/doc/google/api/distribution.rb +0 -164
  26. data/lib/google/cloud/logging/v2/doc/google/api/label.rb +0 -42
  27. data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +0 -275
  28. data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +0 -118
  29. data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +0 -86
  30. data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +0 -179
  31. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +0 -238
  32. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +0 -660
  33. data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +0 -220
  34. data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +0 -131
  35. data/lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb +0 -91
  36. data/lib/google/cloud/logging/v2/doc/google/protobuf/empty.rb +0 -29
  37. data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +0 -222
  38. data/lib/google/cloud/logging/v2/doc/google/protobuf/struct.rb +0 -74
  39. data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +0 -113
  40. data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +0 -680
  41. data/lib/google/cloud/logging/v2/logging_service_v2_client_config.json +0 -61
  42. data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +0 -475
  43. data/lib/google/cloud/logging/v2/metrics_service_v2_client_config.json +0 -56
  44. data/lib/google/logging/v2/log_entry_pb.rb +0 -59
  45. data/lib/google/logging/v2/logging_config_pb.rb +0 -173
  46. data/lib/google/logging/v2/logging_config_services_pb.rb +0 -112
  47. data/lib/google/logging/v2/logging_metrics_pb.rb +0 -72
  48. data/lib/google/logging/v2/logging_metrics_services_pb.rb +0 -52
  49. data/lib/google/logging/v2/logging_pb.rb +0 -80
  50. 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.9".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.9
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-06-17 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
@@ -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
- @delete_sink = Google::Gax.create_api_call(
392
- @config_service_v2_stub.method(:delete_sink),
393
- defaults["delete_sink"],
394
- exception_transformer: exception_transformer,
395
- params_extractor: proc do |request|
396
- {'sink_name' => request.sink_name}
397
- end
398
- )
399
- @update_sink = Google::Gax.create_api_call(
400
- @config_service_v2_stub.method(:update_sink),
401
- defaults["update_sink"],
402
- exception_transformer: exception_transformer,
403
- params_extractor: proc do |request|
404
- {'sink_name' => request.sink_name}
405
- end
406
- )
407
- @delete_exclusion = Google::Gax.create_api_call(
408
- @config_service_v2_stub.method(:delete_exclusion),
409
- defaults["delete_exclusion"],
410
- exception_transformer: exception_transformer,
411
- params_extractor: proc do |request|
412
- {'name' => request.name}
413
- end
414
- )
415
- @list_buckets = Google::Gax.create_api_call(
416
- @config_service_v2_stub.method(:list_buckets),
417
- defaults["list_buckets"],
418
- exception_transformer: exception_transformer,
419
- params_extractor: proc do |request|
420
- {'parent' => request.parent}
421
- end
422
- )
423
- @get_bucket = Google::Gax.create_api_call(
424
- @config_service_v2_stub.method(:get_bucket),
425
- defaults["get_bucket"],
426
- exception_transformer: exception_transformer,
427
- params_extractor: proc do |request|
428
- {'name' => request.name}
429
- end
430
- )
431
- @update_bucket = Google::Gax.create_api_call(
432
- @config_service_v2_stub.method(:update_bucket),
433
- defaults["update_bucket"],
434
- exception_transformer: exception_transformer,
435
- params_extractor: proc do |request|
436
- {'name' => request.name}
437
- end
438
- )
439
- @list_sinks = Google::Gax.create_api_call(
440
- @config_service_v2_stub.method(:list_sinks),
441
- defaults["list_sinks"],
442
- exception_transformer: exception_transformer,
443
- params_extractor: proc do |request|
444
- {'parent' => request.parent}
445
- end
446
- )
447
- @get_sink = Google::Gax.create_api_call(
448
- @config_service_v2_stub.method(:get_sink),
449
- defaults["get_sink"],
450
- exception_transformer: exception_transformer,
451
- params_extractor: proc do |request|
452
- {'sink_name' => request.sink_name}
453
- end
454
- )
455
- @create_sink = Google::Gax.create_api_call(
456
- @config_service_v2_stub.method(:create_sink),
457
- defaults["create_sink"],
458
- exception_transformer: exception_transformer,
459
- params_extractor: proc do |request|
460
- {'parent' => request.parent}
461
- end
462
- )
463
- @list_exclusions = Google::Gax.create_api_call(
464
- @config_service_v2_stub.method(:list_exclusions),
465
- defaults["list_exclusions"],
466
- exception_transformer: exception_transformer,
467
- params_extractor: proc do |request|
468
- {'parent' => request.parent}
469
- end
470
- )
471
- @get_exclusion = Google::Gax.create_api_call(
472
- @config_service_v2_stub.method(:get_exclusion),
473
- defaults["get_exclusion"],
474
- exception_transformer: exception_transformer,
475
- params_extractor: proc do |request|
476
- {'name' => request.name}
477
- end
478
- )
479
- @create_exclusion = Google::Gax.create_api_call(
480
- @config_service_v2_stub.method(:create_exclusion),
481
- defaults["create_exclusion"],
482
- exception_transformer: exception_transformer,
483
- params_extractor: proc do |request|
484
- {'parent' => request.parent}
485
- end
486
- )
487
- @update_exclusion = Google::Gax.create_api_call(
488
- @config_service_v2_stub.method(:update_exclusion),
489
- defaults["update_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
- # Deletes a sink. If the sink has a unique `writer_identity`, then that
516
- # service account is also deleted.
517
- #
518
- # @param sink_name [String]
519
- # Required. The full resource name of the sink to delete, including the parent
520
- # resource and the sink identifier:
521
- #
522
- # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
523
- # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
524
- # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
525
- # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
526
- #
527
- # Example: `"projects/my-project-id/sinks/my-sink-id"`.
528
- # @param options [Google::Gax::CallOptions]
529
- # Overrides the default settings for this call, e.g, timeout,
530
- # retries, etc.
531
- # @yield [result, operation] Access the result along with the RPC operation
532
- # @yieldparam result []
533
- # @yieldparam operation [GRPC::ActiveCall::Operation]
534
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
535
- # @example
536
- # require "google/cloud/logging/v2"
537
- #
538
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
539
- #
540
- # # TODO: Initialize `sink_name`:
541
- # sink_name = ''
542
- # config_client.delete_sink(sink_name)
543
-
544
- def delete_sink \
545
- sink_name,
546
- options: nil,
547
- &block
548
- req = {
549
- sink_name: sink_name
550
- }.delete_if { |_, v| v.nil? }
551
- req = Google::Gax::to_proto(req, Google::Logging::V2::DeleteSinkRequest)
552
- @delete_sink.call(req, options, &block)
553
- nil
554
- end
555
-
556
- # Updates a sink. This method replaces the following fields in the existing
557
- # sink with values from the new sink: `destination`, and `filter`.
558
- #
559
- # The updated sink might also have a new `writer_identity`; see the
560
- # `unique_writer_identity` field.
561
- #
562
- # @param sink_name [String]
563
- # Required. The full resource name of the sink to update, including the parent
564
- # resource and the sink identifier:
565
- #
566
- # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
567
- # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
568
- # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
569
- # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
570
- #
571
- # Example: `"projects/my-project-id/sinks/my-sink-id"`.
572
- # @param sink [Google::Logging::V2::LogSink | Hash]
573
- # Required. The updated sink, whose name is the same identifier that appears as part
574
- # of `sink_name`.
575
- # A hash of the same form as `Google::Logging::V2::LogSink`
576
- # can also be provided.
577
- # @param unique_writer_identity [true, false]
578
- # Optional. See {Google::Logging::V2::ConfigServiceV2#create_sink}
579
- # for a description of this field. When updating a sink, the effect of this
580
- # field on the value of `writer_identity` in the updated sink depends on both
581
- # the old and new values of this field:
582
- #
583
- # * If the old and new values of this field are both false or both true,
584
- # then there is no change to the sink's `writer_identity`.
585
- # * If the old value is false and the new value is true, then
586
- # `writer_identity` is changed to a unique service account.
587
- # * It is an error if the old value is true and the new value is
588
- # set to false or defaulted to false.
589
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
590
- # Optional. Field mask that specifies the fields in `sink` that need
591
- # an update. A sink field will be overwritten if, and only if, it is
592
- # in the update mask. `name` and output only fields cannot be updated.
593
- #
594
- # An empty updateMask is temporarily treated as using the following mask
595
- # for backwards compatibility purposes:
596
- # destination,filter,includeChildren
597
- # At some point in the future, behavior will be removed and specifying an
598
- # empty updateMask will be an error.
599
- #
600
- # For a detailed `FieldMask` definition, see
601
- # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
602
- #
603
- # Example: `updateMask=filter`.
604
- # A hash of the same form as `Google::Protobuf::FieldMask`
605
- # can also be provided.
606
- # @param options [Google::Gax::CallOptions]
607
- # Overrides the default settings for this call, e.g, timeout,
608
- # retries, etc.
609
- # @yield [result, operation] Access the result along with the RPC operation
610
- # @yieldparam result [Google::Logging::V2::LogSink]
611
- # @yieldparam operation [GRPC::ActiveCall::Operation]
612
- # @return [Google::Logging::V2::LogSink]
613
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
614
- # @example
615
- # require "google/cloud/logging/v2"
616
- #
617
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
618
- #
619
- # # TODO: Initialize `sink_name`:
620
- # sink_name = ''
621
- #
622
- # # TODO: Initialize `sink`:
623
- # sink = {}
624
- # response = config_client.update_sink(sink_name, sink)
625
-
626
- def update_sink \
627
- sink_name,
628
- sink,
629
- unique_writer_identity: nil,
630
- update_mask: nil,
631
- options: nil,
632
- &block
633
- req = {
634
- sink_name: sink_name,
635
- sink: sink,
636
- unique_writer_identity: unique_writer_identity,
637
- update_mask: update_mask
638
- }.delete_if { |_, v| v.nil? }
639
- req = Google::Gax::to_proto(req, Google::Logging::V2::UpdateSinkRequest)
640
- @update_sink.call(req, options, &block)
641
- end
642
-
643
- # Deletes an exclusion.
644
- #
645
- # @param name [String]
646
- # Required. The resource name of an existing exclusion to delete:
647
- #
648
- # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
649
- # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
650
- # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
651
- # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
652
- #
653
- # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
654
- # @param options [Google::Gax::CallOptions]
655
- # Overrides the default settings for this call, e.g, timeout,
656
- # retries, etc.
657
- # @yield [result, operation] Access the result along with the RPC operation
658
- # @yieldparam result []
659
- # @yieldparam operation [GRPC::ActiveCall::Operation]
660
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
661
- # @example
662
- # require "google/cloud/logging/v2"
663
- #
664
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
665
- #
666
- # # TODO: Initialize `name`:
667
- # name = ''
668
- # config_client.delete_exclusion(name)
669
-
670
- def delete_exclusion \
671
- name,
672
- options: nil,
673
- &block
674
- req = {
675
- name: name
676
- }.delete_if { |_, v| v.nil? }
677
- req = Google::Gax::to_proto(req, Google::Logging::V2::DeleteExclusionRequest)
678
- @delete_exclusion.call(req, options, &block)
679
- nil
680
- end
681
-
682
- # Lists buckets (Beta).
683
- #
684
- # @param parent [String]
685
- # Required. The parent resource whose buckets are to be listed:
686
- #
687
- # "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
688
- # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
689
- # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
690
- # "folders/[FOLDER_ID]/locations/[LOCATION_ID]"
691
- #
692
- # Note: The locations portion of the resource must be specified, but
693
- # supplying the character `-` in place of [LOCATION_ID] will return all
694
- # buckets.
695
- # @param page_size [Integer]
696
- # The maximum number of resources contained in the underlying API
697
- # response. If page streaming is performed per-resource, this
698
- # parameter does not affect the return value. If page streaming is
699
- # performed per-page, this determines the maximum number of
700
- # resources in a page.
701
- # @param options [Google::Gax::CallOptions]
702
- # Overrides the default settings for this call, e.g, timeout,
703
- # retries, etc.
704
- # @yield [result, operation] Access the result along with the RPC operation
705
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Logging::V2::LogBucket>]
706
- # @yieldparam operation [GRPC::ActiveCall::Operation]
707
- # @return [Google::Gax::PagedEnumerable<Google::Logging::V2::LogBucket>]
708
- # An enumerable of Google::Logging::V2::LogBucket instances.
709
- # See Google::Gax::PagedEnumerable documentation for other
710
- # operations such as per-page iteration or access to the response
711
- # object.
712
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
713
- # @example
714
- # require "google/cloud/logging/v2"
715
- #
716
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
717
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.location_path("[PROJECT]", "[LOCATION]")
718
- #
719
- # # Iterate over all results.
720
- # config_client.list_buckets(formatted_parent).each do |element|
721
- # # Process element.
722
- # end
723
- #
724
- # # Or iterate over results one page at a time.
725
- # config_client.list_buckets(formatted_parent).each_page do |page|
726
- # # Process each page at a time.
727
- # page.each do |element|
728
- # # Process element.
729
- # end
730
- # end
731
-
732
- def list_buckets \
733
- parent,
734
- page_size: nil,
735
- options: nil,
736
- &block
737
- req = {
738
- parent: parent,
739
- page_size: page_size
740
- }.delete_if { |_, v| v.nil? }
741
- req = Google::Gax::to_proto(req, Google::Logging::V2::ListBucketsRequest)
742
- @list_buckets.call(req, options, &block)
743
- end
744
-
745
- # Gets a bucket (Beta).
746
- #
747
- # @param name [String]
748
- # Required. The resource name of the bucket:
749
- #
750
- # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
751
- # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
752
- # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
753
- # "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
754
- #
755
- # Example:
756
- # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id"`.
757
- # @param options [Google::Gax::CallOptions]
758
- # Overrides the default settings for this call, e.g, timeout,
759
- # retries, etc.
760
- # @yield [result, operation] Access the result along with the RPC operation
761
- # @yieldparam result [Google::Logging::V2::LogBucket]
762
- # @yieldparam operation [GRPC::ActiveCall::Operation]
763
- # @return [Google::Logging::V2::LogBucket]
764
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
765
- # @example
766
- # require "google/cloud/logging/v2"
767
- #
768
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
769
- #
770
- # # TODO: Initialize `name`:
771
- # name = ''
772
- # response = config_client.get_bucket(name)
773
-
774
- def get_bucket \
775
- name,
776
- options: nil,
777
- &block
778
- req = {
779
- name: name
780
- }.delete_if { |_, v| v.nil? }
781
- req = Google::Gax::to_proto(req, Google::Logging::V2::GetBucketRequest)
782
- @get_bucket.call(req, options, &block)
783
- end
784
-
785
- # Updates a bucket. This method replaces the following fields in the
786
- # existing bucket with values from the new bucket: `retention_period`
787
- #
788
- # If the retention period is decreased and the bucket is locked,
789
- # FAILED_PRECONDITION will be returned.
790
- #
791
- # If the bucket has a LifecycleState of DELETE_REQUESTED, FAILED_PRECONDITION
792
- # will be returned.
793
- #
794
- # A buckets region may not be modified after it is created.
795
- # This method is in Beta.
796
- #
797
- # @param name [String]
798
- # Required. The full resource name of the bucket to update.
799
- #
800
- # "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
801
- # "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
802
- # "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
803
- # "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
804
- #
805
- # Example:
806
- # `"projects/my-project-id/locations/my-location/buckets/my-bucket-id"`. Also
807
- # requires permission "resourcemanager.projects.updateLiens" to set the
808
- # locked property
809
- # @param bucket [Google::Logging::V2::LogBucket | Hash]
810
- # Required. The updated bucket.
811
- # A hash of the same form as `Google::Logging::V2::LogBucket`
812
- # can also be provided.
813
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
814
- # Required. Field mask that specifies the fields in `bucket` that need an update. A
815
- # bucket field will be overwritten if, and only if, it is in the update
816
- # mask. `name` and output only fields cannot be updated.
817
- #
818
- # For a detailed `FieldMask` definition, see
819
- # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
820
- #
821
- # Example: `updateMask=retention_days`.
822
- # A hash of the same form as `Google::Protobuf::FieldMask`
823
- # can also be provided.
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::LogBucket]
829
- # @yieldparam operation [GRPC::ActiveCall::Operation]
830
- # @return [Google::Logging::V2::LogBucket]
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
- #
837
- # # TODO: Initialize `name`:
838
- # name = ''
839
- #
840
- # # TODO: Initialize `bucket`:
841
- # bucket = {}
842
- #
843
- # # TODO: Initialize `update_mask`:
844
- # update_mask = {}
845
- # response = config_client.update_bucket(name, bucket, update_mask)
846
-
847
- def update_bucket \
848
- name,
849
- bucket,
850
- update_mask,
851
- options: nil,
852
- &block
853
- req = {
854
- name: name,
855
- bucket: bucket,
856
- update_mask: update_mask
857
- }.delete_if { |_, v| v.nil? }
858
- req = Google::Gax::to_proto(req, Google::Logging::V2::UpdateBucketRequest)
859
- @update_bucket.call(req, options, &block)
860
- end
861
-
862
- # Lists sinks.
863
- #
864
- # @param parent [String]
865
- # Required. The parent resource whose sinks are to be listed:
866
- #
867
- # "projects/[PROJECT_ID]"
868
- # "organizations/[ORGANIZATION_ID]"
869
- # "billingAccounts/[BILLING_ACCOUNT_ID]"
870
- # "folders/[FOLDER_ID]"
871
- # @param page_size [Integer]
872
- # The maximum number of resources contained in the underlying API
873
- # response. If page streaming is performed per-resource, this
874
- # parameter does not affect the return value. If page streaming is
875
- # performed per-page, this determines the maximum number of
876
- # resources in a page.
877
- # @param options [Google::Gax::CallOptions]
878
- # Overrides the default settings for this call, e.g, timeout,
879
- # retries, etc.
880
- # @yield [result, operation] Access the result along with the RPC operation
881
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Logging::V2::LogSink>]
882
- # @yieldparam operation [GRPC::ActiveCall::Operation]
883
- # @return [Google::Gax::PagedEnumerable<Google::Logging::V2::LogSink>]
884
- # An enumerable of Google::Logging::V2::LogSink instances.
885
- # See Google::Gax::PagedEnumerable documentation for other
886
- # operations such as per-page iteration or access to the response
887
- # object.
888
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
889
- # @example
890
- # require "google/cloud/logging/v2"
891
- #
892
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
893
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
894
- #
895
- # # Iterate over all results.
896
- # config_client.list_sinks(formatted_parent).each do |element|
897
- # # Process element.
898
- # end
899
- #
900
- # # Or iterate over results one page at a time.
901
- # config_client.list_sinks(formatted_parent).each_page do |page|
902
- # # Process each page at a time.
903
- # page.each do |element|
904
- # # Process element.
905
- # end
906
- # end
907
-
908
- def list_sinks \
909
- parent,
910
- page_size: nil,
911
- options: nil,
912
- &block
913
- req = {
914
- parent: parent,
915
- page_size: page_size
916
- }.delete_if { |_, v| v.nil? }
917
- req = Google::Gax::to_proto(req, Google::Logging::V2::ListSinksRequest)
918
- @list_sinks.call(req, options, &block)
919
- end
920
-
921
- # Gets a sink.
922
- #
923
- # @param sink_name [String]
924
- # Required. The resource name of the sink:
925
- #
926
- # "projects/[PROJECT_ID]/sinks/[SINK_ID]"
927
- # "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
928
- # "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
929
- # "folders/[FOLDER_ID]/sinks/[SINK_ID]"
930
- #
931
- # Example: `"projects/my-project-id/sinks/my-sink-id"`.
932
- # @param options [Google::Gax::CallOptions]
933
- # Overrides the default settings for this call, e.g, timeout,
934
- # retries, etc.
935
- # @yield [result, operation] Access the result along with the RPC operation
936
- # @yieldparam result [Google::Logging::V2::LogSink]
937
- # @yieldparam operation [GRPC::ActiveCall::Operation]
938
- # @return [Google::Logging::V2::LogSink]
939
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
940
- # @example
941
- # require "google/cloud/logging/v2"
942
- #
943
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
944
- #
945
- # # TODO: Initialize `sink_name`:
946
- # sink_name = ''
947
- # response = config_client.get_sink(sink_name)
948
-
949
- def get_sink \
950
- sink_name,
951
- options: nil,
952
- &block
953
- req = {
954
- sink_name: sink_name
955
- }.delete_if { |_, v| v.nil? }
956
- req = Google::Gax::to_proto(req, Google::Logging::V2::GetSinkRequest)
957
- @get_sink.call(req, options, &block)
958
- end
959
-
960
- # Creates a sink that exports specified log entries to a destination. The
961
- # export of newly-ingested log entries begins immediately, unless the sink's
962
- # `writer_identity` is not permitted to write to the destination. A sink can
963
- # export log entries only from the resource owning the sink.
964
- #
965
- # @param parent [String]
966
- # Required. The resource in which to create the sink:
967
- #
968
- # "projects/[PROJECT_ID]"
969
- # "organizations/[ORGANIZATION_ID]"
970
- # "billingAccounts/[BILLING_ACCOUNT_ID]"
971
- # "folders/[FOLDER_ID]"
972
- #
973
- # Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
974
- # @param sink [Google::Logging::V2::LogSink | Hash]
975
- # Required. The new sink, whose `name` parameter is a sink identifier that
976
- # is not already in use.
977
- # A hash of the same form as `Google::Logging::V2::LogSink`
978
- # can also be provided.
979
- # @param unique_writer_identity [true, false]
980
- # Optional. Determines the kind of IAM identity returned as `writer_identity`
981
- # in the new sink. If this value is omitted or set to false, and if the
982
- # sink's parent is a project, then the value returned as `writer_identity` is
983
- # the same group or service account used by Logging before the addition of
984
- # writer identities to this API. The sink's destination must be in the same
985
- # project as the sink itself.
986
- #
987
- # If this field is set to true, or if the sink is owned by a non-project
988
- # resource such as an organization, then the value of `writer_identity` will
989
- # be a unique service account used only for exports from the new sink. For
990
- # more information, see `writer_identity` in {Google::Logging::V2::LogSink LogSink}.
991
- # @param options [Google::Gax::CallOptions]
992
- # Overrides the default settings for this call, e.g, timeout,
993
- # retries, etc.
994
- # @yield [result, operation] Access the result along with the RPC operation
995
- # @yieldparam result [Google::Logging::V2::LogSink]
996
- # @yieldparam operation [GRPC::ActiveCall::Operation]
997
- # @return [Google::Logging::V2::LogSink]
998
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
999
- # @example
1000
- # require "google/cloud/logging/v2"
1001
- #
1002
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1003
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
1004
- #
1005
- # # TODO: Initialize `sink`:
1006
- # sink = {}
1007
- # response = config_client.create_sink(formatted_parent, sink)
1008
-
1009
- def create_sink \
1010
- parent,
1011
- sink,
1012
- unique_writer_identity: nil,
1013
- options: nil,
1014
- &block
1015
- req = {
1016
- parent: parent,
1017
- sink: sink,
1018
- unique_writer_identity: unique_writer_identity
1019
- }.delete_if { |_, v| v.nil? }
1020
- req = Google::Gax::to_proto(req, Google::Logging::V2::CreateSinkRequest)
1021
- @create_sink.call(req, options, &block)
1022
- end
1023
-
1024
- # Lists all the exclusions in a parent resource.
1025
- #
1026
- # @param parent [String]
1027
- # Required. The parent resource whose exclusions are to be listed.
1028
- #
1029
- # "projects/[PROJECT_ID]"
1030
- # "organizations/[ORGANIZATION_ID]"
1031
- # "billingAccounts/[BILLING_ACCOUNT_ID]"
1032
- # "folders/[FOLDER_ID]"
1033
- # @param page_size [Integer]
1034
- # The maximum number of resources contained in the underlying API
1035
- # response. If page streaming is performed per-resource, this
1036
- # parameter does not affect the return value. If page streaming is
1037
- # performed per-page, this determines the maximum number of
1038
- # resources in a page.
1039
- # @param options [Google::Gax::CallOptions]
1040
- # Overrides the default settings for this call, e.g, timeout,
1041
- # retries, etc.
1042
- # @yield [result, operation] Access the result along with the RPC operation
1043
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Logging::V2::LogExclusion>]
1044
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1045
- # @return [Google::Gax::PagedEnumerable<Google::Logging::V2::LogExclusion>]
1046
- # An enumerable of Google::Logging::V2::LogExclusion instances.
1047
- # See Google::Gax::PagedEnumerable documentation for other
1048
- # operations such as per-page iteration or access to the response
1049
- # object.
1050
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1051
- # @example
1052
- # require "google/cloud/logging/v2"
1053
- #
1054
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1055
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
1056
- #
1057
- # # Iterate over all results.
1058
- # config_client.list_exclusions(formatted_parent).each do |element|
1059
- # # Process element.
1060
- # end
1061
- #
1062
- # # Or iterate over results one page at a time.
1063
- # config_client.list_exclusions(formatted_parent).each_page do |page|
1064
- # # Process each page at a time.
1065
- # page.each do |element|
1066
- # # Process element.
1067
- # end
1068
- # end
1069
-
1070
- def list_exclusions \
1071
- parent,
1072
- page_size: nil,
1073
- options: nil,
1074
- &block
1075
- req = {
1076
- parent: parent,
1077
- page_size: page_size
1078
- }.delete_if { |_, v| v.nil? }
1079
- req = Google::Gax::to_proto(req, Google::Logging::V2::ListExclusionsRequest)
1080
- @list_exclusions.call(req, options, &block)
1081
- end
1082
-
1083
- # Gets the description of an exclusion.
1084
- #
1085
- # @param name [String]
1086
- # Required. The resource name of an existing exclusion:
1087
- #
1088
- # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
1089
- # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
1090
- # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
1091
- # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
1092
- #
1093
- # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
1094
- # @param options [Google::Gax::CallOptions]
1095
- # Overrides the default settings for this call, e.g, timeout,
1096
- # retries, etc.
1097
- # @yield [result, operation] Access the result along with the RPC operation
1098
- # @yieldparam result [Google::Logging::V2::LogExclusion]
1099
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1100
- # @return [Google::Logging::V2::LogExclusion]
1101
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1102
- # @example
1103
- # require "google/cloud/logging/v2"
1104
- #
1105
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1106
- #
1107
- # # TODO: Initialize `name`:
1108
- # name = ''
1109
- # response = config_client.get_exclusion(name)
1110
-
1111
- def get_exclusion \
1112
- name,
1113
- options: nil,
1114
- &block
1115
- req = {
1116
- name: name
1117
- }.delete_if { |_, v| v.nil? }
1118
- req = Google::Gax::to_proto(req, Google::Logging::V2::GetExclusionRequest)
1119
- @get_exclusion.call(req, options, &block)
1120
- end
1121
-
1122
- # Creates a new exclusion in a specified parent resource.
1123
- # Only log entries belonging to that resource can be excluded.
1124
- # You can have up to 10 exclusions in a resource.
1125
- #
1126
- # @param parent [String]
1127
- # Required. The parent resource in which to create the exclusion:
1128
- #
1129
- # "projects/[PROJECT_ID]"
1130
- # "organizations/[ORGANIZATION_ID]"
1131
- # "billingAccounts/[BILLING_ACCOUNT_ID]"
1132
- # "folders/[FOLDER_ID]"
1133
- #
1134
- # Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
1135
- # @param exclusion [Google::Logging::V2::LogExclusion | Hash]
1136
- # Required. The new exclusion, whose `name` parameter is an exclusion name
1137
- # that is not already used in the parent resource.
1138
- # A hash of the same form as `Google::Logging::V2::LogExclusion`
1139
- # can also be provided.
1140
- # @param options [Google::Gax::CallOptions]
1141
- # Overrides the default settings for this call, e.g, timeout,
1142
- # retries, etc.
1143
- # @yield [result, operation] Access the result along with the RPC operation
1144
- # @yieldparam result [Google::Logging::V2::LogExclusion]
1145
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1146
- # @return [Google::Logging::V2::LogExclusion]
1147
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1148
- # @example
1149
- # require "google/cloud/logging/v2"
1150
- #
1151
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1152
- # formatted_parent = Google::Cloud::Logging::V2::ConfigServiceV2Client.project_path("[PROJECT]")
1153
- #
1154
- # # TODO: Initialize `exclusion`:
1155
- # exclusion = {}
1156
- # response = config_client.create_exclusion(formatted_parent, exclusion)
1157
-
1158
- def create_exclusion \
1159
- parent,
1160
- exclusion,
1161
- options: nil,
1162
- &block
1163
- req = {
1164
- parent: parent,
1165
- exclusion: exclusion
1166
- }.delete_if { |_, v| v.nil? }
1167
- req = Google::Gax::to_proto(req, Google::Logging::V2::CreateExclusionRequest)
1168
- @create_exclusion.call(req, options, &block)
1169
- end
1170
-
1171
- # Changes one or more properties of an existing exclusion.
1172
- #
1173
- # @param name [String]
1174
- # Required. The resource name of the exclusion to update:
1175
- #
1176
- # "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
1177
- # "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
1178
- # "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
1179
- # "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
1180
- #
1181
- # Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
1182
- # @param exclusion [Google::Logging::V2::LogExclusion | Hash]
1183
- # Required. New values for the existing exclusion. Only the fields specified in
1184
- # `update_mask` are relevant.
1185
- # A hash of the same form as `Google::Logging::V2::LogExclusion`
1186
- # can also be provided.
1187
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1188
- # Required. A non-empty list of fields to change in the existing exclusion. New values
1189
- # for the fields are taken from the corresponding fields in the
1190
- # {Google::Logging::V2::LogExclusion LogExclusion} included in this request. Fields not mentioned in
1191
- # `update_mask` are not changed and are ignored in the request.
1192
- #
1193
- # For example, to change the filter and description of an exclusion,
1194
- # specify an `update_mask` of `"filter,description"`.
1195
- # A hash of the same form as `Google::Protobuf::FieldMask`
1196
- # can also be provided.
1197
- # @param options [Google::Gax::CallOptions]
1198
- # Overrides the default settings for this call, e.g, timeout,
1199
- # retries, etc.
1200
- # @yield [result, operation] Access the result along with the RPC operation
1201
- # @yieldparam result [Google::Logging::V2::LogExclusion]
1202
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1203
- # @return [Google::Logging::V2::LogExclusion]
1204
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1205
- # @example
1206
- # require "google/cloud/logging/v2"
1207
- #
1208
- # config_client = Google::Cloud::Logging::V2::ConfigServiceV2Client.new
1209
- #
1210
- # # TODO: Initialize `name`:
1211
- # name = ''
1212
- #
1213
- # # TODO: Initialize `exclusion`:
1214
- # exclusion = {}
1215
- #
1216
- # # TODO: Initialize `update_mask`:
1217
- # update_mask = {}
1218
- # response = config_client.update_exclusion(name, exclusion, update_mask)
1219
-
1220
- def update_exclusion \
1221
- name,
1222
- exclusion,
1223
- update_mask,
1224
- options: nil,
1225
- &block
1226
- req = {
1227
- name: name,
1228
- exclusion: exclusion,
1229
- update_mask: update_mask
1230
- }.delete_if { |_, v| v.nil? }
1231
- req = Google::Gax::to_proto(req, Google::Logging::V2::UpdateExclusionRequest)
1232
- @update_exclusion.call(req, options, &block)
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