"use strict";
var RelayClient_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RelayClient = void 0;
const tslib_1 = require("tslib");
const inversify_1 = require("inversify");
const codiac_common_1 = require("@codiac.io/codiac-common");
const contracts_1 = require("@codiac.io/codiac-common/contracts");
const api_client_base_1 = require("../common/api-client-base");
const api_user_creds_1 = require("../common/api-user-creds");
const client_config_1 = require("./client-config");
const api_auth_methods_legacy_1 = require("../common/security/api-auth-methods-legacy");
function headersFrom(options, existingHeaders) {
    let output;
    // FROM the api base...
    /** The name of the http header used to designate the csv list of properties to include in the output signature */
    const HEADER_KEY_PROJECTION_INCLUDES = "output-includes";
    /** The name of the http header used to designate the csv list of properties to include in the output signature */
    const HEADER_KEY_PROJECTION_EXCLUDES = "output-excludes";
    if (options === null || options === void 0 ? void 0 : options.projection) {
        output = Object.assign({}, (existingHeaders !== null && existingHeaders !== void 0 ? existingHeaders : {}));
        output[HEADER_KEY_PROJECTION_INCLUDES] = options.projection.pathsIncluded.join(",");
        output[HEADER_KEY_PROJECTION_EXCLUDES] = options.projection.pathsExcluded.join(",");
    }
    return output;
}
let RelayClient = RelayClient_1 = class RelayClient extends api_client_base_1.ApiClientBase {
    static bootstrap(logger) {
        super.bootstrap_base([], logger);
    }
    /** Hardcoded to match the current setting on the server.
     * TODO: Get this from a config that is copied from the server proiject to the client project on build.
     */
    /** This factory method is just for convenience and hasty backward compatibility with consumers not using ioc. */
    static create(logger, apiRootUrl, authToken) {
        return new RelayClient_1(logger, { apiBaseUrl: apiRootUrl }, (authToken) ? { apiToken: authToken } : undefined);
    }
    /** Local interface for the remote api.
     * @param settings (optional) configuration (ie: apiRootUrl) to use for the client.  If not provided settings will be loaded from the config file on the local machine.
     *
     */
    constructor(logger, settings, credentials) {
        let ultimateSettings = settings !== null && settings !== void 0 ? settings : client_config_1.RelayClientConfig.load(); // load up default settings if not specified 
        super(logger, ultimateSettings === null || ultimateSettings === void 0 ? void 0 : ultimateSettings.apiBaseUrl, credentials === null || credentials === void 0 ? void 0 : credentials.apiToken);
        this.AuthLegacy = new api_auth_methods_legacy_1.ApiAuthMethodsLegacy(this, this.logger);
        this.Auth = new AuthOperations(this, this.logger);
        this.Call = new OtherOperations(this);
        // ====================================================================================================
        // BY ENTITY THEN BY OP
        // ====================================================================================================
        this.EntityAcl = new EntityAclCruds(this);
        this.AuthRole = new AuthRoleCruds(this);
    }
    GetDefaultRootUrl() {
        return RelayClient_1.DEFAULT_API_URL;
    }
}; // end class RelayClient
/** Version of the remote api from which this client was generated */
RelayClient.apiVersion = "version";
RelayClient.DEFAULT_API_URL = "http://localhost:5799";
RelayClient = RelayClient_1 = tslib_1.__decorate([
    (0, inversify_1.injectable)(),
    tslib_1.__param(0, (0, inversify_1.inject)(codiac_common_1.INTERFACES.IBetterLogger)),
    tslib_1.__param(1, (0, inversify_1.inject)(client_config_1.RelayClientConfig)),
    tslib_1.__param(2, (0, inversify_1.inject)(api_user_creds_1.ApiUserCreds)),
    tslib_1.__metadata("design:paramtypes", [Object, client_config_1.RelayClientConfig,
        api_user_creds_1.ApiUserCreds])
], RelayClient);
exports.RelayClient = RelayClient;
//  // EXAMPLE
//  let client = new CodiacClient(new BetterConsoleLogger());
//  let wf: WorkFlowStrategy = { 
//    name: "setup", 
//    created: new Date(), 
//    createdBy: "", 
//    modified: new Date(), 
//    modifiedBy: "" 
//  };
//  let res = await client.WorkFlowStrategy.trycreate(wf);
// ====================================================================================================
// AUTH ENDPOINT CLASS 
// ====================================================================================================
const jwt_lib_1 = require("@codiac.io/jwt-lib");
class AuthOperations {
    constructor(core, logger) {
        this.core = core;
        this.logger = logger;
    }
    ;
    EntityAclCreateMany(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    EntityAclList(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls(/)", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    EntityAclUpdateMany(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    EntityAclPatchWhere(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PATCH, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    EntityAclGet(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls/:id(/)", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    EntityAclUpdate(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls/:id(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    EntityAclPatch(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls/:id(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PATCH, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    EntityAclDelete(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls/:id(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.DELETE, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    EntityAclCreate(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/acls/new(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RoleCreateMany(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RoleList(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles(/)", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RoleUpdateMany(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RolePatchWhere(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PATCH, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RoleDeleteWhere(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.DELETE, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RoleGet(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles/:id(/)", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RoleUpdate(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles/:id(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RolePatch(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles/:id(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PATCH, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RoleDelete(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles/:id(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.DELETE, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    RoleCreate(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/auth/roles/new(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Determines whether the given token is expired.
     * @param throwOnError throws any encountered errors, including token parsing errors.
     */
    isExpired(token, throwOnError = false) {
        try {
            const exp = this.extractTokenExpiration(token);
            return (exp == undefined) || !(0, codiac_common_1.isFuture)(exp);
        }
        catch (err) {
            let newErr = new contracts_1.CodiacError(`Error determining expiry status: ${err.message || ""}`, err);
            this.logger.detail(newErr.message);
            if (throwOnError) {
                throw newErr;
            }
            else {
                return true;
            }
        }
    }
    extractTokenExpiration(token) {
        let exp;
        try {
            const encoder = new jwt_lib_1.JwtEncoder();
            const tokenObj = encoder.tryDecode(token);
            const CLAIM_KEY_FOR_EXPIRATION = "exp"; // this is just a standard claim so it ought to come from the jwt lib
            const rawExp = tokenObj === null || tokenObj === void 0 ? void 0 : tokenObj.payload[CLAIM_KEY_FOR_EXPIRATION];
            if (rawExp) {
                try {
                    exp = new Date(rawExp);
                    this.logger.trace(`Exracted token expiration (utc): ${(exp === null || exp === void 0 ? void 0 : exp.toUTCString()) || "undefined"}`);
                }
                catch (_a) {
                    this.logger.trace(`Invalid date format in token expiration: [${rawExp}]`);
                }
            }
            return exp;
        }
        catch (err) {
            throw new Error(`Error parsing expiration from token: ${err.message}`);
        }
    }
}
class EntityAclCruds {
    constructor(core) {
        this.core = core;
    }
    ;
    /** Saves each given input as a new EntityAcl. */
    tryCreateMany(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.BatchResult(false);
            try {
                let url = this.core.buildUrl("/auth/acls(/)", {}, false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing createMany Array<EntityAcl>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    createMany(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryCreateMany(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.failures && result.failures.length > 0) {
                let messageList = result.failures.map(f => { var _a; return `${f.message || ""} ${((_a = f.error) === null || _a === void 0 ? void 0 : _a.message) || ""}`; }).join("\n");
                throw new Error(`createMany EntityAcl incurred ${result.failures.length} failures (among ${((_a = result.successes) === null || _a === void 0 ? void 0 : _a.length) || 0} successes). ${result.message || ""}.\n  ${messageList}`);
            }
            else if (result.success == false || result.successes == undefined || result.successes.length == 0) {
                throw new Error(`createMany EntityAcl failed without error. ${result.message || ""}`);
            }
            return (result.successes);
        });
    }
    /** Retrieves all the existing EntityAcl that satisfy the given criteria. */
    tryReadMany(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.ListResult(false);
            try {
                let serializerMap = {
                    "code": "StringFilter",
                    "name": "StringFilter"
                };
                let values = this.core.applyPropertySerializers(request, serializerMap);
                let url = this.core.buildUrl("/auth/acls(/)", values, true);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing readMany EntityAclCriteria: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    readMany(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryReadMany(request, options);
            if (result.error) {
                throw result.error;
            }
            else if ((result.output == undefined || result.output.length == 0) && (options === null || options === void 0 ? void 0 : options.throwNotFound) == true) {
                throw new Error(`No EntityAcl found.`);
            }
            return ((_a = result.output) !== null && _a !== void 0 ? _a : []);
        });
    }
    /** Overwrites each existing EntityAcl. */
    tryUpdateMany(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.BatchResult(false);
            try {
                let url = this.core.buildUrl("/auth/acls(/)", {}, false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing updateMany Array<EntityAcl>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    updateMany(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryUpdateMany(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.failures && result.failures.length > 0) {
                let messageList = result.failures.map(f => { var _a; return `${f.message || ""} ${((_a = f.error) === null || _a === void 0 ? void 0 : _a.message) || ""}`; }).join("\n");
                throw new Error(`updateMany EntityAcl incurred ${result.failures.length} failures (among ${((_a = result.successes) === null || _a === void 0 ? void 0 : _a.length) || 0} successes). ${result.message || ""}.\n  ${messageList}`);
            }
            else if (result.success == false || result.successes == undefined || result.successes.length == 0) {
                throw new Error(`updateMany EntityAcl failed without error. ${result.message || ""}`);
            }
            return (result.successes);
        });
    }
    /** Performs the given operations on each existing EntityAcl that satisfies the given criteria. */
    tryPatchWhere(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.BatchResult(false);
            try {
                let url = this.core.buildUrl("/auth/acls(/)", {}, false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PATCH, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing patchWhere PatchSpecForMany<EntityAcl, EntityAclCriteria>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    patchWhere(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryPatchWhere(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.failures && result.failures.length > 0) {
                let messageList = result.failures.map(f => { var _a; return `${f.message || ""} ${((_a = f.error) === null || _a === void 0 ? void 0 : _a.message) || ""}`; }).join("\n");
                throw new Error(`patchWhere EntityAcl incurred ${result.failures.length} failures (among ${((_a = result.successes) === null || _a === void 0 ? void 0 : _a.length) || 0} successes). ${result.message || ""}.\n  ${messageList}`);
            }
            else if (result.success == false || result.successes == undefined || result.successes.length == 0) {
                throw new Error(`patchWhere EntityAcl failed without error. ${result.message || ""}`);
            }
            return (result.successes);
        });
    }
    /** Retrieves the single, uniquely identified EntityAcl. */
    tryRead(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/acls/:id(/)", Object.assign({}, request), true);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing read IdSpecFor<EntityAcl>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    read(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryRead(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`read EntityAcl failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
    /** Overwrites the existing EntityAcl. */
    tryUpdate(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/acls/:id(/)", Object.assign({}, request), false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing update EntityAcl: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    update(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryUpdate(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`update EntityAcl failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
    /** Performs the given operations on the existing EntityAcl. */
    tryPatch(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/acls/:id(/)", Object.assign({}, request), false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PATCH, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing patch PatchSpecForOne<EntityAcl>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    patch(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryPatch(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`patch EntityAcl failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
    /** Deletes the existing EntityAcl. */
    tryDelete(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/acls/:id(/)", Object.assign({}, request), false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.DELETE, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing delete IdSpecFor<EntityAcl>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    delete(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryDelete(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`delete EntityAcl failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
    /** Saves the input as a new EntityAcl. */
    tryCreate(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/acls/new(/)", Object.assign({}, request), false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing create EntityAcl: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    create(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryCreate(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`create EntityAcl failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
}
class AuthRoleCruds {
    constructor(core) {
        this.core = core;
    }
    ;
    /** Saves each given input as a new AuthRole. */
    tryCreateMany(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.BatchResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles(/)", {}, false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing createMany Array<AuthRole>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    createMany(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryCreateMany(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.failures && result.failures.length > 0) {
                let messageList = result.failures.map(f => { var _a; return `${f.message || ""} ${((_a = f.error) === null || _a === void 0 ? void 0 : _a.message) || ""}`; }).join("\n");
                throw new Error(`createMany AuthRole incurred ${result.failures.length} failures (among ${((_a = result.successes) === null || _a === void 0 ? void 0 : _a.length) || 0} successes). ${result.message || ""}.\n  ${messageList}`);
            }
            else if (result.success == false || result.successes == undefined || result.successes.length == 0) {
                throw new Error(`createMany AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.successes);
        });
    }
    /** Retrieves all the existing AuthRole that satisfy the given criteria. */
    tryReadMany(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.ListResult(false);
            try {
                let serializerMap = {
                    "code": "StringFilter",
                    "name": "StringFilter"
                };
                let values = this.core.applyPropertySerializers(request, serializerMap);
                let url = this.core.buildUrl("/auth/roles(/)", values, true);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing readMany AuthRoleCriteria: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    readMany(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryReadMany(request, options);
            if (result.error) {
                throw result.error;
            }
            else if ((result.output == undefined || result.output.length == 0) && (options === null || options === void 0 ? void 0 : options.throwNotFound) == true) {
                throw new Error(`No AuthRole found.`);
            }
            return ((_a = result.output) !== null && _a !== void 0 ? _a : []);
        });
    }
    /** Overwrites each existing AuthRole. */
    tryUpdateMany(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.BatchResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles(/)", {}, false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing updateMany Array<AuthRole>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    updateMany(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryUpdateMany(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.failures && result.failures.length > 0) {
                let messageList = result.failures.map(f => { var _a; return `${f.message || ""} ${((_a = f.error) === null || _a === void 0 ? void 0 : _a.message) || ""}`; }).join("\n");
                throw new Error(`updateMany AuthRole incurred ${result.failures.length} failures (among ${((_a = result.successes) === null || _a === void 0 ? void 0 : _a.length) || 0} successes). ${result.message || ""}.\n  ${messageList}`);
            }
            else if (result.success == false || result.successes == undefined || result.successes.length == 0) {
                throw new Error(`updateMany AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.successes);
        });
    }
    /** Performs the given operations on each existing AuthRole that satisfies the given criteria. */
    tryPatchWhere(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.BatchResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles(/)", {}, false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PATCH, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing patchWhere PatchSpecForMany<AuthRole, AuthRoleCriteria>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    patchWhere(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryPatchWhere(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.failures && result.failures.length > 0) {
                let messageList = result.failures.map(f => { var _a; return `${f.message || ""} ${((_a = f.error) === null || _a === void 0 ? void 0 : _a.message) || ""}`; }).join("\n");
                throw new Error(`patchWhere AuthRole incurred ${result.failures.length} failures (among ${((_a = result.successes) === null || _a === void 0 ? void 0 : _a.length) || 0} successes). ${result.message || ""}.\n  ${messageList}`);
            }
            else if (result.success == false || result.successes == undefined || result.successes.length == 0) {
                throw new Error(`patchWhere AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.successes);
        });
    }
    /** Deletes each existing AuthRole that satisfies the given criteria. */
    tryDeleteWhere(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.BatchResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles(/)", {}, false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.DELETE, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing deleteWhere AuthRoleCriteria: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    deleteWhere(request, options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryDeleteWhere(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.failures && result.failures.length > 0) {
                let messageList = result.failures.map(f => { var _a; return `${f.message || ""} ${((_a = f.error) === null || _a === void 0 ? void 0 : _a.message) || ""}`; }).join("\n");
                throw new Error(`deleteWhere AuthRole incurred ${result.failures.length} failures (among ${((_a = result.successes) === null || _a === void 0 ? void 0 : _a.length) || 0} successes). ${result.message || ""}.\n  ${messageList}`);
            }
            else if (result.success == false || result.successes == undefined || result.successes.length == 0) {
                throw new Error(`deleteWhere AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.successes);
        });
    }
    /** Retrieves the single, uniquely identified AuthRole. */
    tryRead(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles/:id(/)", Object.assign({}, request), true);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing read IdSpecFor<AuthRole>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    read(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryRead(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`read AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
    /** Overwrites the existing AuthRole. */
    tryUpdate(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles/:id(/)", Object.assign({}, request), false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing update AuthRole: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    update(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryUpdate(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`update AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
    /** Performs the given operations on the existing AuthRole. */
    tryPatch(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles/:id(/)", Object.assign({}, request), false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PATCH, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing patch PatchSpecForOne<AuthRole>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    patch(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryPatch(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`patch AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
    /** Deletes the existing AuthRole. */
    tryDelete(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles/:id(/)", Object.assign({}, request), false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.DELETE, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing delete IdSpecFor<AuthRole>: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    delete(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryDelete(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`delete AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
    /** Saves the input as a new AuthRole. */
    tryCreate(request, options) {
        var _a, _b;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let response = new contracts_1.SingleResult(false);
            try {
                let url = this.core.buildUrl("/auth/roles/new(/)", Object.assign({}, request), false);
                let headers = options ? headersFrom(options) : undefined;
                let returnHeaders;
                [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
            }
            catch (err) {
                response.error = err;
                response.message = `Error performing create AuthRole: ${(_a = err.name) !== null && _a !== void 0 ? _a : ""} ${(_b = err.message) !== null && _b !== void 0 ? _b : ""}.`;
            }
            finally {
                return response;
            }
        });
    }
    create(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            let result = yield this.tryCreate(request, options);
            if (result.error) {
                throw result.error;
            }
            else if (result.success == false || result.output == undefined) {
                throw new Error(`create AuthRole failed without error. ${result.message || ""}`);
            }
            return (result.output);
        });
    }
}
class OtherOperations {
    constructor(core) {
        this.core = core;
    }
    ;
    /** Bring me a valid token and I'll register with the websocket svc bus and listen to messages. */
    activateBusListener(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/activate-bus-listener", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves connection specifications to connect to the log stream for a given asset replica (to be used as input for the 'request' function from the npm package: https://www.npmjs.com/package/request). */
    getLogStreamSpecs(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/asset-log-cnxn", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Provides an asset-level snapshot of the status of the instances and versions of the given asset. */
    assetStatus(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/asset-status", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    ClusterCapture(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            /** Provides an asset-level snapshot of the status of the instances and versions of the given asset. */
            try {
                let url = this.core.buildUrl("/execute-cluster-capture", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves all versions for the given asset/image both from the image registry and the asset version history. */
    FetchAssetVersions(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/asset-versions", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the names of the available autoscaling metrics, for use when defining autoscaling on asset footprints. */
    get_autoscaling_metrics(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/assets/autoscaling/metrics", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Provides any predefined structure (eg: setting names, meta, and types) for an asset config. */
    get_asset_config_schema(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/assets/config-schemas", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of vm specs available for use as Aws cluster nodes. */
    getAwsNodeTypes(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/aws/node-types", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of data center locations and their human-readable ids. */
    getAwsRegions(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/aws/regions", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of vm specs available for use as Aws cluster nodes. */
    getAwsS3Buckets(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/aws/s3-buckets", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the basic identity info for the given aws credentials or for this tenant user's locally stored AWS user credentials. */
    getAwsUser(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/aws/user", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of Azure Container Registries (ACRs) under the given azure subscription. */
    getAzureAcrs(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/azure/acrs", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of data center locations available for Azure clusters. */
    getAzureLocations(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/azure/locations", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of vm specs available for use as Azure cluster nodes. */
    getAzureNodeTypes(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/azure/node-types", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of azure resource groups under the given subscription for the given location. */
    getAzureResourceGroups(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/azure/resource-groups", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of azure subscriptions for the given azure user account. */
    getAzureSubscriptions(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/azure/subscriptions", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of virutal networks that exist under the given subscription for the given location. */
    getAzureVnets(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/azure/vnets", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves lightly loaded cabinets (from RootMap) matching the given criteria. */
    GetCabinets(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/cabinets", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves a list of kubernetes clusters that currently exist in a cloud subscription. */
    GetExistingCspClusters(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/get-existing-csp-clusters", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /**  */
    GetStorageAccounts(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/storage-accounts", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /**  */
    GetStorageAccountKeys(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/storage-account-keys", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Enables the given user to access the given cluster via cloud provider security. */
    grantClusterAccess(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/cluster-access", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves connection specifications to connect to the cluster in which the given cabinet resides (to be used with the KubeConfig.loadFromString() method from the npm package: https://www.npmjs.com/package/@kubernetes/client-node). */
    getClusterConnectionSpecs(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/cluster-cnxn", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the default values for cluster creation */
    getClusterDefaults(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/cluster-defaults", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** REtrieves the final configuration file contents for the given cabinet */
    GetRenderedCabinetConfig(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/configs/cabinet", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Uploads the contents of a config file and converts it to ScopedSettings */
    ImportConfig(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/configs/import", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Authenticates with the given cloud service provider using the given credentials or, if none provided, using the credentials cached for the given csp. */
    csp_login(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/csp/login", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Target for the OAuth 2.0 Authorization Code Flow redirect.  Receives the authorization code, converts it to a token and passes the token down to the calling application (via websocket backchannel specified in the message state). */
    csp_login_auth_code_catcher(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/csp/login/auth-code-catcher", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Invokes the OAuth 2.0 interactive login sequence for the given cloud service provider. */
    csp_login_interactive(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/csp/login/ui", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Target for the OAuth 2.0 sign-out redirect.  Purges any existing tokens for the given csp and notifies the calling application (via websocket backchannel specified in the message). */
    csp_logout_catcher(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/csp/logout-catcher", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Invokes the OAuth 2.0 interactive sign out sequence for the given cloud service provider (ensures that the browser and any other sso-related systems also get the sign-out message). */
    csp_logout_interactive(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/csp/logout/ui", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Returns the currently cached username for the given cloud service provider. */
    get_current_users_for(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/current-users-for", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the actual string file contents of the ultimate scoped configs that were written to the cabinet (sourced directly from the k8s ConfigMaps). */
    getDeployedConfigs(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/deployed-configs", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves connection specifications to connect to the cluster in which the given cabinet resides (to be used with the KubeConfig.loadFromString() method from the npm package: https://www.npmjs.com/package/@kubernetes/client-node), AND the names of the requested k8s entities. */
    getExecConnectionSpec(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/exec-cnxn", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteCabinetKiller(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-cabinet-killer", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteCabinetMaker(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-cabinet-maker", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteClusterCreate(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-cluster-create", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    clusterCreateAsync(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-cluster-create-async", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    clusterInit(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-cluster-init", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    clusterDeinit(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-cluster-deinit", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteClusterTillerInstall(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-cluster-tiller-install", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteDeleteClusterInstance(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-delete-cluster-instance", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteDeployConfigsFor(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-deploy-configs-for", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteDeployIngressFor(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-deploy-ingress-for", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteDeployment(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-deployment", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteDestroyAssets(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-destroy-assets", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Creates or updates a host naming assignment strategy for a given domain. */
    executeDomainUpsert(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-domain-upsert(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Creates or updates a host naming assignment strategy for a given domain. */
    domainDelete(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/domains/:id(/)", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.DELETE, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postExecuteRecycleAssets(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/execute-recycle-assets", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves list of references to captured file stores. */
    GetFileStores(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/file-stores", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Generates a Kit object from an existing asset. (generated operationId) */
    getGenerateAssetFromKit(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/generate-asset-from-kit", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Generates a Kit object from an existing asset. (generated operationId) */
    getGenerateKit(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/generate-kit", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Returns the image repositories matching the search string in the given registry. */
    searchRegistry(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/images-search", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves a list of all host naming strategies as applied to the map of enteprises, environments, and cabinets. */
    getIngressMap(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/ingress/map", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves a list of all host naming strategies as applied to the map of enteprises, environments, and cabinets. */
    recaptureIngressIp(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/ingress/recapture", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.PUT, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of k8s versions supported by the given cloud provider (and Codiac), for use in creating a cluster. */
    getAvailableK8sVersions(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/k8s-versions", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    getKnownPortNumbers(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/port-numbers", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postPublishService(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/publishService", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postReadAssetLogs(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/read-asset-logs", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of versions available for a given container image repository (generated operationId) */
    getReadImageTags(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/read-image-tags", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    postReadVaultStoreKeys(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/read-vault-store-keys", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    readyState(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/ready-state", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Returns the list of support cloud service providers with image registries. */
    getRegistryProviders(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/registry-providers", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Attempts to recognize the cloud Service provider from the given registry url. */
    getRegistryType(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/registry-type", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Makes a cabinet-scoped change to the asset resource footprint, and applies it to the actual asset instances in the cluster. */
    scaleAsset(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/scale-asset", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves the list of cloud providers with secret stores support. */
    GetAllSecretProviders(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/secret-providers", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Retrieves a list of currently captured secret stores. */
    GetSecretStores(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/secret-stores", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** (generated operationId) */
    getSwaggerUiPath(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/swagger-ui/:path", request, true);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.GET, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
    /** Triggers Zombie Mode metrics service instances to update to the latest schedule of zombie periods.  it does this by deploying the zombie schedule config maps and recycling the zombie metrics services. */
    zombie_refresh(request, options) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            try {
                let url = this.core.buildUrl("/zombie-refresh", request, false);
                let headers = options ? headersFrom(options) : undefined;
                let [response, returnHeaders] = yield this.core.makeHttpCall(codiac_common_1.httpRestVerb.POST, url, request, headers);
                return response;
            }
            catch (err) {
                throw err;
            }
        });
    }
}
//    // ===================================================================================
//    // THROWING REPO
//    // ===================================================================================
//
//
//    import { IRepoOptions, IDomainEntity, classDef } from "@codiac.io/codiac-common";
//    import * as contracts from "@codiac.io/codiac-common/contracts";
//
//
//    export interface IThrowingRepoOptions extends IRepoOptions {
//      throwNotFound?: boolean;
//    }
//
//
//    /** HACK:  This class exists ONLY because the client does not implement IRepo, so we cannot use ThrowingRepoWrapper.
//     * because the client needs criteriaType argument on tryReadMany, tryPatchWhere, and tryDeleteWhere.
//     *
//     * Wraps repo methods to throw on error or when unsuccessful.
//     * EXCEPT read, which can return undefined when none found
//     * and readMany which can return an empty array when none found.
//     */
//    @injectable()
//    export class ThrowingRelayClient /* implements IThrowingRepo */ {
//      constructor(@inject(RelayClient) public repo: RelayClient) {
//      }
//
//      // startTransaction(): Promise<void> { return this.repo.startTransaction(); }
//      // commit(): Promise<void> { return this.repo.commit(); }
//      // rollback(): Promise<void> { return this.repo.rollback(); }
//
//
//
//
//    }
//# sourceMappingURL=client.js.map