Class: PEClient::Resource::NodeClassifierV1::ImportHierarchy

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

Overview

Use the import hierarchy endpoint to delete all existing node groups from the node classifier service and replace them with the node groups defined in the body of the request.

Constant Summary collapse

BASE_PATH =

The base path for Node Classifier API v1 import hierarchy endpoints.

"#{NodeClassifierV1::BASE_PATH}/import-hierarchy".freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

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

Delete all existing node groups from the node classifier service and replace them with the node groups defined in the body of the submitted request.

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].

  • config_data (Hash{Symbol, String => Any})

    An object that defines the class parameters to be used by nodes in the group. Its structure is the same as the classes object. No configuration data is stored if you supply a config_data object that only contains a class name, such as config_data: => {}.

  • 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)

    If the request is successful, the response body is empty.



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

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