google-cloud-logging 1.9.5 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,8 +44,8 @@ module Google
44
44
  # The maximum length of the description is 8000 characters.
45
45
  # @!attribute [rw] filter
46
46
  # @return [String]
47
- # Required. An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters)
48
- # which is used to match log entries.
47
+ # Required. An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters) which is
48
+ # used to match log entries.
49
49
  # Example:
50
50
  #
51
51
  # "resource.type=gae_app AND severity>=ERROR"
@@ -69,18 +69,6 @@ module Google
69
69
 
70
70
  private_constant :PAGE_DESCRIPTORS
71
71
 
72
- BUNDLE_DESCRIPTORS = {
73
- "write_log_entries" => Google::Gax::BundleDescriptor.new(
74
- "entries",
75
- [
76
- "logName",
77
- "resource",
78
- "labels"
79
- ])
80
- }.freeze
81
-
82
- private_constant :BUNDLE_DESCRIPTORS
83
-
84
72
  # The scopes needed to make gRPC calls to all of the methods defined in
85
73
  # this service.
86
74
  ALL_SCOPES = [
@@ -92,17 +80,11 @@ module Google
92
80
  ].freeze
93
81
 
94
82
 
95
- BILLING_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
83
+ BILLING_ACCOUNT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
96
84
  "billingAccounts/{billing_account}"
97
85
  )
98
86
 
99
- private_constant :BILLING_PATH_TEMPLATE
100
-
101
- BILLING_LOG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
102
- "billingAccounts/{billing_account}/logs/{log}"
103
- )
104
-
105
- private_constant :BILLING_LOG_PATH_TEMPLATE
87
+ private_constant :BILLING_ACCOUNT_PATH_TEMPLATE
106
88
 
107
89
  FOLDER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
108
90
  "folders/{folder}"
@@ -110,56 +92,27 @@ module Google
110
92
 
111
93
  private_constant :FOLDER_PATH_TEMPLATE
112
94
 
113
- FOLDER_LOG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
114
- "folders/{folder}/logs/{log}"
115
- )
116
-
117
- private_constant :FOLDER_LOG_PATH_TEMPLATE
118
-
119
- LOG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
120
- "projects/{project}/logs/{log}"
121
- )
122
-
123
- private_constant :LOG_PATH_TEMPLATE
124
-
125
95
  ORGANIZATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
126
96
  "organizations/{organization}"
127
97
  )
128
98
 
129
99
  private_constant :ORGANIZATION_PATH_TEMPLATE
130
100
 
131
- ORGANIZATION_LOG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
132
- "organizations/{organization}/logs/{log}"
133
- )
134
-
135
- private_constant :ORGANIZATION_LOG_PATH_TEMPLATE
136
-
137
101
  PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
138
102
  "projects/{project}"
139
103
  )
140
104
 
141
105
  private_constant :PROJECT_PATH_TEMPLATE
142
106
 
143
- # Returns a fully-qualified billing resource name string.
107
+ # Returns a fully-qualified billing_account resource name string.
144
108
  # @param billing_account [String]
145
109
  # @return [String]
146
- def self.billing_path billing_account
147
- BILLING_PATH_TEMPLATE.render(
110
+ def self.billing_account_path billing_account
111
+ BILLING_ACCOUNT_PATH_TEMPLATE.render(
148
112
  :"billing_account" => billing_account
149
113
  )
150
114
  end
151
115
 
152
- # Returns a fully-qualified billing_log resource name string.
153
- # @param billing_account [String]
154
- # @param log [String]
155
- # @return [String]
156
- def self.billing_log_path billing_account, log
157
- BILLING_LOG_PATH_TEMPLATE.render(
158
- :"billing_account" => billing_account,
159
- :"log" => log
160
- )
161
- end
162
-
163
116
  # Returns a fully-qualified folder resource name string.
164
117
  # @param folder [String]
165
118
  # @return [String]
@@ -169,28 +122,6 @@ module Google
169
122
  )
170
123
  end
171
124
 
