1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
# frozen_string_literal: true
module Aws
module Telemetry
# Represents the status of a finished span.
class SpanStatus
class << self
private :new
# Returns a newly created {SpanStatus} with code, `UNSET`
# and an optional description.
#
# @param [optional String] description
# @return [SpanStatus]
def unset(description = '')
new(UNSET, description: description)
end
# Returns a newly created {SpanStatus} with code, `OK`
# and an optional description.
#
# @param [optional String] description
# @return [SpanStatus]
def ok(description = '')
new(OK, description: description)
end
# Returns a newly created {SpanStatus} with code, `ERROR`
# and an optional description.
#
# @param [optional String] description
# @return [SpanStatus]
def error(description = '')
new(ERROR, description: description)
end
end
def initialize(code, description: '')
@code = code
@description = description
end
# @return [Integer] code
attr_reader :code
# @return [String] description
attr_reader :description
# The operation completed successfully.
OK = 0
# The default status.
UNSET = 1
# An error.
ERROR = 2
end
end
end
|