Class: Gcloud::Logging::Entry::Operation

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOperation

Returns a new instance of Operation.



30
31
# File 'lib/gcloud/logging/entry/operation.rb', line 30

def initialize
end

Instance Attribute Details

#firstObject

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

#idObject

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

#lastObject

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

#producerObject

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

Returns:

  • (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_grpcObject

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