Class: Gcloud::Logging::Entry::Operation
- Inherits:
-
Object
- Object
- Gcloud::Logging::Entry::Operation
- Defined in:
- lib/gcloud/logging/entry/operation.rb
Overview
# Operation
Additional information about a potentially long-running operation with which a log entry is associated.
See also #operation.
Instance Attribute Summary collapse
-
#first ⇒ Object
Set this to ‘true` if this is the first log entry in the operation.
-
#id ⇒ Object
An arbitrary operation identifier.
-
#last ⇒ Object
Set this to ‘true` if this is the last log entry in the operation.
-
#producer ⇒ Object
An arbitrary producer identifier.
Class Method Summary collapse
-
.from_grpc(grpc) ⇒ Object
object.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize ⇒ Operation
constructor
A new instance of Operation.
-
#to_grpc ⇒ Object
Google::Logging::V2::LogEntryOperation object.
Constructor Details
#initialize ⇒ Operation
Returns a new instance of Operation.
30 31 |
# File 'lib/gcloud/logging/entry/operation.rb', line 30 def initialize end |
Instance Attribute Details
#first ⇒ Object
Set this to ‘true` if this is the first log entry in the operation.
47 48 49 |
# File 'lib/gcloud/logging/entry/operation.rb', line 47 def first @first end |
#id ⇒ Object
An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation.
36 37 38 |
# File 'lib/gcloud/logging/entry/operation.rb', line 36 def id @id end |
#last ⇒ Object
Set this to ‘true` if this is the last log entry in the operation.
51 52 53 |
# File 'lib/gcloud/logging/entry/operation.rb', line 51 def last @last end |
#producer ⇒ Object
An arbitrary producer identifier. The combination of ‘id` and `producer` must be globally unique. Examples for `producer`: `“MyDivision.MyBigCompany.com”`, `“github.com/MyProject/MyApplication”`.
43 44 45 |
# File 'lib/gcloud/logging/entry/operation.rb', line 43 def producer @producer end |
Class Method Details
.from_grpc(grpc) ⇒ Object
object.
78 79 80 81 82 83 84 85 86 |
# File 'lib/gcloud/logging/entry/operation.rb', line 78 def self.from_grpc grpc return new if grpc.nil? new.tap do |o| o.id = grpc.id o.producer = grpc.producer o.first = grpc.first o.last = grpc.last end end |
Instance Method Details
#empty? ⇒ Boolean
55 56 57 58 59 60 |
# File 'lib/gcloud/logging/entry/operation.rb', line 55 def empty? id.nil? && producer.nil? && first.nil? && last.nil? end |
#to_grpc ⇒ Object
Google::Logging::V2::LogEntryOperation object.
65 66 67 68 69 70 71 72 73 |
# File 'lib/gcloud/logging/entry/operation.rb', line 65 def to_grpc return nil if empty? Google::Logging::V2::LogEntryOperation.new( id: id.to_s, producer: producer.to_s, first: !(!first), last: !(!last) ) end |