gcloud 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/AUTHENTICATION.md +3 -3
- data/CHANGELOG.md +92 -0
- data/OVERVIEW.md +3 -3
- data/lib/gcloud.rb +75 -25
- data/lib/gcloud/backoff.rb +5 -1
- data/lib/gcloud/bigquery.rb +25 -43
- data/lib/gcloud/bigquery/copy_job.rb +13 -13
- data/lib/gcloud/bigquery/data.rb +20 -16
- data/lib/gcloud/bigquery/dataset.rb +202 -177
- data/lib/gcloud/bigquery/dataset/access.rb +118 -104
- data/lib/gcloud/bigquery/dataset/list.rb +14 -18
- data/lib/gcloud/bigquery/extract_job.rb +12 -12
- data/lib/gcloud/bigquery/insert_response.rb +12 -14
- data/lib/gcloud/bigquery/job.rb +45 -57
- data/lib/gcloud/bigquery/job/list.rb +18 -24
- data/lib/gcloud/bigquery/load_job.rb +35 -27
- data/lib/gcloud/bigquery/project.rb +53 -73
- data/lib/gcloud/bigquery/query_data.rb +28 -35
- data/lib/gcloud/bigquery/query_job.rb +18 -18
- data/lib/gcloud/bigquery/schema.rb +359 -0
- data/lib/gcloud/bigquery/service.rb +506 -0
- data/lib/gcloud/bigquery/table.rb +185 -266
- data/lib/gcloud/bigquery/table/list.rb +15 -19
- data/lib/gcloud/bigquery/view.rb +126 -81
- data/lib/gcloud/datastore.rb +39 -27
- data/lib/gcloud/datastore/commit.rb +2 -2
- data/lib/gcloud/datastore/dataset.rb +8 -19
- data/lib/gcloud/datastore/dataset/lookup_results.rb +2 -4
- data/lib/gcloud/datastore/dataset/query_results.rb +0 -2
- data/lib/gcloud/datastore/entity.rb +7 -1
- data/lib/gcloud/datastore/errors.rb +5 -27
- data/lib/gcloud/datastore/grpc_utils.rb +4 -3
- data/lib/gcloud/datastore/key.rb +6 -0
- data/lib/gcloud/datastore/service.rb +18 -12
- data/lib/gcloud/datastore/transaction.rb +0 -10
- data/lib/gcloud/dns.rb +29 -19
- data/lib/gcloud/dns/change.rb +10 -15
- data/lib/gcloud/dns/change/list.rb +4 -4
- data/lib/gcloud/dns/importer.rb +1 -1
- data/lib/gcloud/dns/project.rb +32 -49
- data/lib/gcloud/dns/record.rb +8 -2
- data/lib/gcloud/dns/record/list.rb +4 -4
- data/lib/gcloud/dns/service.rb +167 -0
- data/lib/gcloud/dns/zone.rb +33 -52
- data/lib/gcloud/dns/zone/list.rb +12 -16
- data/lib/gcloud/errors.rb +31 -19
- data/lib/gcloud/logging.rb +50 -39
- data/lib/gcloud/logging/entry.rb +197 -24
- data/lib/gcloud/logging/entry/list.rb +0 -2
- data/lib/gcloud/logging/logger.rb +1 -1
- data/lib/gcloud/logging/metric.rb +3 -9
- data/lib/gcloud/logging/metric/list.rb +0 -2
- data/lib/gcloud/logging/project.rb +58 -54
- data/lib/gcloud/logging/resource_descriptor.rb +2 -2
- data/lib/gcloud/logging/resource_descriptor/list.rb +0 -2
- data/lib/gcloud/logging/service.rb +32 -23
- data/lib/gcloud/logging/sink.rb +8 -14
- data/lib/gcloud/logging/sink/list.rb +0 -2
- data/lib/gcloud/pubsub.rb +21 -16
- data/lib/gcloud/pubsub/policy.rb +204 -0
- data/lib/gcloud/pubsub/project.rb +26 -38
- data/lib/gcloud/pubsub/service.rb +39 -31
- data/lib/gcloud/pubsub/subscription.rb +56 -59
- data/lib/gcloud/pubsub/subscription/list.rb +4 -4
- data/lib/gcloud/pubsub/topic.rb +69 -66
- data/lib/gcloud/pubsub/topic/list.rb +0 -2
- data/lib/gcloud/pubsub/topic/{batch.rb → publisher.rb} +15 -2
- data/lib/gcloud/resource_manager.rb +27 -26
- data/lib/gcloud/resource_manager/manager.rb +19 -39
- data/lib/gcloud/resource_manager/policy.rb +211 -0
- data/lib/gcloud/resource_manager/project.rb +97 -121
- data/lib/gcloud/resource_manager/project/list.rb +7 -7
- data/lib/gcloud/resource_manager/project/updater.rb +4 -9
- data/lib/gcloud/resource_manager/service.rb +127 -0
- data/lib/gcloud/storage.rb +24 -42
- data/lib/gcloud/storage/bucket.rb +104 -192
- data/lib/gcloud/storage/bucket/acl.rb +47 -143
- data/lib/gcloud/storage/bucket/cors.rb +55 -11
- data/lib/gcloud/storage/bucket/list.rb +14 -14
- data/lib/gcloud/storage/errors.rb +3 -43
- data/lib/gcloud/storage/file.rb +114 -111
- data/lib/gcloud/storage/file/acl.rb +27 -113
- data/lib/gcloud/storage/file/list.rb +21 -21
- data/lib/gcloud/storage/project.rb +49 -59
- data/lib/gcloud/storage/service.rb +347 -0
- data/lib/gcloud/translate.rb +24 -14
- data/lib/gcloud/translate/api.rb +12 -21
- data/lib/gcloud/translate/detection.rb +5 -5
- data/lib/gcloud/translate/language.rb +1 -1
- data/lib/gcloud/translate/service.rb +80 -0
- data/lib/gcloud/translate/translation.rb +6 -6
- data/lib/gcloud/version.rb +1 -1
- data/lib/gcloud/vision.rb +24 -15
- data/lib/gcloud/vision/annotate.rb +24 -21
- data/lib/gcloud/vision/annotation.rb +9 -9
- data/lib/gcloud/vision/annotation/entity.rb +11 -11
- data/lib/gcloud/vision/annotation/face.rb +25 -25
- data/lib/gcloud/vision/annotation/properties.rb +8 -8
- data/lib/gcloud/vision/annotation/safe_search.rb +4 -4
- data/lib/gcloud/vision/annotation/text.rb +7 -7
- data/lib/gcloud/vision/annotation/vertex.rb +1 -1
- data/lib/gcloud/vision/image.rb +11 -11
- data/lib/gcloud/vision/location.rb +5 -2
- data/lib/gcloud/vision/project.rb +14 -16
- data/lib/gcloud/vision/service.rb +66 -0
- data/lib/google/api_client.rb +0 -0
- metadata +27 -24
- data/lib/gcloud/bigquery/connection.rb +0 -624
- data/lib/gcloud/bigquery/errors.rb +0 -68
- data/lib/gcloud/bigquery/table/schema.rb +0 -234
- data/lib/gcloud/dns/connection.rb +0 -173
- data/lib/gcloud/dns/errors.rb +0 -68
- data/lib/gcloud/resource_manager/connection.rb +0 -134
- data/lib/gcloud/resource_manager/errors.rb +0 -68
- data/lib/gcloud/storage/connection.rb +0 -444
- data/lib/gcloud/translate/connection.rb +0 -85
- data/lib/gcloud/translate/errors.rb +0 -68
- data/lib/gcloud/upload.rb +0 -95
- data/lib/gcloud/vision/connection.rb +0 -63
- data/lib/gcloud/vision/errors.rb +0 -69
data/lib/gcloud/logging.rb
CHANGED
|
@@ -18,14 +18,14 @@ require "gcloud/logging/project"
|
|
|
18
18
|
|
|
19
19
|
module Gcloud
|
|
20
20
|
##
|
|
21
|
-
# Creates a new object for connecting to the Logging service.
|
|
21
|
+
# Creates a new object for connecting to the Stackdriver Logging service.
|
|
22
22
|
# Each call creates a new connection.
|
|
23
23
|
#
|
|
24
24
|
# For more information on connecting to Google Cloud see the [Authentication
|
|
25
25
|
# Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
|
|
26
26
|
#
|
|
27
|
-
# @param [String] project Project identifier for the Logging
|
|
28
|
-
#
|
|
27
|
+
# @param [String] project Project identifier for the Stackdriver Logging
|
|
28
|
+
# service.
|
|
29
29
|
# @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If file
|
|
30
30
|
# path the file must be readable.
|
|
31
31
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
|
|
@@ -36,6 +36,9 @@ module Gcloud
|
|
|
36
36
|
# The default scope is:
|
|
37
37
|
#
|
|
38
38
|
# * `https://www.googleapis.com/auth/logging.admin`
|
|
39
|
+
# @param [Integer] retries Number of times to retry requests on server error.
|
|
40
|
+
# The default value is `3`. Optional.
|
|
41
|
+
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
|
39
42
|
#
|
|
40
43
|
# @return [Gcloud::Logging::Project]
|
|
41
44
|
#
|
|
@@ -46,23 +49,30 @@ module Gcloud
|
|
|
46
49
|
# logging = gcloud.logging
|
|
47
50
|
# # ...
|
|
48
51
|
#
|
|
49
|
-
def self.logging project = nil, keyfile = nil, scope: nil
|
|
52
|
+
def self.logging project = nil, keyfile = nil, scope: nil, retries: nil,
|
|
53
|
+
timeout: nil
|
|
50
54
|
project ||= Gcloud::Logging::Project.default_project
|
|
55
|
+
project = project.to_s # Always cast to a string
|
|
56
|
+
fail ArgumentError, "project is missing" if project.empty?
|
|
57
|
+
|
|
51
58
|
if keyfile.nil?
|
|
52
59
|
credentials = Gcloud::Logging::Credentials.default scope: scope
|
|
53
60
|
else
|
|
54
61
|
credentials = Gcloud::Logging::Credentials.new keyfile, scope: scope
|
|
55
62
|
end
|
|
56
|
-
|
|
63
|
+
|
|
64
|
+
Gcloud::Logging::Project.new(
|
|
65
|
+
Gcloud::Logging::Service.new(
|
|
66
|
+
project, credentials, retries: retries, timeout: timeout))
|
|
57
67
|
end
|
|
58
68
|
|
|
59
69
|
##
|
|
60
|
-
# #
|
|
70
|
+
# # Stackdriver Logging
|
|
61
71
|
#
|
|
62
|
-
# The
|
|
72
|
+
# The Stackdriver Logging service collects and stores logs from applications
|
|
63
73
|
# and services on the Google Cloud Platform, giving you fine-grained,
|
|
64
|
-
# programmatic control over your projects' logs. You can use the
|
|
65
|
-
# API to:
|
|
74
|
+
# programmatic control over your projects' logs. You can use the Stackdriver
|
|
75
|
+
# Logging API to:
|
|
66
76
|
#
|
|
67
77
|
# * [Read and filter log entries](#listing-log-entries)
|
|
68
78
|
# * [Export your log entries](#exporting-log-entries) to Cloud Storage,
|
|
@@ -71,21 +81,21 @@ module Gcloud
|
|
|
71
81
|
# Monitoring
|
|
72
82
|
# * [Write log entries](#writing-log-entries)
|
|
73
83
|
#
|
|
74
|
-
# For general information about
|
|
75
|
-
#
|
|
84
|
+
# For general information about Stackdriver Logging, read [Stackdriver Logging
|
|
85
|
+
# Documentation](https://cloud.google.com/logging/docs/).
|
|
76
86
|
#
|
|
77
|
-
#
|
|
87
|
+
# The goal of gcloud-ruby is to provide an API that is comfortable to
|
|
78
88
|
# Rubyists. Authentication is handled by {Gcloud#logging}. You can provide the
|
|
79
|
-
# project and credential information to connect to the
|
|
80
|
-
# or if you are running on Google Compute Engine this configuration
|
|
81
|
-
# care of for you. You can read more about the options for connecting
|
|
82
|
-
# [Authentication
|
|
89
|
+
# project and credential information to connect to the Stackdriver Logging
|
|
90
|
+
# service, or if you are running on Google Compute Engine this configuration
|
|
91
|
+
# is taken care of for you. You can read more about the options for connecting
|
|
92
|
+
# in the [Authentication
|
|
83
93
|
# Guide](https://googlecloudplatform.github.io/gcloud-ruby/#/docs/guides/authentication).
|
|
84
94
|
#
|
|
85
95
|
# ## Listing log entries
|
|
86
96
|
#
|
|
87
|
-
#
|
|
88
|
-
# Engine and Google Compute Engine. (See the [List of Log
|
|
97
|
+
# Stackdriver Logging gathers log entries from many services, including Google
|
|
98
|
+
# App Engine and Google Compute Engine. (See the [List of Log
|
|
89
99
|
# Types](https://cloud.google.com/logging/docs/view/logs_index).) In addition,
|
|
90
100
|
# you can write your own log entries to the service.
|
|
91
101
|
#
|
|
@@ -108,8 +118,9 @@ module Gcloud
|
|
|
108
118
|
# log is a named collection of entries. Logs can be produced by Google Cloud
|
|
109
119
|
# Platform services, by third-party services, or by your applications. For
|
|
110
120
|
# example, the log `compute.googleapis.com/activity_log` is produced by Google
|
|
111
|
-
# Compute Engine. Logs are simply referenced by name in
|
|
112
|
-
# `Log` type in
|
|
121
|
+
# Compute Engine. Logs are simply referenced by name in gcloud-ruby. There is
|
|
122
|
+
# no `Log` type in gcloud-ruby or `Log` resource in the Stackdriver Logging
|
|
123
|
+
# API.
|
|
113
124
|
#
|
|
114
125
|
# ```ruby
|
|
115
126
|
# require "gcloud"
|
|
@@ -137,9 +148,9 @@ module Gcloud
|
|
|
137
148
|
#
|
|
138
149
|
# ## Exporting log entries
|
|
139
150
|
#
|
|
140
|
-
#
|
|
141
|
-
# Cloud Storage buckets (for long term log storage), Google BigQuery
|
|
142
|
-
# (for log analysis), and Google Pub/Sub (for streaming to other
|
|
151
|
+
# Stackdriver Logging lets you export log entries to destinations including
|
|
152
|
+
# Google Cloud Storage buckets (for long term log storage), Google BigQuery
|
|
153
|
+
# datasets (for log analysis), and Google Pub/Sub (for streaming to other
|
|
143
154
|
# applications).
|
|
144
155
|
#
|
|
145
156
|
# ### Creating sinks
|
|
@@ -166,15 +177,16 @@ module Gcloud
|
|
|
166
177
|
#
|
|
167
178
|
# bucket = storage.create_bucket "my-logs-bucket"
|
|
168
179
|
#
|
|
169
|
-
# # Grant owner permission to
|
|
180
|
+
# # Grant owner permission to Stackdriver Logging service
|
|
170
181
|
# email = "cloud-logs@google.com"
|
|
171
182
|
# bucket.acl.add_owner "group-#{email}"
|
|
172
183
|
#
|
|
173
184
|
# sink = logging.create_sink "my-sink", "storage.googleapis.com/#{bucket.id}"
|
|
174
185
|
# ```
|
|
175
186
|
#
|
|
176
|
-
# When you create a sink, only new log entries are exported.
|
|
177
|
-
# does not send previously-ingested log entries to the sink's
|
|
187
|
+
# When you create a sink, only new log entries are exported. Stackdriver
|
|
188
|
+
# Logging does not send previously-ingested log entries to the sink's
|
|
189
|
+
# destination.
|
|
178
190
|
#
|
|
179
191
|
# ### Listing sinks
|
|
180
192
|
#
|
|
@@ -233,7 +245,7 @@ module Gcloud
|
|
|
233
245
|
# ## Writing log entries
|
|
234
246
|
#
|
|
235
247
|
# An {Gcloud::Logging::Entry} is composed of metadata and a payload. The
|
|
236
|
-
# payload is traditionally a message string, but in
|
|
248
|
+
# payload is traditionally a message string, but in Stackdriver Logging it can
|
|
237
249
|
# also be a JSON or protocol buffer object. A single log can have entries with
|
|
238
250
|
# different payload types. In addition to the payload, your argument(s) to
|
|
239
251
|
# {Gcloud::Logging::Project#write_entries} must also contain a log name and a
|
|
@@ -302,24 +314,23 @@ module Gcloud
|
|
|
302
314
|
# logger.info "Job started."
|
|
303
315
|
# ```
|
|
304
316
|
#
|
|
305
|
-
# ## Configuring
|
|
317
|
+
# ## Configuring retries and timeout
|
|
306
318
|
#
|
|
307
|
-
#
|
|
308
|
-
#
|
|
309
|
-
#
|
|
310
|
-
# `
|
|
319
|
+
# You can configure how many times API requests may be automatically retried.
|
|
320
|
+
# When an API request fails, the response will be inspected to see if the
|
|
321
|
+
# request meets criteria indicating that it may succeed on retry, such as
|
|
322
|
+
# `500` and `503` status codes or a specific internal error code such as
|
|
323
|
+
# `rateLimitExceeded`. If it meets the criteria, the request will be retried
|
|
324
|
+
# after a delay. If another error occurs, the delay will be increased before a
|
|
325
|
+
# subsequent attempt, until the `retries` limit is reached.
|
|
311
326
|
#
|
|
312
|
-
#
|
|
313
|
-
# should be retried. If the response matches the criteria, then the request
|
|
314
|
-
# will be retried after a delay. If another error occurs, the delay will be
|
|
315
|
-
# increased incrementally before a subsequent attempt. The first retry will be
|
|
316
|
-
# delayed one second, the second retry two seconds, and so on.
|
|
327
|
+
# You can also set the request `timeout` value in seconds.
|
|
317
328
|
#
|
|
318
329
|
# ```ruby
|
|
319
330
|
# require "gcloud"
|
|
320
|
-
# require "gcloud/backoff"
|
|
321
331
|
#
|
|
322
|
-
#
|
|
332
|
+
# gcloud = Gcloud.new
|
|
333
|
+
# logging = gcloud.logging retries: 10, timeout: 120
|
|
323
334
|
# ```
|
|
324
335
|
#
|
|
325
336
|
module Logging
|
data/lib/gcloud/logging/entry.rb
CHANGED
|
@@ -27,17 +27,18 @@ module Gcloud
|
|
|
27
27
|
# An individual entry in a log.
|
|
28
28
|
#
|
|
29
29
|
# Each log entry is composed of metadata and a payload. The metadata
|
|
30
|
-
# includes standard information used by
|
|
31
|
-
# entry was created and where it came from. The payload is the event
|
|
32
|
-
# Traditionally this is a message string, but in
|
|
33
|
-
# be a JSON or protocol buffer object. A single log can have
|
|
34
|
-
# different payload types.
|
|
30
|
+
# includes standard information used by Stackdriver Logging, such as when
|
|
31
|
+
# the entry was created and where it came from. The payload is the event
|
|
32
|
+
# record. Traditionally this is a message string, but in Stackdriver Logging
|
|
33
|
+
# it can also be a JSON or protocol buffer object. A single log can have
|
|
34
|
+
# entries with different payload types.
|
|
35
35
|
#
|
|
36
36
|
# A log is a named collection of entries. Logs can be produced by Google
|
|
37
37
|
# Cloud Platform services, by third-party services, or by your applications.
|
|
38
38
|
# For example, the log `compute.googleapis.com/activity_log` is produced by
|
|
39
|
-
# Google Compute Engine. Logs are simply referenced by name in
|
|
40
|
-
# is no `Log` type in
|
|
39
|
+
# Google Compute Engine. Logs are simply referenced by name in gcloud-ruby.
|
|
40
|
+
# There is no `Log` type in gcloud-ruby or `Log` resource in the Cloud
|
|
41
|
+
# Logging API.
|
|
41
42
|
#
|
|
42
43
|
# @see https://cloud.google.com/logging/docs/view/logs_index List of Log
|
|
43
44
|
# Types
|
|
@@ -48,9 +49,7 @@ module Gcloud
|
|
|
48
49
|
# gcloud = Gcloud.new
|
|
49
50
|
# logging = gcloud.logging
|
|
50
51
|
#
|
|
51
|
-
# entry = logging.entry
|
|
52
|
-
# entry.payload = "Job started."
|
|
53
|
-
# entry.log_name = "my_app_log"
|
|
52
|
+
# entry = logging.entry payload: "Job started.", log_name: "my_app_log"
|
|
54
53
|
# entry.resource.type = "gae_app"
|
|
55
54
|
# entry.resource.labels[:module_id] = "1"
|
|
56
55
|
# entry.resource.labels[:version_id] = "20150925t173233"
|
|
@@ -89,76 +88,250 @@ module Gcloud
|
|
|
89
88
|
# monitored resource designating the particular database that reported the
|
|
90
89
|
# error.
|
|
91
90
|
# @return [Gcloud::Logging::Resource]
|
|
92
|
-
|
|
91
|
+
attr_accessor :resource
|
|
93
92
|
|
|
94
93
|
##
|
|
95
94
|
# The time the event described by the log entry occurred. If omitted,
|
|
96
|
-
#
|
|
95
|
+
# Stackdriver Logging will use the time the log entry is written.
|
|
96
|
+
# @return [Time]
|
|
97
97
|
attr_accessor :timestamp
|
|
98
98
|
|
|
99
99
|
##
|
|
100
|
-
# The severity level of the log entry. The default value is
|
|
100
|
+
# The severity level of the log entry. The default value is `:DEFAULT`.
|
|
101
|
+
# @return [Symbol]
|
|
101
102
|
attr_accessor :severity
|
|
102
103
|
|
|
103
104
|
##
|
|
104
|
-
# Returns `true` if the severity level is
|
|
105
|
+
# Returns `true` if the severity level is `:DEFAULT`.
|
|
105
106
|
def default?
|
|
106
107
|
severity == :DEFAULT
|
|
107
108
|
end
|
|
108
109
|
|
|
109
110
|
##
|
|
110
|
-
#
|
|
111
|
+
# Sets the severity level to `:DEFAULT`.
|
|
112
|
+
#
|
|
113
|
+
# @example
|
|
114
|
+
# require "gcloud"
|
|
115
|
+
#
|
|
116
|
+
# gcloud = Gcloud.new
|
|
117
|
+
# logging = gcloud.logging
|
|
118
|
+
#
|
|
119
|
+
# entry = logging.entry
|
|
120
|
+
# entry.severity = :DEBUG
|
|
121
|
+
# entry.default!
|
|
122
|
+
# entry.default? #=> true
|
|
123
|
+
# entry.severity #=> :DEFAULT
|
|
124
|
+
#
|
|
125
|
+
def default!
|
|
126
|
+
self.severity = :DEFAULT
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
##
|
|
130
|
+
# Returns `true` if the severity level is `:DEBUG`.
|
|
111
131
|
def debug?
|
|
112
132
|
severity == :DEBUG
|
|
113
133
|
end
|
|
114
134
|
|
|
115
135
|
##
|
|
116
|
-
#
|
|
136
|
+
# Sets the severity level to `:DEBUG`.
|
|
137
|
+
#
|
|
138
|
+
# @example
|
|
139
|
+
# require "gcloud"
|
|
140
|
+
#
|
|
141
|
+
# gcloud = Gcloud.new
|
|
142
|
+
# logging = gcloud.logging
|
|
143
|
+
#
|
|
144
|
+
# entry = logging.entry
|
|
145
|
+
# entry.severity #=> :DEFAULT
|
|
146
|
+
# entry.debug!
|
|
147
|
+
# entry.debug? #=> true
|
|
148
|
+
# entry.severity #=> :DEBUG
|
|
149
|
+
#
|
|
150
|
+
def debug!
|
|
151
|
+
self.severity = :DEBUG
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
##
|
|
155
|
+
# Returns `true` if the severity level is `:INFO`.
|
|
117
156
|
def info?
|
|
118
157
|
severity == :INFO
|
|
119
158
|
end
|
|
120
159
|
|
|
121
160
|
##
|
|
122
|
-
#
|
|
161
|
+
# Sets the severity level to `:INFO`.
|
|
162
|
+
#
|
|
163
|
+
# @example
|
|
164
|
+
# require "gcloud"
|
|
165
|
+
#
|
|
166
|
+
# gcloud = Gcloud.new
|
|
167
|
+
# logging = gcloud.logging
|
|
168
|
+
#
|
|
169
|
+
# entry = logging.entry
|
|
170
|
+
# entry.severity #=> :DEFAULT
|
|
171
|
+
# entry.info!
|
|
172
|
+
# entry.info? #=> true
|
|
173
|
+
# entry.severity #=> :INFO
|
|
174
|
+
#
|
|
175
|
+
def info!
|
|
176
|
+
self.severity = :INFO
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
##
|
|
180
|
+
# Returns `true` if the severity level is `:NOTICE`.
|
|
123
181
|
def notice?
|
|
124
182
|
severity == :NOTICE
|
|
125
183
|
end
|
|
126
184
|
|
|
127
185
|
##
|
|
128
|
-
#
|
|
186
|
+
# Sets the severity level to `:NOTICE`.
|
|
187
|
+
#
|
|
188
|
+
# @example
|
|
189
|
+
# require "gcloud"
|
|
190
|
+
#
|
|
191
|
+
# gcloud = Gcloud.new
|
|
192
|
+
# logging = gcloud.logging
|
|
193
|
+
#
|
|
194
|
+
# entry = logging.entry
|
|
195
|
+
# entry.severity #=> :DEFAULT
|
|
196
|
+
# entry.notice!
|
|
197
|
+
# entry.notice? #=> true
|
|
198
|
+
# entry.severity #=> :NOTICE
|
|
199
|
+
#
|
|
200
|
+
def notice!
|
|
201
|
+
self.severity = :NOTICE
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
##
|
|
205
|
+
# Returns `true` if the severity level is `:WARNING`.
|
|
129
206
|
def warning?
|
|
130
207
|
severity == :WARNING
|
|
131
208
|
end
|
|
132
209
|
|
|
133
210
|
##
|
|
134
|
-
#
|
|
211
|
+
# Sets the severity level to `:WARNING`.
|
|
212
|
+
#
|
|
213
|
+
# @example
|
|
214
|
+
# require "gcloud"
|
|
215
|
+
#
|
|
216
|
+
# gcloud = Gcloud.new
|
|
217
|
+
# logging = gcloud.logging
|
|
218
|
+
#
|
|
219
|
+
# entry = logging.entry
|
|
220
|
+
# entry.severity #=> :DEFAULT
|
|
221
|
+
# entry.warning!
|
|
222
|
+
# entry.warning? #=> true
|
|
223
|
+
# entry.severity #=> :WARNING
|
|
224
|
+
#
|
|
225
|
+
def warning!
|
|
226
|
+
self.severity = :WARNING
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
##
|
|
230
|
+
# Returns `true` if the severity level is `:ERROR`.
|
|
135
231
|
def error?
|
|
136
232
|
severity == :ERROR
|
|
137
233
|
end
|
|
138
234
|
|
|
139
235
|
##
|
|
140
|
-
#
|
|
236
|
+
# Sets the severity level to `:ERROR`.
|
|
237
|
+
#
|
|
238
|
+
# @example
|
|
239
|
+
# require "gcloud"
|
|
240
|
+
#
|
|
241
|
+
# gcloud = Gcloud.new
|
|
242
|
+
# logging = gcloud.logging
|
|
243
|
+
#
|
|
244
|
+
# entry = logging.entry
|
|
245
|
+
# entry.severity #=> :DEFAULT
|
|
246
|
+
# entry.error!
|
|
247
|
+
# entry.error? #=> true
|
|
248
|
+
# entry.severity #=> :ERROR
|
|
249
|
+
#
|
|
250
|
+
def error!
|
|
251
|
+
self.severity = :ERROR
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
##
|
|
255
|
+
# Returns `true` if the severity level is `:CRITICAL`.
|
|
141
256
|
def critical?
|
|
142
257
|
severity == :CRITICAL
|
|
143
258
|
end
|
|
144
259
|
|
|
145
260
|
##
|
|
146
|
-
#
|
|
261
|
+
# Sets the severity level to `:CRITICAL`.
|
|
262
|
+
#
|
|
263
|
+
# @example
|
|
264
|
+
# require "gcloud"
|
|
265
|
+
#
|
|
266
|
+
# gcloud = Gcloud.new
|
|
267
|
+
# logging = gcloud.logging
|
|
268
|
+
#
|
|
269
|
+
# entry = logging.entry
|
|
270
|
+
# entry.severity #=> :DEFAULT
|
|
271
|
+
# entry.critical!
|
|
272
|
+
# entry.critical? #=> true
|
|
273
|
+
# entry.severity #=> :CRITICAL
|
|
274
|
+
#
|
|
275
|
+
def critical!
|
|
276
|
+
self.severity = :CRITICAL
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
##
|
|
280
|
+
# Returns `true` if the severity level is `:ALERT`.
|
|
147
281
|
def alert?
|
|
148
282
|
severity == :ALERT
|
|
149
283
|
end
|
|
150
284
|
|
|
151
285
|
##
|
|
152
|
-
#
|
|
286
|
+
# Sets the severity level to `:ALERT`.
|
|
287
|
+
#
|
|
288
|
+
# @example
|
|
289
|
+
# require "gcloud"
|
|
290
|
+
#
|
|
291
|
+
# gcloud = Gcloud.new
|
|
292
|
+
# logging = gcloud.logging
|
|
293
|
+
#
|
|
294
|
+
# entry = logging.entry
|
|
295
|
+
# entry.severity #=> :DEFAULT
|
|
296
|
+
# entry.alert!
|
|
297
|
+
# entry.alert? #=> true
|
|
298
|
+
# entry.severity #=> :ALERT
|
|
299
|
+
#
|
|
300
|
+
def alert!
|
|
301
|
+
self.severity = :ALERT
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
##
|
|
305
|
+
# Returns `true` if the severity level is `:EMERGENCY`.
|
|
153
306
|
def emergency?
|
|
154
307
|
severity == :EMERGENCY
|
|
155
308
|
end
|
|
156
309
|
|
|
310
|
+
##
|
|
311
|
+
# Sets the severity level to `:EMERGENCY`.
|
|
312
|
+
#
|
|
313
|
+
# @example
|
|
314
|
+
# require "gcloud"
|
|
315
|
+
#
|
|
316
|
+
# gcloud = Gcloud.new
|
|
317
|
+
# logging = gcloud.logging
|
|
318
|
+
#
|
|
319
|
+
# entry = logging.entry
|
|
320
|
+
# entry.severity #=> :DEFAULT
|
|
321
|
+
# entry.emergency!
|
|
322
|
+
# entry.emergency? #=> true
|
|
323
|
+
# entry.severity #=> :EMERGENCY
|
|
324
|
+
#
|
|
325
|
+
def emergency!
|
|
326
|
+
self.severity = :EMERGENCY
|
|
327
|
+
end
|
|
328
|
+
|
|
157
329
|
##
|
|
158
330
|
# A unique ID for the log entry. If you provide this field, the logging
|
|
159
331
|
# service considers other log entries in the same log with the same ID as
|
|
160
|
-
# duplicates which can be removed. If omitted,
|
|
161
|
-
# a unique ID for this log entry.
|
|
332
|
+
# duplicates which can be removed. If omitted, Stackdriver Logging will
|
|
333
|
+
# generate a unique ID for this log entry.
|
|
334
|
+
# @return [String]
|
|
162
335
|
attr_accessor :insert_id
|
|
163
336
|
|
|
164
337
|
##
|