Module: Smplkit::Logging::Helpers Private

Defined in:
lib/smplkit/logging/helpers.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Resource-to-model conversion helpers for the logging wrapper.

Class Method Summary collapse

Class Method Details

.log_group_resource_to_model(client, resource) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/smplkit/logging/helpers.rb', line 30

def log_group_resource_to_model(client, resource)
  attrs = resource["attributes"] || {}
  SmplLogGroup.new(
    client,
    id: resource["id"] || attrs["id"],
    key: attrs["key"] || resource["id"],
    name: attrs["name"],
    level: attrs["level"] && LogLevel.coerce(attrs["level"]),
    description: attrs["description"],
    group: attrs["parent_id"],
    environments: attrs["environments"] || {},
    created_at: attrs["created_at"],
    updated_at: attrs["updated_at"]
  )
end

.logger_resource_to_model(client, resource) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/smplkit/logging/helpers.rb', line 11

def logger_resource_to_model(client, resource)
  attrs = resource["attributes"] || {}
  SmplLogger.new(
    client,
    id: resource["id"] || attrs["id"],
    name: attrs["name"],
    resolved_level: attrs["resolved_level"] && LogLevel.coerce(attrs["resolved_level"]),
    level: attrs["level"] && LogLevel.coerce(attrs["level"]),
    service: attrs["service"],
    environment: attrs["environment"],
    log_group_id: attrs["log_group_id"],
    managed: attrs.fetch("managed", true),
    description: attrs["description"],
    environments: attrs["environments"],
    created_at: attrs["created_at"],
    updated_at: attrs["updated_at"]
  )
end