Class: PEClient::Resource::NodeClassifierV1::Classification

Inherits:
Base
  • Object
show all
Defined in:
lib/pe_client/resources/node_classifier.v1/classification.rb

Overview

The classification endpoints accepts a node name and a set of facts, and then return information about how the specified node is classified. The output can help you test your node group classification rules.

Constant Summary collapse

BASE_PATH =

The base path for Node Classifier API v1 groups endpoints.

"#{NodeClassifierV1::BASE_PATH}/classified/nodes".freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from PEClient::Resource::Base

Instance Method Details

#explanation(name, fact: {}, trusted: {}) ⇒ Hash

Retrieve a detailed explanation about how a node is classified based on facts supplied in the body of your request.

Parameters:

  • name (String)
  • fact (Hash{Symbol, String => Any}) (defaults to: {})

    Containing regular, non-trusted facts associated with the node. The object contains key/value pairs of fact names and fact values. Fact values can be strings, Integers, Booleans, Arrays, or Hashes.

  • trusted (Hash{Symbol, String => Any}) (defaults to: {})

    Containing trusted facts associated with the node. The object contains key/value pairs of fact names and fact values. Fact values can be Strings, Integers, Booleans, Arrays, or Hashes.

Returns:

  • (Hash)


56
57
58
# File 'lib/pe_client/resources/node_classifier.v1/classification.rb', line 56

def explanation(name, fact: {}, trusted: {})
  @client.post "#{BASE_PATH}/#{name}/explanation", body: {fact:, trusted:}.compact
end

#get(name, fact: nil, trusted: nil) ⇒ Hash

Retrieve a specific node’s classification information based on facts supplied in the body of your request.

Parameters:

  • name (String)
  • fact (Hash{Symbol, String => Any}) (defaults to: nil)

    Containing regular, non-trusted facts associated with the node. The object contains key/value pairs of fact names and fact values. Fact values can be strings, Integers, Booleans, Arrays, or Hashes.

  • trusted (Hash{Symbol, String => Any}) (defaults to: nil)

    Containing trusted facts associated with the node. The object contains key/value pairs of fact names and fact values. Fact values can be Strings, Integers, Booleans, Arrays, or Hashes.

Returns:

  • (Hash)


41
42
43
# File 'lib/pe_client/resources/node_classifier.v1/classification.rb', line 41

def get(name, fact: nil, trusted: nil)
  @client.post "#{BASE_PATH}/#{name}", body: {fact:, trusted:}.compact
end