Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 66 additions & 9 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51339,6 +51339,49 @@ components:
$ref: '#/components/schemas/ServiceDefinitionData'
type: array
type: object
ServiceList:
properties:
data:
$ref: '#/components/schemas/ServiceListData'
type: object
ServiceListData:
properties:
attributes:
$ref: '#/components/schemas/ServiceListDataAttributes'
id:
type: string
type:
$ref: '#/components/schemas/ServiceListDataType'
required:
- type
type: object
ServiceListDataAttributes:
properties:
metadata:
items:
$ref: '#/components/schemas/ServiceListDataAttributesMetadataItems'
type: array
services:
items:
type: string
type: array
type: object
ServiceListDataAttributesMetadataItems:
properties:
isTraced:
type: boolean
isUsm:
type: boolean
type: object
ServiceListDataType:
default: services_list
description: Services list resource type.
enum:
- services_list
example: services_list
type: string
x-enum-varnames:
- SERVICES_LIST
ServiceNowBasicAuth:
description: The definition of the `ServiceNowBasicAuth` object.
properties:
Expand Down Expand Up @@ -61601,6 +61644,26 @@ paths:
permissions:
- apm_retention_filter_write
- apm_pipelines_write
/api/v2/apm/services:
get:
operationId: GetServiceList
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceList'
description: OK
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- apm_read
summary: Get service list
tags:
- APM
/api/v2/app-builder/apps:
delete:
description: Delete multiple apps in a single request from a list of app IDs.
Expand Down Expand Up @@ -69334,9 +69397,6 @@ paths:
operator: OR
permissions:
- incident_read
x-unstable: '**Note**: This endpoint is in Preview.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
post:
description: Create an impact for an incident.
operationId: CreateIncidentImpact
Expand Down Expand Up @@ -69380,9 +69440,6 @@ paths:
operator: OR
permissions:
- incident_write
x-unstable: '**Note**: This endpoint is in Preview.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/incidents/{incident_id}/impacts/{impact_id}:
delete:
description: Delete an incident impact.
Expand Down Expand Up @@ -69413,9 +69470,6 @@ paths:
operator: OR
permissions:
- incident_write
x-unstable: '**Note**: This endpoint is in Preview.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/incidents/{incident_id}/relationships/integrations:
get:
description: Get all integration metadata for an incident.
Expand Down Expand Up @@ -88586,6 +88640,9 @@ servers:
tags:
- description: Configure your API endpoints through the Datadog API.
name: API Management
- description: Observe, troubleshoot, and improve cloud-scale applications with all
telemetry in context
name: APM
- description: Manage configuration of [APM retention filters](https://app.datadoghq.com/apm/traces/retention-filters)
for your organization. You need an API and application key with Admin rights to
interact with this endpoint. See [retention filters](https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/#retention-filters)
Expand Down
17 changes: 17 additions & 0 deletions examples/v2/apm/GetServiceList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Get service list returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.APMApi(configuration);

apiInstance
.getServiceList()
.then((data: v2.ServiceList) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
3 changes: 3 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3092,6 +3092,9 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
},
"operationResponseType": "{}",
},
"v2.GetServiceList": {
"operationResponseType": "ServiceList",
},
"v2.ListApps": {
"limit": {
"type": "number",
Expand Down
13 changes: 13 additions & 0 deletions features/v2/apm.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@endpoint(apm) @endpoint(apm-v2)
Feature: APM
Observe, troubleshoot, and improve cloud-scale applications with all
telemetry in context

@generated @skip @team:DataDog/apm-aoe
Scenario: Get service list returns "OK" response
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "APM" API
And new "GetServiceList" request
When the request is sent
Then the response status is 200 OK
6 changes: 2 additions & 4 deletions features/v2/incidents.feature
Original file line number Diff line number Diff line change
Expand Up @@ -806,16 +806,14 @@ Feature: Incidents

@generated @skip @team:DataDog/incident-app
Scenario: List an incident's impacts returns "Bad Request" response
Given operation "ListIncidentImpacts" enabled
And new "ListIncidentImpacts" request
Given new "ListIncidentImpacts" request
And request contains "incident_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/incident-app
Scenario: List an incident's impacts returns "Not Found" response
Given operation "ListIncidentImpacts" enabled
And new "ListIncidentImpacts" request
Given new "ListIncidentImpacts" request
And request contains "incident_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,12 @@
"type": "idempotent"
}
},
"GetServiceList": {
"tag": "APM",
"undo": {
"type": "safe"
}
},
"DeleteApps": {
"tag": "App Builder",
"undo": {
Expand Down
3 changes: 0 additions & 3 deletions packages/datadog-api-client-common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,12 @@ export function createConfiguration(
"v2.updateDeploymentGate": false,
"v2.updateDeploymentRule": false,
"v2.createIncident": false,
"v2.createIncidentImpact": false,
"v2.createIncidentIntegration": false,
"v2.createIncidentNotificationRule": false,
"v2.createIncidentNotificationTemplate": false,
"v2.createIncidentTodo": false,
"v2.createIncidentType": false,
"v2.deleteIncident": false,
"v2.deleteIncidentImpact": false,
"v2.deleteIncidentIntegration": false,
"v2.deleteIncidentNotificationRule": false,
"v2.deleteIncidentNotificationTemplate": false,
Expand All @@ -302,7 +300,6 @@ export function createConfiguration(
"v2.getIncidentTodo": false,
"v2.getIncidentType": false,
"v2.listIncidentAttachments": false,
"v2.listIncidentImpacts": false,
"v2.listIncidentIntegrations": false,
"v2.listIncidentNotificationRules": false,
"v2.listIncidentNotificationTemplates": false,
Expand Down
133 changes: 133 additions & 0 deletions packages/datadog-api-client-v2/apis/APMApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import { BaseAPIRequestFactory } from "../../datadog-api-client-common/baseapi";
import {
Configuration,
applySecurityAuthentication,
} from "../../datadog-api-client-common/configuration";
import {
RequestContext,
HttpMethod,
ResponseContext,
} from "../../datadog-api-client-common/http/http";

import { logger } from "../../../logger";
import { ObjectSerializer } from "../models/ObjectSerializer";
import { ApiException } from "../../datadog-api-client-common/exception";

import { APIErrorResponse } from "../models/APIErrorResponse";
import { ServiceList } from "../models/ServiceList";

export class APMApiRequestFactory extends BaseAPIRequestFactory {
public async getServiceList(
_options?: Configuration
): Promise<RequestContext> {
const _config = _options || this.configuration;

// Path Params
const localVarPath = "/api/v2/apm/services";

// Make Request Context
const requestContext = _config
.getServer("v2.APMApi.getServiceList")
.makeRequestContext(localVarPath, HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);

// Apply auth methods
applySecurityAuthentication(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
"AuthZ",
]);

return requestContext;
}
}

export class APMApiResponseProcessor {
/**
* 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 getServiceList
* @throws ApiException if the response code was not in [200, 299]
*/
public async getServiceList(response: ResponseContext): Promise<ServiceList> {
const contentType = ObjectSerializer.normalizeMediaType(
response.headers["content-type"]
);
if (response.httpStatusCode === 200) {
const body: ServiceList = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"ServiceList"
) as ServiceList;
return body;
}
if (response.httpStatusCode === 429) {
const bodyText = ObjectSerializer.parse(
await response.body.text(),
contentType
);
let body: APIErrorResponse;
try {
body = ObjectSerializer.deserialize(
bodyText,
"APIErrorResponse"
) as APIErrorResponse;
} catch (error) {
logger.debug(`Got error deserializing error: ${error}`);
throw new ApiException<APIErrorResponse>(
response.httpStatusCode,
bodyText
);
}
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: ServiceList = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"ServiceList",
""
) as ServiceList;
return body;
}

const body = (await response.body.text()) || "";
throw new ApiException<string>(
response.httpStatusCode,
'Unknown API Status Code!\nBody: "' + body + '"'
);
}
}

export class APMApi {
private requestFactory: APMApiRequestFactory;
private responseProcessor: APMApiResponseProcessor;
private configuration: Configuration;

public constructor(
configuration: Configuration,
requestFactory?: APMApiRequestFactory,
responseProcessor?: APMApiResponseProcessor
) {
this.configuration = configuration;
this.requestFactory =
requestFactory || new APMApiRequestFactory(configuration);
this.responseProcessor = responseProcessor || new APMApiResponseProcessor();
}

/**
* @param param The request object
*/
public getServiceList(options?: Configuration): Promise<ServiceList> {
const requestContextPromise = this.requestFactory.getServiceList(options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.getServiceList(responseContext);
});
});
}
}
15 changes: 0 additions & 15 deletions packages/datadog-api-client-v2/apis/IncidentsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ export class IncidentsApiRequestFactory extends BaseAPIRequestFactory {
): Promise<RequestContext> {
const _config = _options || this.configuration;

logger.warn("Using unstable operation 'createIncidentImpact'");
if (!_config.unstableOperations["v2.createIncidentImpact"]) {
throw new Error("Unstable operation 'createIncidentImpact' is disabled");
}

// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new RequiredError("incidentId", "createIncidentImpact");
Expand Down Expand Up @@ -495,11 +490,6 @@ export class IncidentsApiRequestFactory extends BaseAPIRequestFactory {
): Promise<RequestContext> {
const _config = _options || this.configuration;

logger.warn("Using unstable operation 'deleteIncidentImpact'");
if (!_config.unstableOperations["v2.deleteIncidentImpact"]) {
throw new Error("Unstable operation 'deleteIncidentImpact' is disabled");
}

// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new RequiredError("incidentId", "deleteIncidentImpact");
Expand Down Expand Up @@ -1140,11 +1130,6 @@ export class IncidentsApiRequestFactory extends BaseAPIRequestFactory {
): Promise<RequestContext> {
const _config = _options || this.configuration;

logger.warn("Using unstable operation 'listIncidentImpacts'");
if (!_config.unstableOperations["v2.listIncidentImpacts"]) {
throw new Error("Unstable operation 'listIncidentImpacts' is disabled");
}

// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new RequiredError("incidentId", "listIncidentImpacts");
Expand Down
Loading