dt-app
Version:
The Dynatrace App Toolkit is a tool you can use from your command line to create, develop, and deploy apps on your Dynatrace environment.
22 lines (17 loc) • 790 B
text/typescript
import { userLogger } from '@dynatrace-sdk/automation-action-utils/actions';
import { appSettingsObjectsClient } from '@dynatrace-sdk/client-app-settings-v2';
export default async (payload) => {
if (!payload.name) {
throw new Error("Input field 'name' is missing.");
}
if (!payload.connectionId) {
throw new Error("Input field 'connectionId' is missing.");
}
// Retrieves the app settings object associated with the given objectId.
// Its values can be later used to, for example, communicate with third party services.
const connectionObject = await appSettingsObjectsClient.getAppSettingsObjectByObjectId({
objectId: payload.connectionId,
});
userLogger.info(`Hello ${payload.name}! Have a great day!`);
return { message: `Hello ${payload.name}!`};
};