// tslint:disable /** * Copyright 2022 Splunk, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"): you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * * Action Service * With the Splunk Cloud Action service, you can receive incoming trigger events and use pre-defined action templates to turn these events into meaningful actions. * * OpenAPI spec version: v2alpha1.12 * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { Action, ActionMutable, PublicWebhookKey, ServiceError, } from '../models'; import BaseApiService from "../../../../baseapiservice"; import { ActionServiceExtensions } from "../../../../service_extensions/action"; import { SplunkError, RequestStatus } from '../../../../client'; export const ACTION_SERVICE_PREFIX: string = '/action/v2alpha1'; export const ACTION_SERVICE_CLUSTER: string = 'api'; /** * Action Service * Version: v2alpha1.12 * With the Splunk Cloud Action service, you can receive incoming trigger events and use pre-defined action templates to turn these events into meaningful actions. */ export class GeneratedActionService extends BaseApiService { getServiceCluster() : string { return ACTION_SERVICE_CLUSTER } getServicePrefix() : string { return ACTION_SERVICE_PREFIX; } /** * Creates an action template. * @param action The action template to create. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Action */ public createAction = (action: Action, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path = `/action/v2alpha1/actions`; return this.client.post(ACTION_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), action, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Action); } /** * Removes an action template. * @param actionName The name of the action as one or more identifier strings separated by periods. Each identifier string consists of lowercase letters, digits, and underscores, and cannot start with a digit. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public deleteAction = (actionName: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { action_name: actionName }; const path = this.template`/action/v2alpha1/actions/${'action_name'}`(path_params); return this.client.delete(ACTION_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Returns a specific action template. * @param actionName The name of the action as one or more identifier strings separated by periods. Each identifier string consists of lowercase letters, digits, and underscores, and cannot start with a digit. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Action */ public getAction = (actionName: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { action_name: actionName }; const path = this.template`/action/v2alpha1/actions/${'action_name'}`(path_params); return this.client.get(ACTION_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Action); } /** * Get the current webhook key(s). If multiple keys were returned, one is active and one is expired. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public getPublicWebhookKeys = (args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path = `/system/action/v2alpha1/webhook/keys`; return this.client.get(ACTION_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Returns the list of action templates. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public listActions = (args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path = `/action/v2alpha1/actions`; return this.client.get(ACTION_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Modifies an action template. * @param actionName The name of the action as one or more identifier strings separated by periods. Each identifier string consists of lowercase letters, digits, and underscores, and cannot start with a digit. * @param actionMutable Updates to the action template. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Action */ public updateAction = (actionName: string, actionMutable: ActionMutable, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { action_name: actionName }; const path = this.template`/action/v2alpha1/actions/${'action_name'}`(path_params); return this.client.patch(ACTION_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), actionMutable, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Action); } } export type ActionService = GeneratedActionService & ActionServiceExtensions; export const ActionService = ActionServiceExtensions(GeneratedActionService);