172
- # Returns a fully-qualified folder_log resource name string.
173
- # @param folder [String]
174
- # @param log [String]
175
- # @return [String]
176
- def self.folder_log_path folder, log
177
- FOLDER_LOG_PATH_TEMPLATE.render(
178
- :"folder" => folder,
179
- :"log" => log
180
- )
181
- end
182
-
183
- # Returns a fully-qualified log resource name string.
184
- # @param project [String]
185
- # @param log [String]
186
- # @return [String]
187
- def self.log_path project, log
188
- LOG_PATH_TEMPLATE.render(
189
- :"project" => project,
190
- :"log" => log
191
- )
192
- end
193
-
194
125
  # Returns a fully-qualified organization resource name string.
195
126
  # @param organization [String]
196
127
  # @return [String]
@@ -200,17 +131,6 @@ module Google
200
131
  )
201
132
  end
202
133
 
203
- # Returns a fully-qualified organization_log resource name string.
204
- # @param organization [String]
205
- # @param log [String]
206
- # @return [String]
207
- def self.organization_log_path organization, log
208
- ORGANIZATION_LOG_PATH_TEMPLATE.render(
209
- :"organization" => organization,
210
- :"log" => log
211
- )
212
- end
213
-
214
134
  # Returns a fully-qualified project resource name string.
215
135
  # @param project [String]
216
136
  # @return [String]
@@ -297,6 +217,9 @@ module Google
297
217
  google_api_client.freeze
298
218
 
299
219
  headers = { :"x-goog-api-client" => google_api_client }
220
+ if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
221
+ headers[:"x-goog-user-project"] = credentials.quota_project_id
222
+ end
300
223
  headers.merge!(metadata) unless metadata.nil?
