@datadog/datadog-api-client
Version:
OpenAPI client for Datadog APIs
656 lines • 35.6 kB
JavaScript
"use strict";
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.AWSIntegrationApi = exports.AWSIntegrationApiResponseProcessor = exports.AWSIntegrationApiRequestFactory = void 0;
const baseapi_1 = require("../../datadog-api-client-common/baseapi");
const configuration_1 = require("../../datadog-api-client-common/configuration");
const http_1 = require("../../datadog-api-client-common/http/http");
const logger_1 = require("../../../logger");
const ObjectSerializer_1 = require("../models/ObjectSerializer");
const exception_1 = require("../../datadog-api-client-common/exception");
class AWSIntegrationApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
createAWSAccount(body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'createAWSAccount'");
if (!_config.unstableOperations["v2.createAWSAccount"]) {
throw new Error("Unstable operation 'createAWSAccount' is disabled");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "createAWSAccount");
}
// Path Params
const localVarPath = "/api/v2/integration/aws/accounts";
// Make Request Context
const requestContext = _config
.getServer("v2.AWSIntegrationApi.createAWSAccount")
.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "AWSAccountCreateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
createNewAWSExternalID(_options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'createNewAWSExternalID'");
if (!_config.unstableOperations["v2.createNewAWSExternalID"]) {
throw new Error("Unstable operation 'createNewAWSExternalID' is disabled");
}
// Path Params
const localVarPath = "/api/v2/integration/aws/generate_new_external_id";
// Make Request Context
const requestContext = _config
.getServer("v2.AWSIntegrationApi.createNewAWSExternalID")
.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
deleteAWSAccount(awsAccountConfigId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'deleteAWSAccount'");
if (!_config.unstableOperations["v2.deleteAWSAccount"]) {
throw new Error("Unstable operation 'deleteAWSAccount' is disabled");
}
// verify required parameter 'awsAccountConfigId' is not null or undefined
if (awsAccountConfigId === null || awsAccountConfigId === undefined) {
throw new baseapi_1.RequiredError("awsAccountConfigId", "deleteAWSAccount");
}
// Path Params
const localVarPath = "/api/v2/integration/aws/accounts/{aws_account_config_id}".replace("{aws_account_config_id}", encodeURIComponent(String(awsAccountConfigId)));
// Make Request Context
const requestContext = _config
.getServer("v2.AWSIntegrationApi.deleteAWSAccount")
.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "*/*");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
getAWSAccount(awsAccountConfigId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'getAWSAccount'");
if (!_config.unstableOperations["v2.getAWSAccount"]) {
throw new Error("Unstable operation 'getAWSAccount' is disabled");
}
// verify required parameter 'awsAccountConfigId' is not null or undefined
if (awsAccountConfigId === null || awsAccountConfigId === undefined) {
throw new baseapi_1.RequiredError("awsAccountConfigId", "getAWSAccount");
}
// Path Params
const localVarPath = "/api/v2/integration/aws/accounts/{aws_account_config_id}".replace("{aws_account_config_id}", encodeURIComponent(String(awsAccountConfigId)));
// Make Request Context
const requestContext = _config
.getServer("v2.AWSIntegrationApi.getAWSAccount")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
getAWSIntegrationIAMPermissions(_options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// Path Params
const localVarPath = "/api/v2/integration/aws/iam_permissions";
// Make Request Context
const requestContext = _config
.getServer("v2.AWSIntegrationApi.getAWSIntegrationIAMPermissions")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
listAWSAccounts(awsAccountId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'listAWSAccounts'");
if (!_config.unstableOperations["v2.listAWSAccounts"]) {
throw new Error("Unstable operation 'listAWSAccounts' is disabled");
}
// Path Params
const localVarPath = "/api/v2/integration/aws/accounts";
// Make Request Context
const requestContext = _config
.getServer("v2.AWSIntegrationApi.listAWSAccounts")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (awsAccountId !== undefined) {
requestContext.setQueryParam("aws_account_id", ObjectSerializer_1.ObjectSerializer.serialize(awsAccountId, "string", ""), "");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
listAWSNamespaces(_options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'listAWSNamespaces'");
if (!_config.unstableOperations["v2.listAWSNamespaces"]) {
throw new Error("Unstable operation 'listAWSNamespaces' is disabled");
}
// Path Params
const localVarPath = "/api/v2/integration/aws/available_namespaces";
// Make Request Context
const requestContext = _config
.getServer("v2.AWSIntegrationApi.listAWSNamespaces")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateAWSAccount(awsAccountConfigId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'updateAWSAccount'");
if (!_config.unstableOperations["v2.updateAWSAccount"]) {
throw new Error("Unstable operation 'updateAWSAccount' is disabled");
}
// verify required parameter 'awsAccountConfigId' is not null or undefined
if (awsAccountConfigId === null || awsAccountConfigId === undefined) {
throw new baseapi_1.RequiredError("awsAccountConfigId", "updateAWSAccount");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateAWSAccount");
}
// Path Params
const localVarPath = "/api/v2/integration/aws/accounts/{aws_account_config_id}".replace("{aws_account_config_id}", encodeURIComponent(String(awsAccountConfigId)));
// Make Request Context
const requestContext = _config
.getServer("v2.AWSIntegrationApi.updateAWSAccount")
.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "AWSAccountUpdateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
}
exports.AWSIntegrationApiRequestFactory = AWSIntegrationApiRequestFactory;
class AWSIntegrationApiResponseProcessor {
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to createAWSAccount
* @throws ApiException if the response code was not in [200, 299]
*/
createAWSAccount(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSAccountResponse");
return body;
}
if (response.httpStatusCode === 400 ||
response.httpStatusCode === 403 ||
response.httpStatusCode === 409 ||
response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSAccountResponse", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to createNewAWSExternalID
* @throws ApiException if the response code was not in [200, 299]
*/
createNewAWSExternalID(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSNewExternalIDResponse");
return body;
}
if (response.httpStatusCode === 403 || response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSNewExternalIDResponse", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to deleteAWSAccount
* @throws ApiException if the response code was not in [200, 299]
*/
deleteAWSAccount(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 204) {
return;
}
if (response.httpStatusCode === 400 ||
response.httpStatusCode === 403 ||
response.httpStatusCode === 404 ||
response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "void", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to getAWSAccount
* @throws ApiException if the response code was not in [200, 299]
*/
getAWSAccount(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSAccountResponse");
return body;
}
if (response.httpStatusCode === 400 ||
response.httpStatusCode === 403 ||
response.httpStatusCode === 404 ||
response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSAccountResponse", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to getAWSIntegrationIAMPermissions
* @throws ApiException if the response code was not in [200, 299]
*/
getAWSIntegrationIAMPermissions(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSIntegrationIamPermissionsResponse");
return body;
}
if (response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSIntegrationIamPermissionsResponse", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to listAWSAccounts
* @throws ApiException if the response code was not in [200, 299]
*/
listAWSAccounts(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSAccountsResponse");
return body;
}
if (response.httpStatusCode === 403 || response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSAccountsResponse", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to listAWSNamespaces
* @throws ApiException if the response code was not in [200, 299]
*/
listAWSNamespaces(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSNamespacesResponse");
return body;
}
if (response.httpStatusCode === 403 || response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSNamespacesResponse", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to updateAWSAccount
* @throws ApiException if the response code was not in [200, 299]
*/
updateAWSAccount(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSAccountResponse");
return body;
}
if (response.httpStatusCode === 400 ||
response.httpStatusCode === 403 ||
response.httpStatusCode === 404 ||
response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "AWSAccountResponse", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
}
exports.AWSIntegrationApiResponseProcessor = AWSIntegrationApiResponseProcessor;
class AWSIntegrationApi {
constructor(configuration, requestFactory, responseProcessor) {
this.configuration = configuration;
this.requestFactory =
requestFactory || new AWSIntegrationApiRequestFactory(configuration);
this.responseProcessor =
responseProcessor || new AWSIntegrationApiResponseProcessor();
}
/**
* Create a new AWS Account Integration Config.
* @param param The request object
*/
createAWSAccount(param, options) {
const requestContextPromise = this.requestFactory.createAWSAccount(param.body, options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.createAWSAccount(responseContext);
});
});
}
/**
* Generate a new external ID for AWS role-based authentication.
* @param param The request object
*/
createNewAWSExternalID(options) {
const requestContextPromise = this.requestFactory.createNewAWSExternalID(options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.createNewAWSExternalID(responseContext);
});
});
}
/**
* Delete an AWS Account Integration Config by config ID.
* @param param The request object
*/
deleteAWSAccount(param, options) {
const requestContextPromise = this.requestFactory.deleteAWSAccount(param.awsAccountConfigId, options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.deleteAWSAccount(responseContext);
});
});
}
/**
* Get an AWS Account Integration Config by config ID.
* @param param The request object
*/
getAWSAccount(param, options) {
const requestContextPromise = this.requestFactory.getAWSAccount(param.awsAccountConfigId, options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.getAWSAccount(responseContext);
});
});
}
/**
* Get all AWS IAM permissions required for the AWS integration.
* @param param The request object
*/
getAWSIntegrationIAMPermissions(options) {
const requestContextPromise = this.requestFactory.getAWSIntegrationIAMPermissions(options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.getAWSIntegrationIAMPermissions(responseContext);
});
});
}
/**
* Get a list of AWS Account Integration Configs.
* @param param The request object
*/
listAWSAccounts(param = {}, options) {
const requestContextPromise = this.requestFactory.listAWSAccounts(param.awsAccountId, options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.listAWSAccounts(responseContext);
});
});
}
/**
* Get a list of available AWS CloudWatch namespaces that can send metrics to Datadog.
* @param param The request object
*/
listAWSNamespaces(options) {
const requestContextPromise = this.requestFactory.listAWSNamespaces(options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.listAWSNamespaces(responseContext);
});
});
}
/**
* Update an AWS Account Integration Config by config ID.
* @param param The request object
*/
updateAWSAccount(param, options) {
const requestContextPromise = this.requestFactory.updateAWSAccount(param.awsAccountConfigId, param.body, options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.updateAWSAccount(responseContext);
});
});
}
}
exports.AWSIntegrationApi = AWSIntegrationApi;
//# sourceMappingURL=AWSIntegrationApi.js.map