import { ICreateServiceInstanceParams, IGetServiceInstanceParams, IResource, IServiceKeys, ServiceCredentials } from "../model/types.js"; export default class CFUtil { /** * Get or create service keys for service instance found by query * @static * @param {IGetServiceInstanceParams} getServiceInstanceParams query parameters to find a service instance by * @param {ICreateServiceInstanceParams} [createServiceInstanceParams] parameters to create a service instance * @return {Promise} promise with service keys * @memberof CFUtil */ static getServiceInstanceKeys(getServiceInstanceParams: IGetServiceInstanceParams, createServiceInstanceParams?: ICreateServiceInstanceParams): Promise; static createService(params: ICreateServiceInstanceParams): Promise; private static getOrCreateServiceKeys; private static getServiceKeys; private static createServiceKey; private static deleteServiceKeyUnsafe; private static getServiceInstance; static processCfErrors(errors?: ICfError[]): void; static requestCfApi(url: string): Promise; static getOAuthToken(): Promise; private static cfExecute; private static errorsToString; private static parseJson; /** * Get service keys and return the first one with valid endpoints * @private * @static * @param {string} serviceInstanceGuid the service instance guid * @return {Promise} the first service key with valid endpoints, or null if none found * @memberof CFUtil */ private static getServiceKeyWithValidEndpoints; /** * Get service keys for a service instance by name. If the existing service key * has endpoints as strings instead of objects, a new service key will be created. * @static * @param {string} serviceInstanceName name of the service instance * @param {string} [spaceGuid] optional space guid, will use current space if not provided * @return {Promise} promise with service key credentials * @memberof CFUtil */ static getOrCreateServiceKeyWithEndpoints(serviceInstanceName: string, spaceGuid?: string): Promise; /** * Check if endpoints object has at least one property that is an object * @private * @static * @param {any} endpoints the endpoints object to validate * @return {boolean} true if at least one property of endpoints is an object * @memberof CFUtil */ private static hasValidEndpoints; /** * Get all service key names for a service instance * @private * @static * @param {string} serviceInstanceGuid the service instance guid * @return {Promise} promise with array of service key names * @memberof CFUtil */ private static getAllServiceKeyNames; /** * Generate a unique service key name in format serviceInstanceName-key-N * @static * @param {string} serviceInstanceName the service instance name * @param {string} serviceInstanceGuid the service instance guid * @return {Promise} promise with unique service key name * @memberof CFUtil */ static generateUniqueServiceKeyName(serviceInstanceName: string, serviceInstanceGuid: string): Promise; /** * Get space guid from configuration or local CF fodler * @static * @param {string} spaceGuid ui5.yaml options * @return {Promise} promise with space guid * @memberof CFUtil */ static getSpaceGuid(spaceGuid?: string): Promise; } interface ICfError { code: number; title: string; detail: string; [key: string]: any; } export {};