Status
public struct Status: Equatable
Struct that encapsulates the status of an application.
-
The date formatter used by the
Status
struct.Declaration
Swift
public static let dateFormatter = StatusDateFormatter()
-
The date format used by the timestamp value in the dictionary.
Declaration
Swift
public static var dateFormat: String
-
The state value contained within this struct.
Declaration
Swift
public let state: State
-
List of details describing any failures.
Declaration
Swift
public let details: [String]
-
The timestamp value in milliseconds for the status.
Declaration
Swift
public var tsInMillis: UInt64
-
The string timestamp value for the status.
Declaration
Swift
public let timestamp: String
-
Declaration
Swift
public static func ==(lhs: Status, rhs: Status) -> Bool
-
Initializes the
Status
struct, which encapsulates the status of an application.Declaration
Swift
public init(state: State = State.UP, details: [String] = [], timestamp: String = dateFormatter.string(from: Date()))
Parameters
state
Optional. The state value for this Status instance (default value is ‘UP’).
details
Optional. A list of strings that describes any issues that may have occurred while executing a health check.
timestamp
Optional. The string timestamp value for the status (default value is current time).
-
Returns a dictionary that contains the current status information. This dictionary contains three key-pair values, where the keys are ‘status’, ‘timestamp’, and ‘details’.
Declaration
Swift
public func toDictionary() -> [String : Any]
-
Returns a simple dictionary that contains the current status information. This dictionary contains one key-pair value, where the key is ‘status’ and the value is either ‘UP’ or ‘DOWN’.
Declaration
Swift
public func toSimpleDictionary() -> [String : Any]
-
Declaration
Swift
public func encode(to encoder: Encoder) throws
-
Declaration
Swift
public init(from decoder: Decoder) throws