301
224
  client_config_file = Pathname.new(__dir__).join(
302
225
  "logging_service_v2_client_config.json"
@@ -308,7 +231,6 @@ module Google
308
231
  client_config,
309
232
  Google::Gax::Grpc::STATUS_CODE_NAMES,
310
233
  timeout,
311
- bundle_descriptors: BUNDLE_DESCRIPTORS,
312
234
  page_descriptors: PAGE_DESCRIPTORS,
313
235
  errors: Google::Gax::Grpc::API_ERRORS,
314
236
  metadata: headers
@@ -394,8 +316,10 @@ module Google
394
316
  # require "google/cloud/logging/v2"
395
317
  #
396
318
  # logging_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
397
- # formatted_log_name = Google::Cloud::Logging::V2::LoggingServiceV2Client.log_path("[PROJECT]", "[LOG]")
398
- # logging_client.delete_log(formatted_log_name)
319
+ #
320
+ # # TODO: Initialize `log_name`:
321
+ # log_name = ''
322
+ # logging_client.delete_log(log_name)
399
323
 
400
324
  def delete_log \
401
325
  log_name,
@@ -457,10 +381,10 @@ module Google
457
381
  # "projects/my-project-id/logs/syslog"
458
382
  # "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"
459
383
  #
460
- # The permission <code>logging.logEntries.create</code> is needed on each
461
- # project, organization, billing account, or folder that is receiving
462
- # new log entries, whether the resource is specified in
463
- # <code>logName</code> or in an individual log entry.
384
+ # The permission `logging.logEntries.create` is needed on each project,
385
+ # organization, billing account, or folder that is receiving new log
386
+ # entries, whether the resource is specified in `logName` or in an
387
+ # individual log entry.
464
388
  # @param resource [Google::Api::MonitoredResource | Hash]
465
389
  # Optional. A default monitored resource object that is assigned to all log
466
390
  # entries in `entries` that do not specify a value for `resource`. Example:
@@ -540,10 +464,6 @@ module Google
540
464
  #
541
465
  #
542
466
  # Projects listed in the `project_ids` field are added to this list.
543
- # @param project_ids [Array<String>]
544
- # Deprecated. Use `resource_names` instead. One or more project identifiers
545
- # or project numbers from which to retrieve log entries. Example:
546
- # `"my-project-1A"`.
547
467
  # @param filter [String]
548
468
  # Optional. A filter that chooses which log entries to return. See [Advanced
549
469
  # Logs Queries](/logging/docs/view/advanced-queries). Only log entries that
@@ -600,7 +520,6 @@ module Google
600
520
 
601
521
  def list_log_entries \
602
522
  resource_names,
603
- project_ids: nil,
604
523
  filter: nil,
605
524
  order_by: nil,
606
525
  page_size: nil,
@@ -608,7 +527,6 @@ module Google
608
527
  &block
609
528
  req = {
610
529
  resource_names: resource_names,
611
- project_ids: project_ids,
612
530
  filter: filter,
613
531
  order_by: order_by,
614
532
  page_size: page_size
@@ -4,7 +4,6 @@
4
4
  "retry_codes": {
5
5
  "idempotent": [
6
6
  "DEADLINE_EXCEEDED",
7
- "INTERNAL",
8
7
  "UNAVAILABLE"
9
8
  ],
10
9
  "non_idempotent": []
@@ -18,36 +17,22 @@
18
17
  "rpc_timeout_multiplier": 1.0,
19
18
  "max_rpc_timeout_millis": 20000,
20
19
  "total_timeout_millis": 600000
21
- },
22
- "list": {
23
- "initial_retry_delay_millis": 100,
24
- "retry_delay_multiplier": 1.3,
25
- "max_retry_delay_millis": 60000,
26
- "initial_rpc_timeout_millis": 20000,
27
- "rpc_timeout_multiplier": 1.0,
28
- "max_rpc_timeout_millis": 20000,
29
- "total_timeout_millis": 600000
30
20
  }
31
21
  },
32
22
  "methods": {
33
23
  "DeleteLog": {
34
24
  "timeout_millis": 60000,
35
- "retry_codes_name": "idempotent",
25
+ "retry_codes_name": "non_idempotent",
36
26
  "retry_params_name": "default"
37
27
  },
38
28
  "WriteLogEntries": {
39
29
  "timeout_millis": 60000,
40
- "retry_codes_name": "idempotent",
41
- "retry_params_name": "default",
42
- "bundling": {
43
- "element_count_threshold": 1000,
44
- "request_byte_threshold": 1048576,
45
- "delay_threshold_millis": 50
46
- }
30
+ "retry_codes_name": "non_idempotent",
31
+ "retry_params_name": "default"
47
32
  },
48
33
  "ListLogEntries": {
49
34
  "timeout_millis": 10000,
50
- "retry_codes_name": "idempotent",
35
+ "retry_codes_name": "non_idempotent",
51
36
  "retry_params_name": "default"
52
37
  },
53
38
  "ListMonitoredResourceDescriptors": {
@@ -72,29 +72,11 @@ module Google
72
72
  ].freeze
73
73
 
74
74
 
75
- BILLING_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
76
- "billingAccounts/{billing_account}"
77
- )
78
-
79
- private_constant :BILLING_PATH_TEMPLATE
80
-
81
- FOLDER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
82
- "folders/{folder}"
83
- )
84
-
85
- private_constant :FOLDER_PATH_TEMPLATE
86
-
87
- METRIC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
75
+ LOG_METRIC_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
88
76
  "projects/{project}/metrics/{metric}"
89
77
  )
90
78
 
91
- private_constant :METRIC_PATH_TEMPLATE
92
-
93
- ORGANIZATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
94
- "organizations/{organization}"
95
- )
96
-
97
- private_constant :ORGANIZATION_PATH_TEMPLATE
79
+ private_constant :LOG_METRIC_PATH_TEMPLATE
98
80
 
99
81
  PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
100
82
  "projects/{project}"
@@ -102,44 +84,17 @@ module Google
102
84
 
103
85
  private_constant :PROJECT_PATH_TEMPLATE
104
86
 
105
- # Returns a fully-qualified billing resource name string.
106
- # @param billing_account [String]
107
- # @return [String]
108
- def self.billing_path billing_account
109
- BILLING_PATH_TEMPLATE.render(
110
- :"billing_account" => billing_account
111
- )
112
- end
113
-
114
- # Returns a fully-qualified folder resource name string.
115
- # @param folder [String]
116
- # @return [String]
117
- def self.folder_path folder
118
- FOLDER_PATH_TEMPLATE.render(
119
- :"folder" => folder
120
- )
121
- end
122
-
123
- # Returns a fully-qualified metric resource name string.
87
+ # Returns a fully-qualified log_metric resource name string.
124
88
  # @param project [String]
125
89
  # @param metric [String]
126
90
  # @return [String]
