Class: PEClient::Resource::PuppetDB::AdminV1

Inherits:
Base
  • Object
show all
Defined in:
lib/pe_client/resources/puppet_db/admin.v1.rb,
lib/pe_client/resources/puppet_db/admin.v1/archive.rb

Overview

PuppetDB’s administration API endpoints can be used for importing and exporting PuppetDB archives, triggering PuppetDB maintenance operations or to directly deleting a node, and generating information about the way your PuppetDB installation is using postgres.

Defined Under Namespace

Classes: Archive

Constant Summary collapse

BASE_PATH =

The base path for PuppetDB Admin v1 endpoints.

"#{PuppetDB::BASE_PATH}/admin/v1".freeze

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#archivePEClient::Resource::PuppetDB::AdminV1::Archive



62
63
64
65
# File 'lib/pe_client/resources/puppet_db/admin.v1.rb', line 62

def archive
  require_relative "admin.v1/archive"
  @archive ||= AdminV1::Archive.new(@client)
end

#cmd(command:, version:, payload:) ⇒ Hash

The cmd endpoint can be used to trigger PuppetDB maintenance operations or to directly delete a node. Admin commands are processed synchronously separate from other PuppetDB commands.

Parameters:

  • command (String)

    Identifying the command.

  • version (Integer)

    Describing what version of the given command you’re attempting to invoke. The version of the command also indicates the version of the wire format to use for the command.

  • payload (Object)

    Must be a valid JSON object of any kind. It’s up to an individual handler function to determine how to interpret this object.

Returns:

  • (Hash)

See Also:



43
44
45
# File 'lib/pe_client/resources/puppet_db/admin.v1.rb', line 43

def cmd(command:, version:, payload:)
  @client.post "#{BASE_PATH}/cmd", body: {command:, version:, payload:}
end

#summary_statsHash

Note:

This endpoint will execute a number of relatively expensive SQL commands against your database. It will not meaningfully impede performance of a running PuppetDB instance, but the request may take several minutes to complete.

The summary-stats endpoint is used to generate information about the way your PuppetDB installation is using postgres. Its intended purpose at this time is to aid in diagnosis of support issues, though users may find it independently useful.



57
58
59
# File 'lib/pe_client/resources/puppet_db/admin.v1.rb', line 57

def summary_stats
  @client.get "#{BASE_PATH}/summary-stats"
end