// 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. * * App Registry * With the App Registry service in Splunk Cloud Services, you can create, update, and manage your apps. * * OpenAPI spec version: v1beta2.0 (recommended default) * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { AppName, AppResourceKind, AppResponseCreateUpdate, AppResponseGetList, CreateAppRequest, Key, Subscription, UpdateAppRequest, } from '../models'; import BaseApiService from "../../../../baseapiservice"; import { AppRegistryServiceExtensions } from "../../../../service_extensions/app-registry"; import { SplunkError, RequestStatus } from '../../../../client'; export const APPREGISTRY_SERVICE_PREFIX: string = '/app-registry/v1beta2'; export const APPREGISTRY_SERVICE_CLUSTER: string = 'api'; /** * App Registry * Version: v1beta2.0 * With the App Registry service in Splunk Cloud Services, you can create, update, and manage your apps. */ export class GeneratedAppRegistryService extends BaseApiService { getServiceCluster() : string { return APPREGISTRY_SERVICE_CLUSTER } getServicePrefix() : string { return APPREGISTRY_SERVICE_PREFIX; } /** * Creates an app. * @param createAppRequest Creates a new app. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return AppResponseCreateUpdate */ public createApp = (createAppRequest: CreateAppRequest, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path = `/app-registry/v1beta2/apps`; return this.client.post(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), createAppRequest, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as AppResponseCreateUpdate); } /** * Creates a subscription. * @param appName Creates a subscription between a tenant and an app. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public createSubscription = (appName: AppName, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path = `/app-registry/v1beta2/subscriptions`; return this.client.post(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), appName, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Removes an app. * @param appName App name. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public deleteApp = (appName: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { appName: appName }; const path = this.template`/app-registry/v1beta2/apps/${'appName'}`(path_params); return this.client.delete(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Removes a subscription. * @param appName App name. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request */ public deleteSubscription = (appName: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { appName: appName }; const path = this.template`/app-registry/v1beta2/subscriptions/${'appName'}`(path_params); return this.client.delete(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as object); } /** * Returns the metadata of an app. * @param appName App name. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return AppResponseGetList */ public getApp = (appName: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { appName: appName }; const path = this.template`/app-registry/v1beta2/apps/${'appName'}`(path_params); return this.client.get(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as AppResponseGetList); } /** * Returns a list of the public keys used for verifying signed webhook requests. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public getKeys = (args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path = `/system/app-registry/v1beta2/keys`; return this.client.get(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Returns or validates a subscription. * @param appName App name. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Subscription */ public getSubscription = (appName: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { appName: appName }; const path = this.template`/app-registry/v1beta2/subscriptions/${'appName'}`(path_params); return this.client.get(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Subscription); } /** * Returns the collection of subscriptions to an app. * @param appName App name. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public listAppSubscriptions = (appName: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path_params = { appName: appName }; const path = this.template`/app-registry/v1beta2/apps/${'appName'}/subscriptions`(path_params); return this.client.get(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Returns a list of apps. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public listApps = (args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path = `/app-registry/v1beta2/apps`; return this.client.get(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Returns the tenant subscriptions. * @param args parameters to be sent with the request * @param args.kind The kind of application. * @param requestStatusCallback callback function to listen to the status of a request * @return Array */ public listSubscriptions = (args?: { kind?: AppResourceKind, [key: string]: any }, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise> => { const path = `/app-registry/v1beta2/subscriptions`; return this.client.get(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as Array); } /** * Rotates the client secret for an app. * @param appName App name. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return AppResponseCreateUpdate */ public rotateSecret = (appName: string, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { appName: appName }; const path = this.template`/app-registry/v1beta2/apps/${'appName'}/rotate-secret`(path_params); return this.client.post(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as AppResponseCreateUpdate); } /** * Updates an app. * @param appName App name. * @param updateAppRequest Updates app contents. * @param args parameters to be sent with the request * @param requestStatusCallback callback function to listen to the status of a request * @return AppResponseCreateUpdate */ public updateApp = (appName: string, updateAppRequest: UpdateAppRequest, args?: object, requestStatusCallback?: (requestStatus: RequestStatus) => void): Promise => { const path_params = { appName: appName }; const path = this.template`/app-registry/v1beta2/apps/${'appName'}`(path_params); return this.client.put(APPREGISTRY_SERVICE_CLUSTER, this.client.buildPath('', path.split('/').slice(1)), updateAppRequest, { query: args, statusCallback: requestStatusCallback}) .then(response => response.body as AppResponseCreateUpdate); } } export type AppRegistryService = GeneratedAppRegistryService & AppRegistryServiceExtensions; export const AppRegistryService = AppRegistryServiceExtensions(GeneratedAppRegistryService);