Class: PEClient::Resource::OrchestratorV1

Inherits:
BaseWithPort show all
Defined in:
lib/pe_client/resources/orchestrator.v1.rb,
lib/pe_client/resources/orchestrator.v1/jobs.rb,
lib/pe_client/resources/orchestrator.v1/plans.rb,
lib/pe_client/resources/orchestrator.v1/tasks.rb,
lib/pe_client/resources/orchestrator.v1/scopes.rb,
lib/pe_client/resources/orchestrator.v1/command.rb,
lib/pe_client/resources/orchestrator.v1/inventory.rb,
lib/pe_client/resources/orchestrator.v1/plan_jobs.rb,
lib/pe_client/resources/orchestrator.v1/scheduled_jobs.rb

Overview

You can use the orchestrator API to run jobs and plans on demand; schedule tasks and plans; get information about jobs, plans, and events; track node usage; and more.

Defined Under Namespace

Classes: Command, Inventory, Jobs, PlanJobs, Plans, ScheduledJobs, Scopes, Tasks

Constant Summary collapse

BASE_PATH =

The base path for Orchestrator API v1 endpoints.

"/orchestrator/v1"
PORT =

Default Orchestrator 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

#commandPEClient::Resource::OrchestratorV1::Command



56
57
58
59
# File 'lib/pe_client/resources/orchestrator.v1.rb', line 56

def command
  require_relative "orchestrator.v1/command"
  @command ||= OrchestratorV1::Command.new(@client)
end

#getHash

Returns metadata about the orchestrator API, along with a list of links to application management resources.

Returns:

  • (Hash)


34
35
36
# File 'lib/pe_client/resources/orchestrator.v1.rb', line 34

def get
  @client.get BASE_PATH
end

#inventoryPEClient::Resource::OrchestratorV1::Inventory



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

def inventory
  require_relative "orchestrator.v1/inventory"
  @inventory ||= OrchestratorV1::Inventory.new(@client)
end

#jobsPEClient::Resource::OrchestratorV1::Jobs



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

def jobs
  require_relative "orchestrator.v1/jobs"
  @jobs ||= OrchestratorV1::Jobs.new(@client)
end

#plan_jobsPEClient::Resource::OrchestratorV1::PlanJobs



86
87
88
89
# File 'lib/pe_client/resources/orchestrator.v1.rb', line 86

def plan_jobs
  require_relative "orchestrator.v1/plan_jobs"
  @plan_jobs ||= OrchestratorV1::PlanJobs.new(@client)
end

#plansPEClient::Resource::OrchestratorV1::Plans



80
81
82
83
# File 'lib/pe_client/resources/orchestrator.v1.rb', line 80

def plans
  require_relative "orchestrator.v1/plans"
  @plans ||= OrchestratorV1::Plans.new(@client)
end

#scheduled_jobsPEClient::Resource::OrchestratorV1::ScheduledJobs



74
75
76
77
# File 'lib/pe_client/resources/orchestrator.v1.rb', line 74

def scheduled_jobs
  require_relative "orchestrator.v1/scheduled_jobs"
  @scheduled_jobs ||= OrchestratorV1::ScheduledJobs.new(@client)
end

#scopesPEClient::Resource::OrchestratorV1::Scopes



98
99
100
101
# File 'lib/pe_client/resources/orchestrator.v1.rb', line 98

def scopes
  require_relative "orchestrator.v1/scopes"
  @scopes ||= OrchestratorV1::Scopes.new(@client)
end

#tasksPEClient::Resource::OrchestratorV1::Tasks



92
93
94
95
# File 'lib/pe_client/resources/orchestrator.v1.rb', line 92

def tasks
  require_relative "orchestrator.v1/tasks"
  @tasks ||= OrchestratorV1::Tasks.new(@client)
end

#usage(start_date: nil, end_date: nil, events: nil) ⇒ Hash

Retrieves information about the orchestrator’s daily node usage, Puppet events activity on nodes, and nodes that are present in PuppetDB.

Parameters:

  • start_date (String) (defaults to: nil)

    Specify the earliest date to query, in YYYY-MM-DD format.

  • end_date (String) (defaults to: nil)

    Specify the latest date to query, in YYYY-MM-DD format. If you also specified start_date, the end_date must be greater than or equal to the start_date.

  • events (String) (defaults to: nil)

    Specifies whether you want the response to “include” or “exclude” daily Puppet events activity. The default is “include”. If set to “exclude”, the response only contains node counts (total nodes and the number of nodes with and without agents). Specifically, the response omits the number of corrective changes, the number of intentional changes, the number of task runs, and the number of plan runs.

Returns:

  • (Hash)

See Also:



51
52
53
# File 'lib/pe_client/resources/orchestrator.v1.rb', line 51

def usage(start_date: nil, end_date: nil, events: nil)
  @client.get "#{BASE_PATH}/usage", params: {start_date:, end_date:, events:}.compact
end