Class: PEClient::Resource::NodeInventoryV1

Inherits:
BaseWithPort show all
Defined in:
lib/pe_client/resources/node_inventory.v1.rb

Overview

Puppet Enterprise Node inventory API v1

Constant Summary collapse

BASE_PATH =

Base path for the Node Inventory API v1

"/inventory/v1"
PORT =

Default Node Inventory API Port

8143

Instance Method Summary collapse

Methods inherited from BaseWithPort

#initialize

Constructor Details

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

Instance Method Details

#connections(certnames: [], sensitive: false, extract: []) ⇒ Hash

List all the connections entries in the inventory database or request information about a specific connection.

Parameters:

  • certnames (Array<String>) (defaults to: [])

    An array containing a list of certnames to retrieve from the inventory service database. If omitted, then all connections are returned.

  • sensitive (Boolean) (defaults to: false)

    Indicating whether you want the response to include sensitive connection parameters. This parameter has a permission gate, and it doesn’t work if you don’t have the proper permissions.

  • extract (Array<String>) (defaults to: [])

    Array of keys indicating the information you want the response to include. The connection_id key is always returned, and you can use extract to limit the remaining keys. For example, extract=[“type”] limits the response to connection_id and type.

Returns:

  • (Hash)

See Also:



44
45
46
47
48
49
50
# File 'lib/pe_client/resources/node_inventory.v1.rb', line 44

def connections(certnames: [], sensitive: false, extract: [])
  body = {}
  body[:certnames] = certnames unless certnames.empty?
  body[:sensitive] = sensitive if sensitive
  body[:extract] = extract unless extract.empty?
  @client.post "#{BASE_PATH}/query/connections", body:
end

#create_connections(certnames:, type:, parameters: {}, sensitive_parameters: {}, duplicates: "error") ⇒ Hash

Create a new connection entry in the node inventory service database.

Parameters:

  • certnames (Array<String>)

    An array containing a list of certnames to associate with the supplied connection details.

  • type (String)

    A string that is either “ssh” or “winrm”. This tells bolt-server which connection type to use to access the node when running a task.

  • parameters (Hash) (defaults to: {})

    Specifying the connection parameters for the specified transport type.

  • sensitive_parameters (Hash) (defaults to: {})

    Defining the necessary sensitive data for connecting to the provided certnames, such as usernames and passwords. These values are stored in an encrypted format.

  • duplicates (String) (defaults to: "error")

    A string that is either error or replace. This specifies how to handle cases where supplied certnames conflict with existing certnames stored in the node inventory connections database. If you specify error, the endpoint returns a 409 response if it finds any duplicate certnames. If you specify replace, the endpoint overwrites the existing certname with the new connection details if it finds a duplicate.

Returns:

  • (Hash)

See Also:



68
69
70
# File 'lib/pe_client/resources/node_inventory.v1.rb', line 68

def create_connections(certnames:, type:, parameters: {}, sensitive_parameters: {}, duplicates: "error")
  @client.post "#{BASE_PATH}/command/create-connection", body: {certnames:, type:, parameters:, sensitive_parameters:, duplicates:}
end

#delete_connections(certnames) ⇒ Hash

Remove specified certnames from all associated connection entries in the inventory service database. In PuppetDB, removed certnames are replaced with preserve: false.

Parameters:

  • certnames (Array<String>)

    An array containing a list of certnames to remove from the inventory service database.

Returns:

  • (Hash)

    If the request is well-formed, valid, and processed successfully, the service returns with an empty body.



78
79
80
# File 'lib/pe_client/resources/node_inventory.v1.rb', line 78

def delete_connections(certnames)
  @client.post "#{BASE_PATH}/command/delete-connection", body: {certnames:}
end