127
- def self.metric_path project, metric
128
- METRIC_PATH_TEMPLATE.render(
91
+ def self.log_metric_path project, metric
92
+ LOG_METRIC_PATH_TEMPLATE.render(
129
93
  :"project" => project,
130
94
  :"metric" => metric
131
95
  )
132
96
  end
133
97
 
134
- # Returns a fully-qualified organization resource name string.
135
- # @param organization [String]
136
- # @return [String]
137
- def self.organization_path organization
138
- ORGANIZATION_PATH_TEMPLATE.render(
139
- :"organization" => organization
140
- )
141
- end
142
-
143
98
  # Returns a fully-qualified project resource name string.
144
99
  # @param project [String]
145
100
  # @return [String]
@@ -226,6 +181,9 @@ module Google
226
181
  google_api_client.freeze
227
182
 
228
183
  headers = { :"x-goog-api-client" => google_api_client }
184
+ if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
185
+ headers[:"x-goog-user-project"] = credentials.quota_project_id
186
+ end
229
187
  headers.merge!(metadata) unless metadata.nil?
230
188
  client_config_file = Pathname.new(__dir__).join(
231
189
  "metrics_service_v2_client_config.json"
@@ -376,7 +334,7 @@ module Google
376
334
  # require "google/cloud/logging/v2"
377
335
  #
378
336
  # metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
379
- # formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
337
+ # formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.log_metric_path("[PROJECT]", "[METRIC]")
380
338
  # response = metrics_client.get_log_metric(formatted_metric_name)
381
339
 
382
340
  def get_log_metric \
@@ -460,7 +418,7 @@ module Google
460
418
  # require "google/cloud/logging/v2"
461
419
  #
462
420
  # metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
463
- # formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
421
+ # formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.log_metric_path("[PROJECT]", "[METRIC]")
464
422
  #
465
423
  # # TODO: Initialize `metric`:
466
424
  # metric = {}
@@ -496,7 +454,7 @@ module Google
496
454
  # require "google/cloud/logging/v2"
497
455
  #
498
456
  # metrics_client = Google::Cloud::Logging::V2::MetricsServiceV2Client.new
499
- # formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.metric_path("[PROJECT]", "[METRIC]")
457
+ # formatted_metric_name = Google::Cloud::Logging::V2::MetricsServiceV2Client.log_metric_path("[PROJECT]", "[METRIC]")
500
458
  # metrics_client.delete_log_metric(formatted_metric_name)
501
459
 
502
460
  def delete_log_metric \
@@ -4,7 +4,6 @@
4
4
  "retry_codes": {
5
5
  "idempotent": [
6
6
  "DEADLINE_EXCEEDED",
7
- "INTERNAL",
8
7
  "UNAVAILABLE"
9
8
  ],
10
9
  "non_idempotent": []
@@ -38,12 +37,12 @@
38
37
  },
39
38
  "UpdateLogMetric": {
40
39
  "timeout_millis": 60000,
41
- "retry_codes_name": "idempotent",
40
+ "retry_codes_name": "non_idempotent",
42
41
  "retry_params_name": "default"
43
42
  },
44
43
  "DeleteLogMetric": {
45
44
  "timeout_millis": 60000,
46
- "retry_codes_name": "idempotent",
45
+ "retry_codes_name": "non_idempotent",
47
46
  "retry_params_name": "default"
48
47
  }
49
48
  }
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Logging
19
- VERSION = "1.9.5".freeze
19
+ VERSION = "1.10.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -4,6 +4,7 @@
4
4
 
5
5
  require 'google/protobuf'
6
6
 
7
+ require 'google/api/field_behavior_pb'
7
8
  require 'google/api/monitored_resource_pb'
8
9
  require 'google/api/resource_pb'
9
10
  require 'google/logging/type/http_request_pb'
@@ -23,7 +24,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
23
24
  optional :insert_id, :string, 4
24
25
  optional :http_request, :message, 7, "google.logging.type.HttpRequest"
25
26
  map :labels, :string, :string, 11
26
- optional :metadata, :message, 25, "google.api.MonitoredResourceMetadata"
27
27
  optional :operation, :message, 15, "google.logging.v2.LogEntryOperation"
28
28
  optional :trace, :string, 22
29
29
  optional :span_id, :string, 27
@@ -13,6 +13,14 @@ require 'google/protobuf/field_mask_pb'
13
13
  require 'google/protobuf/timestamp_pb'
14
14
  require 'google/api/annotations_pb'
15
15
  Google::Protobuf::DescriptorPool.generated_pool.build do
16
+ add_message "google.logging.v2.LogBucket" do
17
+ optional :name, :string, 1
18
+ optional :description, :string, 3
19
+ optional :create_time, :message, 4, "google.protobuf.Timestamp"
20
+ optional :update_time, :message, 5, "google.protobuf.Timestamp"
21
+ optional :retention_days, :int32, 11
22
+ optional :lifecycle_state, :enum, 12, "google.logging.v2.LifecycleState"
23
+ end
16
24
  add_message "google.logging.v2.LogSink" do
17
25
  optional :name, :string, 1
18
26
  optional :destination, :string, 3
@@ -24,8 +32,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
24
32
  optional :include_children, :bool, 9
25
33
  optional :create_time, :message, 13, "google.protobuf.Timestamp"
26
34
  optional :update_time, :message, 14, "google.protobuf.Timestamp"
27
- optional :start_time, :message, 10, "google.protobuf.Timestamp"
28
- optional :end_time, :message, 11, "google.protobuf.Timestamp"
29
35
  oneof :options do
30
36
  optional :bigquery_options, :message, 12, "google.logging.v2.BigQueryOptions"
31
37
  end
@@ -39,6 +45,23 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
39
45
  optional :use_partitioned_tables, :bool, 1
40
46
  optional :uses_timestamp_column_partitioning, :bool, 3
41
47
  end
48
+ add_message "google.logging.v2.ListBucketsRequest" do
49
+ optional :parent, :string, 1
50
+ optional :page_token, :string, 2
51
+ optional :page_size, :int32, 3
52
+ end
53
+ add_message "google.logging.v2.ListBucketsResponse" do
54
+ repeated :buckets, :message, 1, "google.logging.v2.LogBucket"
55
+ optional :next_page_token, :string, 2
56
+ end
57
+ add_message "google.logging.v2.UpdateBucketRequest" do
58
+ optional :name, :string, 1
59
+ optional :bucket, :message, 2, "google.logging.v2.LogBucket"
60
+ optional :update_mask, :message, 4, "google.protobuf.FieldMask"
61
+ end
62
+ add_message "google.logging.v2.GetBucketRequest" do
63
+ optional :name, :string, 1
64
+ end
42
65
  add_message "google.logging.v2.ListSinksRequest" do
43
66
  optional :parent, :string, 1
44
67
  optional :page_token, :string, 2
@@ -110,14 +133,24 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
110
133
  optional :kms_key_name, :string, 2
111
134
  optional :service_account_id, :string, 3
112
135
  end
136
+ add_enum "google.logging.v2.LifecycleState" do
137
+ value :LIFECYCLE_STATE_UNSPECIFIED, 0
138
+ value :ACTIVE, 1
139
+ value :DELETE_REQUESTED, 2
140
+ end
113
141
  end
114
142
 
115
143
  module Google
116
144
  module Logging
117
145
  module V2
146
+ LogBucket = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogBucket").msgclass
118
147
  LogSink = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogSink").msgclass
119
148
  LogSink::VersionFormat = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LogSink.VersionFormat").enummodule
120
149
  BigQueryOptions = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.BigQueryOptions").msgclass
150
+ ListBucketsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListBucketsRequest").msgclass
151
+ ListBucketsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListBucketsResponse").msgclass
152
+ UpdateBucketRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.UpdateBucketRequest").msgclass
153
+ GetBucketRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.GetBucketRequest").msgclass
121
154
  ListSinksRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListSinksRequest").msgclass
122
155
  ListSinksResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.ListSinksResponse").msgclass
123
156
  GetSinkRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.GetSinkRequest").msgclass
@@ -134,6 +167,7 @@ module Google
134
167
  GetCmekSettingsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.GetCmekSettingsRequest").msgclass
135
168
  UpdateCmekSettingsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.UpdateCmekSettingsRequest").msgclass
136
169
  CmekSettings = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.CmekSettings").msgclass
170
+ LifecycleState = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.logging.v2.LifecycleState").enummodule
137
171
  end
138
172
  end
139
173
  end