AEM as Cloud Service Cloud Manager API, IO Events, CLI Tools

AEM as Cloud Service provides Cloud Manager API which allows access Cloud Manager related activities, Adobe IO Events which can be used to handle event-driven scenarios & CLI tools. All these tools are very useful for automation process.

 

Adobe IO Events

In AEM as Cloud Service terms, Adobe IO Events enables building reactive, event-driven applications, based on events originating from Adobe Experience Manager. Events are triggered by Event Provider. To start listening to events, register application, specify Event Types from which Event Providers it want to receive. Whenever a matching event is triggered, application is notified.

Adobe IO Events can be integrated using

1.     Adobe IO Events API

2.     Adobe IO Events CLI

3.     Adobe IO Events SDK

This documentation has instructions to set up IO Events Integrations with AEM as Cloud Service. To learn more about Adobe IO Events, go through links provided in References section.

 

Cloud Manager API

This API allows access to Cloud Manager programs, environments & pipelines by an authorized account through Adobe IO console. The base url for this API is https://cloudmanager.adobe.io/ .

Use Cases

There are variety of use cases, some of the basic use cases listed below.

·       Starting Cloud Manager CI/CD pipeline from external system.

·       Execute additional tests before production deployments.

·       Triggering additional activities after the pipeline execution.

o   CDN cache invalidation once the production deployment is completed.

o   Notifying on other channels.

o   Notifying events on Activation/Deactivation of Pages.

o   Creating issue report on bug tracking system.

 

Basic Setup

There are set of steps needs to be followed to setup Adobe IO with Cloud Manager API. For more details about sample project visit links provided in References section.

1.     Webhook Setup – A webhook (a web callback or HTTP push API) is a way for an app to provide other applications with real-time information.

·       A webhook needs to be written which acts as event handler & is compatible with Adobe IO Events.

·       To use webhook with Adobe IO, it must be accessible to the public internet. ngrok is the tool is used for this purpose.

·       Once webhook is available & running at a publicly accessible URL, it can be registered with Adobe IO. To do this

Go to Adobe IO Console à Create/Open Project à Click Add to Project & Select Event à Select Cloud Manager à Click Next à Select Event Types (For which events to be emitted)

2.     Webhook Signature Validation – The webhook setup in the 1st step will be enhanced to validate the POST requests coming from Adobe IO.

·       POST requests to the webhook are signed using SHA256 stored in the x-adobe-signature header.

3.     Handling Events – Webhooks can be registered for one or more events. These events can be identified using the combination of @type & xdmEventEnvelope:objectType values.

4.     Obtain Access Token – webhook need to call the Cloud Manager API to get additional information.

·       API calls should be made by obtaining an access token which will be passed to the API for the purpose of authentication.

·       The webhook will create a signed JWT token & then exchange that with IMS for an access token.

·       The JWT is created, signed & exchanged using

                                                    i.     API_KEY

                                                   ii.     CLIENT_SECRET

                                                 iii.     ORGANIZATION_ID

                                                 iv.     TECHNICAL_ACCOUNT_ID &

                                                   v.     PRIVATE_KEY

5.     Getting Execution – Making an API call to Cloud Manager requires several headers to be passed. The function then returns the response body as a JavaScript Object. The request headers as below.

·       x-gw-ims-org-id – The organization ID (ORGANIZATION_ID)

·       x-api-key – The API key (API_KEY)

·       Authorization – contains the access token.

6.     Getting Programs – If program name needs to be sent as notification in this exercise then to get the program data based on the execution, get the link to the program from the execution response.

7.     Sending Notifications – Once the data received notification can be send to channel.

 

CLI Tools

A command-line interface (CLI) process command. Knowing CLI commands can be very useful for various approaches to automate the process. Adobe are providing different CLI tools for AEM as Cloud Service which are as below.

Setup Adobe IO CLI

The Adobe IO CLI or aio, provides command line access to a variety of Adobe Services. It plays an important role in development of AEM as Cloud Services as it provides capability to

·       Tail logs from AEM as Cloud Services.

·       Manage Cloud Manager pipelines from the CLI.

Prerequisites for Installation of Adobe IO CLI

1.     Ensure Node.js is installed as the Adobe I/O CLI is an npm module.

a.     Run node --version to confirm

2.     Execute npm install -g @adobe/aio-cli to install the aio npm module globally

Git URL - https://github.com/adobe/aio-cli

 

Adobe IO CLI Cloud Manager Plugin

In addition to direct HTTP usage of the Cloud Manager API, there are open source libraries & tools built on top of the API. They are as below.

CLI

It is a plugin which allows accessing Cloud Manager programs, environments & pipelines through aio CLI using aio cloudmanager command. In order for the Adobe IO CLI to communicate with Cloud Manager integration must be created with Adobe IO Console as explained in below URL.

Git URL - https://github.com/adobe/aio-cli-plugin-cloudmanager

 

Java SDK

It provides a Java Interface on top of the Cloud Manager API and enables integration in JVM-based applications.

      CloudManagerApi api = new CloudManagerApiImpl("orgId", "x-api-key", "valid auth token");

      List<EmbeddedProgram> client.listPrograms(); 

Git URL - https://github.com/adobe/aio-lib-java-cloudmanager

 

Adobe IO CLI Asset Compute Plugin

The Adobe IO Cloud Manager Plugin allows the aio CLI to generate & run Asset Compute workers via the aio asset-compute command.

Git URL - https://github.com/adobe/aio-cli-plugin-asset-compute

 

Adobe IO Events

As stated above, Adobe IO Events enables building reactive & event-driven applications based on events originating from AEM as Cloud Service.

Git URL - https://github.com/AdobeDocs/adobeio-events

 

AEM Cloud Service Migration CLI

This is AEM as Cloud Service Refactoring Plugin for the Adobe IO CLI. This tool unifies the code refactoring tools which refactor customers code, repository structure and configurations on user’s local machine. Below are the different refactoring tools available.

1.     Dispatcher Tool Converter

2.     Repository Modernizer Tool

3.     Index Converter Tool

Git URLs

·       https://github.com/adobe/aio-cli-plugin-aem-cloud-service-migration

·       https://github.com/adobe/aem-cloud-service-source-migration

 

 

References

Adobe IO Events

·       https://www.adobe.io/apis/experienceplatform/events/docs.html

·       https://www.adobe.io/apis/experienceplatform/events/ioeventsapi.html#!adobedocs/adobeio-events/master/events-api-reference.yaml

 

Cloud Manager API

·       https://www.adobe.io/apis/experiencecloud/cloud-manager/docs.html

·       https://www.adobe.io/apis/experiencecloud/cloud-manager/api-reference.html#!AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml

 

 

Comments

Popular posts from this blog

AEM as Cloud Service Project Structure - 1

AEM as Cloud Service Project Structure – 2

AEM as Cloud Service Assets Service