Table of contents
1.
Introduction
2.
Puppet
3.
Activity Service API
4.
About Activity Service API in Puppet
4.1.
Forming Activity Service API Requests
4.1.1.
Verification Utilizing Tokens
4.1.2.
Confirming Utilizing a Permitted Authentication
4.2.
Event Types Reported by Activity Service
4.2.1.
Roles
4.3.
Event Endpoints
4.3.1.
GET/v1/events
5.
Frequently Asked Questions
5.1.
What are the fundamental contrasts between API and web service?
5.2.
What is an endpoint in API?
5.3.
What are different kinds of APIs?
5.4.
What is Puppet API?
5.5.
Is Puppet only for Linux?
6.
Conclusion
Last Updated: Mar 27, 2024
Medium

About Activity Service API in Puppet

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

Introduction

Hello Ninjas, Welcome back, Do you want to learn about Puppet and Activity service in API ? If yes, then you have knocked on the right door. In this article, you will learn about activity Service API in Puppet.

Introduction

Before moving to the ‘About Activity Service API in Puppet’, first, we'll understand what Puppet is and learn about Activity service API.

Puppet

An open-source system management tool called Puppet is used to automate and centralize configuration management. Configuration management involves meticulous logging and updating of data that specifies an organization's hardware and software.

Puppet

Puppet has two layers:-  

  • An abstraction layer that enables the administrator to implement the configuration on a range of platforms, including Unix, Linux, and Windows.
     
  •  Configuration language to specify how the hosts and services should look. Administrators can codify the configuration of service as a policy, which Puppet then monitors and enacts.

Activity Service API

It permits you to use services of a REST API over HTTP(s) convention facilitated at a given endpoint. You can characterize an API's activities using the HTTP strategies - Get, Post, Put and Erase. On the other hand, Puppet involves RESTful API as the correspondence channel between Puppet experts and specialists. 😉

Activity service API

About Activity Service API in Puppet

The action service logs changes to role-based admittance control (RBAC) elements, for example, clients, catalog, gatherings, and client roles.

About Activity service API in Puppet
  • Forming activity service API requests
    Token-based verification is expected to get to the action service API. You can confirm demands with client verification tokens or permitted declarations.
     
  • Event types reported by the activity service
    Movement reveals a valuable review trail to activities that change role-based admittance control (RBAC) elements, for example, clients, registry gatherings, and client roles.
     
  • Events endpoints
    Utilize the occasions endpoints to recover action service occasions.

Forming Activity Service API Requests

Token-based verification is expected to get to the action service API. You can verify demands with client verification tokens or permitted endorsements.

Naturally, the action service tunes in on port 4433. All endpoints are compared with the /activity-api/ way. This way, for instance, the full URL for the /v1/events endpoint on localhost is:- 

https://localhost:4433/activity-api/v1/events


Verification Utilizing Tokens

Embed a client verification token variable in an action service API demand.

  1. Create a token: puppet-access login.
  2. Use puppet-access show to populate a validation header and utilize that header in your API demand.
     
puppet-access login

auth_header="X-Authentication: $(puppet-access show)"
uri="https://$(puppet config print server):4433/activity-api/v1/events?service_id=classifier"

curl --insecure --header "$auth_header" "$uri"


Confirming Utilizing a Permitted Authentication

You can likewise confirm demands utilizing an endorsement recorded in RBAC's testament allowlist, situated at:-

/etc/puppetlabs/console-services/rbac-certificate-allowlist.


Assuming you alter this document, you should reload the pe-console-services service (run Sudo service pe-console-services reload) for your progressions to produce results. Append the authentication utilizing the order line, as shown below. You should have the permitted endorsement name, which should match a name in the file and the secret key to run the content.

/etc/puppetlabs/console-services/rbac-certificate-allowlist
 
type_header='Content-Type: application/json'
cert="$(puppet config print hostcert)"
cacert="$(puppet config print localcacert)"
key="$(puppet config print hostprivkey)"
uri="https://$(puppet config print server):4433/activity-api/v1/events?service_id=classifier"

curl --header "$type_header" --cert "$cert" --cacert "$cacert" --key "$key" "$uri"


You don't have to utilize a specialist testament for validation. You can utilize manikin cert produce to make another endorsement explicitly for use with the API.

Event Types Reported by Activity Service

Movement reveals a helpful review trail to activities that change role-based admittance control (RBAC) substances, for example, clients, registry gatherings, and client roles.
Local Events

 Local Events

Roles

These roles are shown in the control center on the Action tab for the impacted role.

Event with Description

Event Endpoints

Utilize the events endpoints to recover action administration events.

GET/v1/events

Brings action administration events. Web meeting confirmation is required.

Demand Design:

The /v1/events endpoint upholds separating through inquiry boundaries. 

Parameter and value
Parameter and value

Response Format:

Reactions are returned in an organized JSON design.

GET /v1/events?service_id=classifier&subject_type=users&subject_id=kai
{
  "commits": [
    {
      "object": {
        "id": "327dfrvft-dfgd45dhs-4dvdg67o",
        "name": "Default Node Group"
      },
      "subject": {
        "id": "rsfrsc312-464drs54o-ogs76s6o",
        "name": "Coding Ninjas"
      },
      "timestamp": "2019-10-24T06:00:00Z",
      "events": [
        {
          "message": "Create Node"
        },
        {
          "message": "Create Node Class"
        }
      ]
    }
  ],
  "total-rows": 1

}

Frequently Asked Questions

What are the fundamental contrasts between API and web service?

API is an interface that uncovers an application's information to outside programming, while web applications perform tasks similar to that of API but with stricter necessities.

What is an endpoint in API?

When an API connects with another framework, the touchpoints of this correspondence are viewed as endpoints. The endpoint can be considered as one finish of a correspondence channel.

What are different kinds of APIs?

If we talk about different kinds of APIs then there are majorly four kinds of web APIs: 

  • Open APIs,
  • Accomplice APIs, 
  • Inside APIs,
  • Composite APIs.

What is Puppet API?

Puppet involves RESTful API as the correspondence channel between both Puppet experts and Puppet specialists. That interface between the two is known as Puppet API.

Is Puppet only for Linux?

The puppet server part of the Puppet stage is accessible just for Linux. The puppet-specialist part is accessible autonomously for more than 30 stages and structures, including Windows and macOS.

Conclusion

In the following article, we have learned the importance about Activity Service API in Puppet. Puppet involves RESTful API's as the correspondence channel between both Puppet experts and Puppet specialists. We have also seen the subparts of the activity service in detail: Forming About Activity Service API in Puppet requests, Event types reported by the activity service, and Event Endpoints with respective design tables and codes.

You can learn more about Puppet from our different articles like:

  1. SAML Authentication in Puppet
  2. Managing Access in Puppet
  3. Accessing Console in Puppet
     

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in  Competitive ProgrammingJavaScriptSystem Design, and many more! If you want to test your competency in coding, you may check out the mock test series and participate in the contests hosted on Coding Ninjas Studio!  Nevertheless, you may consider our paid courses to give your career an edge over others!

Happy Learning!

Live masterclass