f5-conx-core
Version:
F5 SDK for JavaScript with Typescript type definitions
109 lines • 3.75 kB
JavaScript
/*
* Copyright 2020. F5 Networks, Inc. See End User License Agreement ("EULA") for
* license terms. Notwithstanding anything to the contrary in the EULA, Licensee
* may copy and modify this software product for its internal business purposes.
* Further, Licensee may upload, publish and distribute the modified version of
* the software product on devcentral.f5.com.
*/
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CfClient = void 0;
const constants_1 = require("../constants");
/**
* f5 cloud failover client
* https://github.com/F5Networks/f5-cloud-failover-extension
* https://clouddocs.f5.com/products/extensions/f5-cloud-failover/latest/
*/
class CfClient {
constructor(versions, mgmtClient) {
this.version = versions;
this.mgmtClient = mgmtClient;
}
/**
* list associated cloud objects
* @returns axios/http response
*/
inspect() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.mgmtClient.makeRequest(CfClient.metaData.endPoints.inspect);
});
}
/**
* get cfe configuration
* @returns axios/http response
*/
getDeclare() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.mgmtClient.makeRequest(CfClient.metaData.endPoints.declare);
});
}
/**
* post/configure cfe
* @param cf declaration
* @returns axios/http response
*/
postDeclare(data) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.mgmtClient.makeRequest(CfClient.metaData.endPoints.declare, {
method: 'POST',
data
});
});
}
/**
* post last trigger event
* @returns axios/http response
*/
getTrigger() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.mgmtClient.makeRequest(CfClient.metaData.endPoints.trigger);
});
}
/**
* post/execute a trigger
*
* @param action trigger action -> 'execute' by default
* @returns axios/http response
*/
trigger(action = 'execute') {
return __awaiter(this, void 0, void 0, function* () {
return yield this.mgmtClient.makeRequest(CfClient.metaData.endPoints.trigger, {
method: 'POST',
data: { action }
});
});
}
/**
* post/reset cfe config
*
* sends/posts
* ```json
* {
* "resetStateFile": true
* }
* ```
* @returns axios/http response
*/
reset() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.mgmtClient.makeRequest(CfClient.metaData.endPoints.reset, {
method: 'POST',
data: {
resetStateFile: true
}
});
});
}
}
exports.CfClient = CfClient;
CfClient.metaData = constants_1.atcMetaData.cf;
//# sourceMappingURL=cfClient.js.map