Table of contents
1.
Introduction
2.
Inventory endpoints
3.
GET /inventory
3.1.
Request format
3.2.
Response format
3.3.
Error responses
4.
GET /inventory/<node>
4.1.
Request format
4.2.
Response format
4.3.
Error responses
5.
POST /inventory
5.1.
Request format
5.2.
Response format
5.3.
Error responses
6.
Frequently Asked Questions
6.1.
What purpose serves the puppet?
6.2.
What is the most fundamental puppet modeling unit?
6.3.
What are the functions of a puppet?
6.4.
What does a puppet node mean?
7.
Conclusion
Last Updated: Mar 27, 2024
Medium

Basics of Orchestration API V1 in Puppet - Part 2

Author SHIVANGI MALL
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Application integration into a single product is done through API orchestration. API orchestration often entails developing a single API that provides useful capabilities to its users, frequently by making numerous calls to various services to address a single API request. In this article, we will be learning about the Basics of Orchestration API V1 in Puppet.

Basics of Orchestration API V1 in Puppet - Part 2

Inventory endpoints

To determine whether the orchestrator can connect to a node, use the inventory endpoints.
 

These endpoints are based on nodes that are linked to the PCP broker, a component of the Puppet orchestrator architecture.

GET /inventory

Get a list of all the Puppet Communications Protocol (PCP) broker's connected nodes.

Request format

This endpoint receives simple calls from the Forming orchestrator API, like:
 

GET https://orchestrator.example.com:8143/orchestrator/v1/inventory

There are no parameters supported by the GET /inventory endpoint, however, you still need to give authentication like with other orchestrator API endpoints.

Response format

A JSON object with an array of nodes is the sign of an appropriate response. The following keys are used in response to give details about each node's PCP broker connection:

Response format

This response, for instance, offers information about three nodes, one of which is now disconnected:

{
  "items" : [
    {
      "name" : "node1.example.com",
      "connected" : true,
      "broker" : "pcp://broker1.example.com/server",
      "timestamp": "2016-010-22T13:36:41.449Z"
    },
    {
      "name" : "node2.example.com",
      "connected" : true,
      "broker" : "pcp://broker2.example.com/server",
      "timestamp" : "2016-010-22T13:39:16.377Z"
    },
    {
      "name" : "node3.example.com",
      "connected" : false
    }
  ]
}

Error responses

The error answers for this endpoint use the standard format for Orchestrator API error responses. If the PCP broker cannot be contacted, the endpoint responds with a 500 error code.

GET /inventory/<node>

Obtain details regarding a certain node's association with the Puppet Communications Protocol (PCP) broker.

Request format

The URI path for Forming orchestrator API calls to this endpoint must contain a particular node name, such as:

GET "https://orchestrator.example.com:8143/orchestrator/v1/inventory/<NODE_NAME>"

 

The GET /inventory endpoint lets you query every node, even if you don't know its name. Use POST /inventory to query numerous particular nodes at once.

There are no additional parameters supported for the GET /inventory/node> endpoint, but you must still provide authentication as with other orchestrator API endpoints.

Response format

A JSON object using these keys to offer details on the specified node's PCP broker connection is a sign of a successful response:

Response format

For example:

{
  "name" : "node1.example.com",
  "connected" : true,
  "broker" : "pcp://broker.example.com/server",
  "timestamp" : "2017-03-29T21:48:09.633Z"
}

Error responses

The error answers for this endpoint use the standard format for Orchestrator API error responses. If the PCP broker cannot be contacted, the endpoint responds with a 500 error code.

POST /inventory

returns details regarding connections made by various nodes to the Puppet Communications Protocol (PCP) broker.

Request format

 

The content type of requests made to this endpoint using the Forming orchestrator API is application/json. The body must contain a JSON object with an array of node names, like:

{
  "nodes" : [
    "node1.example.com",
    "node2.example.com",
    "node3.example.com"
  ]
}

Using this body, a complete curl request may look like this:
 

type_header='Content-Type: application/json'
auth_header="X-Authentication: $(puppet-access show)"
uri="https://$(puppet config print server):8143/orchestrator/v1/inventory"
data='{"nodes" : [ "node1.example.com", "node2.example.com", "node3.example.com"]}'

curl --insecure --header "$type_header" --header "$auth_header" --request POST "$uri" --data "$data"

Response format

A JSON object using these keys to convey details about each node's PCP broker connection constitutes a successful response:

Response format

This is an answer to a question about three particular nodes, for instance:

{
  "items" : [
    {
      "name" : "node1.example.com",
      "connected" : true,
      "broker" : "pcp://broker.example.com/server",
      "timestamp" : "2017-07-14T15:57:33.640Z"
    },
    {
      "name" : "node2.example.com",
      "connected" : false
    },
    {
      "name" : "node3.example.com",
      "connected" : true,
      "broker" : "pcp://broker.example.com/server",
      "timestamp" : "2017-07-14T15:41:19.242Z"
    }
  ]
}

Error responses

The error answers for this endpoint use the standard format for Orchestrator API error responses. If the PCP broker cannot be contacted, the endpoint responds with a 500 error code.

Frequently Asked Questions

What purpose serves the puppet?

An open-source tool for managing and deploying software configuration is called Puppet. The most popular operating systems for controlling numerous application servers at once are Linux and Windows.

What is the most fundamental puppet modeling unit?

Resources serve as the fundamental building block for modeling system setups.

What are the functions of a puppet?

Infrastructure automation, automated provisioning, task management, code management, visualization, and reporting are just a few of Puppet's features.

What does a puppet node mean?

A section of Puppet code known as a node definition, also called a node statement, is only present in the catalogs of matching nodes.

Conclusion

We have extensively discussed the basics of Orchestration API V1 in Puppet in this article. We hope this blog has helped you enhance your knowledge. If you would like to learn more. Check out our articles on Advanced Guides in Katalon. Practice makes a man perfect. To practice and improve yourself in the interview. You can check out the Top 100 SQL problems and Interview experienceCoding interview questions and the Ultimate guide path for interviews.

ThankYou

 

Live masterclass