Class: PEClient::Resource::NodeClassifierV1::Validation

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

Overview

Use the validation endpoint to validate groups in the node classifier.

Constant Summary collapse

BASE_PATH =

The base path for Node Classifier API v1 validation endpoints.

"#{NodeClassifierV1::BASE_PATH}/validate".freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#group(name:, environment:, environment_trumps:, parent:, rule:, description: "", variables: {}, classes: {}) ⇒ Hash

Validate groups in the node classifier.

Parameters:

  • name (String)

    The name of the node group.

  • environment (String)

    The name of the node group’s environment, such as “production”.

  • environment_trumps (Boolean)

    When a node belongs to two or more groups, this Boolean indicates whether this node group’s environment overrides environments defined by other node groups.

  • parent (String)

    The ID of the node group’s parent.

  • rule (String)

    The condition that must be satisfied for a node to be classified into this node group. For rule formatting assistance, refer to (Forming node classifier API requests)[help.puppet.com/pe/current/topics/forming_node_classifier_requests.htm].

  • description (String) (defaults to: "")

    A string describing the node group.

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

    An object that defines the names and values of any top-level variables set by the node group. Supply key-value pairs of variable names and corresponding variable values. Variable values can be any type of JSON value. The variables object can be empty if the node group does not define any top-level variables.

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

    An object that defines the classes to be used by nodes in the node group. The classes object contains the parameters for each class. Some classes have required parameters. This object contains nested objects – The classes object’s keys are class names (as strings), and each key’s value is an object that defines class parameter names and their values. Within the nested objects, the keys are the parameter names (as strings), and each value is the parameter’s assigned value (which can be any type of JSON value). If no classes are declared, then classes must be supplied as an empty Hash.

Returns:

  • (Hash)


51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/pe_client/resources/node_classifier.v1/validation.rb', line 51

def group(name:, environment:, environment_trumps:, parent:, rule:, description: "", variables: {}, classes: {})
  @client.post "#{BASE_PATH}/group", body: {
    name:,
    environment:,
    environment_trumps:,
    parent:,
    rule:,
    description:,
    variables:,
    classes:
  }
end