@devopness/sdk-js
Version:
Devopness API JS/TS SDK - Painless essential DevOps to everyone
111 lines (110 loc) • 5.75 kB
JavaScript
/* eslint-disable */
/**
* devopness API
* Devopness API - Painless essential DevOps to everyone
*
* The version of the OpenAPI document: latest
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
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.SSLCertificatesApiService = void 0;
const ApiBaseService_1 = require("../../../services/ApiBaseService");
const ApiResponse_1 = require("../../../common/ApiResponse");
const Exceptions_1 = require("../../../common/Exceptions");
/**
* SSLCertificatesApiService - Auto-generated
*/
class SSLCertificatesApiService extends ApiBaseService_1.ApiBaseService {
/**
*
* @summary Create a new ssl certificate
* @param {number} environmentId The ID of the environment.
* @param {SslCertificateEnvironmentCreate} sslCertificateEnvironmentCreate A JSON object containing the resource data
*/
addEnvironmentSslCertificate(environmentId, sslCertificateEnvironmentCreate) {
return __awaiter(this, void 0, void 0, function* () {
if (environmentId === null || environmentId === undefined) {
throw new Exceptions_1.ArgumentNullException('environmentId', 'addEnvironmentSslCertificate');
}
if (sslCertificateEnvironmentCreate === null || sslCertificateEnvironmentCreate === undefined) {
throw new Exceptions_1.ArgumentNullException('sslCertificateEnvironmentCreate', 'addEnvironmentSslCertificate');
}
let queryString = '';
const requestUrl = '/environments/{environment_id}/ssl-certificates' + (queryString ? `?${queryString}` : '');
const response = yield this.post(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId))), sslCertificateEnvironmentCreate);
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Delete a given SSL Certificate
* @param {number} sslCertificateId The ID of the ssl certificate.
*/
deleteSslCertificate(sslCertificateId) {
return __awaiter(this, void 0, void 0, function* () {
if (sslCertificateId === null || sslCertificateId === undefined) {
throw new Exceptions_1.ArgumentNullException('sslCertificateId', 'deleteSslCertificate');
}
let queryString = '';
const requestUrl = '/ssl-certificates/{ssl_certificate_id}' + (queryString ? `?${queryString}` : '');
const response = yield this.delete(requestUrl.replace(`{${"ssl_certificate_id"}}`, encodeURIComponent(String(sslCertificateId))));
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Get details of a single SSL certificate
* @param {number} sslCertificateId The ID of the ssl certificate.
*/
getSslCertificate(sslCertificateId) {
return __awaiter(this, void 0, void 0, function* () {
if (sslCertificateId === null || sslCertificateId === undefined) {
throw new Exceptions_1.ArgumentNullException('sslCertificateId', 'getSslCertificate');
}
let queryString = '';
const requestUrl = '/ssl-certificates/{ssl_certificate_id}' + (queryString ? `?${queryString}` : '');
const response = yield this.get(requestUrl.replace(`{${"ssl_certificate_id"}}`, encodeURIComponent(String(sslCertificateId))));
return new ApiResponse_1.ApiResponse(response);
});
}
/**
*
* @summary Return a list of all SSL Certificates belonging to an environment
* @param {number} environmentId The ID of the environment.
* @param {number} [page] Number of the page to be retrieved
* @param {number} [perPage] Number of items returned per page
*/
listEnvironmentSslCertificates(environmentId, page, perPage) {
return __awaiter(this, void 0, void 0, function* () {
if (environmentId === null || environmentId === undefined) {
throw new Exceptions_1.ArgumentNullException('environmentId', 'listEnvironmentSslCertificates');
}
let queryString = '';
const queryParams = { page: page, per_page: perPage, };
for (const key in queryParams) {
if (queryParams[key] === undefined || queryParams[key] === null) {
continue;
}
queryString += (queryString ? '&' : '') + `${key}=${encodeURI(queryParams[key])}`;
}
const requestUrl = '/environments/{environment_id}/ssl-certificates' + (queryString ? `?${queryString}` : '');
const response = yield this.get(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId))));
return new ApiResponse_1.ApiResponse(response);
});
}
}
exports.SSLCertificatesApiService = SSLCertificatesApiService;
;