Class: Cerbos::Output::ServerInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/cerbos/output/server_info.rb

Overview

Information about the Cerbos policy decision point (PDP) server.

Instance Attribute Summary collapse

Instance Attribute Details

#built_atTime? (readonly)

The time at which the PDP server binary was built.

Returns:

  • (Time)
  • (nil)

    if running a custom build of the PDP server that does not report its build time in ISO 8601 format.



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
# File 'lib/cerbos/output/server_info.rb', line 6

ServerInfo = Output.new_class(:built_at, :commit, :version) do
  # @!attribute [r] built_at
  #   The time at which the PDP server binary was built.
  #
  #   @return [Time]
  #   @return [nil] if running a custom build of the PDP server that does not report its build time in ISO 8601 format.

  # @!attribute [r] commit
  #   The commit SHA from which the PDP server binary was built.
  #
  #   @return [String]

  # @!attribute [r] version
  #   The version of the PDP server.
  #
  #   @return [String]

  def self.from_protobuf(server_info)
    built_at = begin
      Time.iso8601(server_info.build_date)
    rescue ArgumentError
      nil
    end

    new(
      built_at: built_at,
      commit: server_info.commit,
      version: server_info.version
    )
  end
end

#commitString (readonly)

The commit SHA from which the PDP server binary was built.

Returns:

  • (String)


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
# File 'lib/cerbos/output/server_info.rb', line 6

ServerInfo = Output.new_class(:built_at, :commit, :version) do
  # @!attribute [r] built_at
  #   The time at which the PDP server binary was built.
  #
  #   @return [Time]
  #   @return [nil] if running a custom build of the PDP server that does not report its build time in ISO 8601 format.

  # @!attribute [r] commit
  #   The commit SHA from which the PDP server binary was built.
  #
  #   @return [String]

  # @!attribute [r] version
  #   The version of the PDP server.
  #
  #   @return [String]

  def self.from_protobuf(server_info)
    built_at = begin
      Time.iso8601(server_info.build_date)
    rescue ArgumentError
      nil
    end

    new(
      built_at: built_at,
      commit: server_info.commit,
      version: server_info.version
    )
  end
end

#versionString (readonly)

The version of the PDP server.

Returns:

  • (String)


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
# File 'lib/cerbos/output/server_info.rb', line 6

ServerInfo = Output.new_class(:built_at, :commit, :version) do
  # @!attribute [r] built_at
  #   The time at which the PDP server binary was built.
  #
  #   @return [Time]
  #   @return [nil] if running a custom build of the PDP server that does not report its build time in ISO 8601 format.

  # @!attribute [r] commit
  #   The commit SHA from which the PDP server binary was built.
  #
  #   @return [String]

  # @!attribute [r] version
  #   The version of the PDP server.
  #
  #   @return [String]

  def self.from_protobuf(server_info)
    built_at = begin
      Time.iso8601(server_info.build_date)
    rescue ArgumentError
      nil
    end

    new(
      built_at: built_at,
      commit: server_info.commit,
      version: server_info.version
    )
  end
end