class Google::Cloud::Logging::Entry::Operation

# Operation

Additional information about a potentially long-running operation with which a log entry is associated.

See also {Google::Cloud::Logging::Entry#operation}.

Attributes

first[RW]

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

id[RW]

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

last[RW]

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

producer[RW]

An arbitrary producer identifier. The combination of `id` and `producer` must be globally unique. Examples for `producer`: `“MyDivision.MyBigCompany.com”`, `“github.com/MyProject/MyApplication”`.

Public Class Methods

from_grpc(grpc) click to toggle source

@private New Google::Cloud::Logging::Entry::Operation from a Google::Cloud::Logging::V2::LogEntryOperation object.

# 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
new() click to toggle source

@private Create an empty Operation object.

# File lib/google/cloud/logging/entry/operation.rb, line 31
def initialize
end

Public Instance Methods

empty?() click to toggle source

@private Determines if the Operation has any data.

# File lib/google/cloud/logging/entry/operation.rb, line 56
def empty?
  id.nil? &&
    producer.nil? &&
    first.nil? &&
    last.nil?
end
to_grpc() click to toggle source

@private Exports the Operation to a Google::Cloud::Logging::V2::LogEntryOperation object.

# File lib/google/cloud/logging/entry/operation.rb, line 66
def to_grpc
  return nil if empty?
  Google::Cloud::Logging::V2::LogEntryOperation.new(
    id:       id.to_s,
    producer: producer.to_s,
    first:    !(!first),
    last:     !(!last)
  )
end