Class: Google::Cloud::Logging::Entry::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/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.



31
32
# File 'lib/google/cloud/logging/entry/operation.rb', line 31

def initialize
end

Instance Attribute Details

#firstObject

Set this to true if this is the first log entry in the operation.



48
49
50
# File 'lib/google/cloud/logging/entry/operation.rb', line 48

def first
  @first
end

#idObject

An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation.



37
38
39
# File 'lib/google/cloud/logging/entry/operation.rb', line 37

def id
  @id
end

#lastObject

Set this to true if this is the last log entry in the operation.



52
53
54
# File 'lib/google/cloud/logging/entry/operation.rb', line 52

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”`.



44
45
46
# File 'lib/google/cloud/logging/entry/operation.rb', line 44

def producer
  @producer
end

Class Method Details

.from_grpc(grpc) ⇒ Object

Google::Logging::V2::LogEntryOperation object.



79
80
81
82
83
84
85
86
87
# File 'lib/google/cloud/logging/entry/operation.rb', line 79

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)


56
57
58
59
60
61
# File 'lib/google/cloud/logging/entry/operation.rb', line 56

def empty?
  id.nil? &&
    producer.nil? &&
    first.nil? &&
    last.nil?
end

#to_grpcObject

Google::Logging::V2::LogEntryOperation object.



66
67
68
69
70
71
72
73
74
# File 'lib/google/cloud/logging/entry/operation.rb', line 66

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