/** * Dynatrace Configuration API * Documentation of the Dynatrace Configuration API. Refer to the [help page](https://www.dynatrace.com/support/help/shortlink/config-api) to read about use-cases and examples. Notes about compatibility: * Operations marked as early adopter or preview may be changed in non-compatible ways, although we try to avoid this. * We may add new enum constants without incrementing the API version; thus, clients need to handle unknown enum constants gracefully. * * The version of the OpenAPI document: 1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import localVarRequest = require('request'); import http = require('http'); /* tslint:disable:no-unused-locals */ import { ConditionalNamingRule } from '../model/conditionalNamingRule'; import { EntityShortRepresentation } from '../model/entityShortRepresentation'; import { ErrorEnvelope } from '../model/errorEnvelope'; import { StubList } from '../model/stubList'; import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; import { HttpError, RequestFile } from './apis'; let defaultBasePath = 'https://dynatrace.nonprod.jbhunt.com/e/2063b0c9-e776-4494-9095-10036c37e2ab/api/config/v1'; // =============================================== // This file is autogenerated - Please do not edit // =============================================== export enum ConditionalNamingApiApiKeys { Api-Token, } export class ConditionalNamingApi { protected _basePath = defaultBasePath; protected _defaultHeaders : any = {}; protected _useQuerystring : boolean = false; protected authentications = { 'default': new VoidAuth(), 'Api-Token': new ApiKeyAuth('header', 'Authorization'), } protected interceptors: Interceptor[] = []; constructor(basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { if (basePath) { this.basePath = basePath; } } else { if (basePathOrUsername) { this.basePath = basePathOrUsername } } } set useQuerystring(value: boolean) { this._useQuerystring = value; } set basePath(basePath: string) { this._basePath = basePath; } set defaultHeaders(defaultHeaders: any) { this._defaultHeaders = defaultHeaders; } get defaultHeaders() { return this._defaultHeaders; } get basePath() { return this._basePath; } public setDefaultAuthentication(auth: Authentication) { this.authentications.default = auth; } public setApiKey(key: ConditionalNamingApiApiKeys, value: string) { (this.authentications as any)[ConditionalNamingApiApiKeys[key]].apiKey = value; } public addInterceptor(interceptor: Interceptor) { this.interceptors.push(interceptor); } /** * The body must not provide an ID. An ID is assigned automatically by the Dynatrace server. * @summary Creates a new naming rule | maturity=EARLY_ADOPTER * @param type The type of the rule, defined by the type of Dynatrace entities to which the rule applies. * @param conditionalNamingRule The JSON body of the request. Contains parameters of the new naming rule. Do not specify the **id** of the rule. The value of the **type** field must match the **type** path parameter. */ public async createNamingRule (type: 'processGroup', conditionalNamingRule?: ConditionalNamingRule, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: EntityShortRepresentation; }> { const localVarPath = this.basePath + '/conditionalNaming/{type}' .replace('{' + 'type' + '}', encodeURIComponent(String(type))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); const produces = ['application/json; charset=utf-8']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'type' is not null or undefined if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling createNamingRule.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(conditionalNamingRule, "ConditionalNamingRule") }; let authenticationPromise = Promise.resolve(); if (this.authentications.Api-Token.apiKey) { authenticationPromise = authenticationPromise.then(() => this.authentications.Api-Token.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: EntityShortRepresentation; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "EntityShortRepresentation"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * If the rule with the specified ID doesn\'t exist, a new rule will be created at the end of the rules list and will be the last to evaluate. * @summary Updates the specified naming rule | maturity=EARLY_ADOPTER * @param type The type of the rule, defined by the type of Dynatrace entities to which the rule applies. * @param id The ID of the naming rule to be updated. * @param conditionalNamingRule The JSON body of the request. Contains updated parameters of the naming rule. The value of the **type** field must match the **type** path parameter. */ public async createOrUpdateNamingRule (type: 'processGroup', id: string, conditionalNamingRule?: ConditionalNamingRule, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: EntityShortRepresentation; }> { const localVarPath = this.basePath + '/conditionalNaming/{type}/{id}' .replace('{' + 'type' + '}', encodeURIComponent(String(type))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); const produces = ['application/json; charset=utf-8']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'type' is not null or undefined if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling createOrUpdateNamingRule.'); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling createOrUpdateNamingRule.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'PUT', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(conditionalNamingRule, "ConditionalNamingRule") }; let authenticationPromise = Promise.resolve(); if (this.authentications.Api-Token.apiKey) { authenticationPromise = authenticationPromise.then(() => this.authentications.Api-Token.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: EntityShortRepresentation; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "EntityShortRepresentation"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Deletes the specified naming rule | maturity=EARLY_ADOPTER * @param type The type of the rule, defined by the type of Dynatrace entities to which the rule applies. * @param id The ID of the naming rule to be deleted. */ public async deleteNamingRule (type: 'processGroup', id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { const localVarPath = this.basePath + '/conditionalNaming/{type}/{id}' .replace('{' + 'type' + '}', encodeURIComponent(String(type))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); let localVarFormParams: any = {}; // verify required parameter 'type' is not null or undefined if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling deleteNamingRule.'); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling deleteNamingRule.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.Api-Token.apiKey) { authenticationPromise = authenticationPromise.then(() => this.authentications.Api-Token.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Lists all configured naming rules of the specified type | maturity=EARLY_ADOPTER * @param type The type of the rule, defined by the type of Dynatrace entities to which the rule applies. */ public async getAllNamingRules (type: 'processGroup', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: StubList; }> { const localVarPath = this.basePath + '/conditionalNaming/{type}' .replace('{' + 'type' + '}', encodeURIComponent(String(type))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); const produces = ['application/json; charset=utf-8']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'type' is not null or undefined if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling getAllNamingRules.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.Api-Token.apiKey) { authenticationPromise = authenticationPromise.then(() => this.authentications.Api-Token.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: StubList; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "StubList"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Lists the parameters of the specified naming rule | maturity=EARLY_ADOPTER * @param type The type of the rule, defined by the type of Dynatrace entities to which the rule applies. * @param id The ID of the required naming rule. */ public async getSingleNamingRule (type: 'processGroup', id: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ConditionalNamingRule; }> { const localVarPath = this.basePath + '/conditionalNaming/{type}/{id}' .replace('{' + 'type' + '}', encodeURIComponent(String(type))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); const produces = ['application/json; charset=utf-8']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'type' is not null or undefined if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling getSingleNamingRule.'); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling getSingleNamingRule.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.Api-Token.apiKey) { authenticationPromise = authenticationPromise.then(() => this.authentications.Api-Token.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: ConditionalNamingRule; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "ConditionalNamingRule"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Validates the payload for the `PUT /conditionalNaming/{type}/{id}` request | maturity=EARLY_ADOPTER * @param type The type of the rule, defined by the type of Dynatrace entities to which the rule applies. * @param id The ID of the naming rule to be validated. * @param conditionalNamingRule The JSON body of the request. Contains the naming rule parameters to be validated. */ public async validateNamingRule (type: 'processGroup', id: string, conditionalNamingRule?: ConditionalNamingRule, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { const localVarPath = this.basePath + '/conditionalNaming/{type}/{id}/validator' .replace('{' + 'type' + '}', encodeURIComponent(String(type))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); const produces = ['application/json; charset=utf-8']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'type' is not null or undefined if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling validateNamingRule.'); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling validateNamingRule.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(conditionalNamingRule, "ConditionalNamingRule") }; let authenticationPromise = Promise.resolve(); if (this.authentications.Api-Token.apiKey) { authenticationPromise = authenticationPromise.then(() => this.authentications.Api-Token.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Validates the payload for the `POST /conditionalNaming/{type}` request | maturity=EARLY_ADOPTER * @param type The type of the rule, defined by the type of Dynatrace entities to which the rule applies. * @param conditionalNamingRule The JSON body of the request. Contains the naming rule parameters to be validated. */ public async validateNamingRule1 (type: 'processGroup', conditionalNamingRule?: ConditionalNamingRule, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body?: any; }> { const localVarPath = this.basePath + '/conditionalNaming/{type}/validator' .replace('{' + 'type' + '}', encodeURIComponent(String(type))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); const produces = ['application/json; charset=utf-8']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'type' is not null or undefined if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling validateNamingRule1.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(conditionalNamingRule, "ConditionalNamingRule") }; let authenticationPromise = Promise.resolve(); if (this.authentications.Api-Token.apiKey) { authenticationPromise = authenticationPromise.then(() => this.authentications.Api-Token.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } }