Skip to content

Commit 5354e55

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit a7ab5a9b of spec repo
1 parent cf2cb9f commit 5354e55

File tree

16 files changed

+735
-11
lines changed

16 files changed

+735
-11
lines changed

.apigentools-info

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-07-30 19:24:57.172113",
8-
"spec_repo_commit": "edbd396a"
7+
"regenerated": "2024-07-31 16:55:34.024946",
8+
"spec_repo_commit": "a7ab5a9b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-07-30 19:24:57.190109",
13-
"spec_repo_commit": "edbd396a"
12+
"regenerated": "2024-07-31 16:55:34.042937",
13+
"spec_repo_commit": "a7ab5a9b"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

+74-5
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ components:
464464
schema:
465465
type: string
466466
RuleId:
467-
description: The ID of the rule/scorecard.
467+
description: The ID of the rule.
468468
in: path
469469
name: rule_id
470470
required: true
@@ -16546,7 +16546,7 @@ components:
1654616546
properties:
1654716547
id:
1654816548
description: The unique ID for a scorecard.
16549-
example: 00000000-0000-beef-0000-000000000000
16549+
example: q8MQxk8TCqrHnWkp
1655016550
type: string
1655116551
type:
1655216552
$ref: '#/components/schemas/ScorecardType'
@@ -17391,7 +17391,7 @@ components:
1739117391
type: object
1739217392
RuleId:
1739317393
description: The unique ID for a scorecard rule.
17394-
example: 00000000-0000-beef-0000-000000000000
17394+
example: q8MQxk8TCqrHnWkx
1739517395
type: string
1739617396
RuleOutcomeRelationships:
1739717397
description: The JSON:API relationship to a scorecard rule.
@@ -23230,6 +23230,38 @@ components:
2323023230
id:
2323123231
$ref: '#/components/schemas/ApiID'
2323223232
type: object
23233+
UpdateRuleRequest:
23234+
description: Request to update a scorecard rule.
23235+
properties:
23236+
data:
23237+
$ref: '#/components/schemas/UpdateRuleRequestData'
23238+
type: object
23239+
UpdateRuleRequestData:
23240+
description: Data for the request to update a scorecard rule.
23241+
properties:
23242+
attributes:
23243+
$ref: '#/components/schemas/RuleAttributes'
23244+
type:
23245+
$ref: '#/components/schemas/RuleType'
23246+
type: object
23247+
UpdateRuleResponse:
23248+
description: The response from a rule update request.
23249+
properties:
23250+
data:
23251+
$ref: '#/components/schemas/UpdateRuleResponseData'
23252+
type: object
23253+
UpdateRuleResponseData:
23254+
description: The data for a rule update response.
23255+
properties:
23256+
attributes:
23257+
$ref: '#/components/schemas/RuleAttributes'
23258+
id:
23259+
$ref: '#/components/schemas/RuleId'
23260+
relationships:
23261+
$ref: '#/components/schemas/RelationshipToRule'
23262+
type:
23263+
$ref: '#/components/schemas/RuleType'
23264+
type: object
2323323265
UsageApplicationSecurityMonitoringResponse:
2323423266
description: Application Security Monitoring usage response.
2323523267
properties:
@@ -33671,6 +33703,43 @@ paths:
3367133703
x-unstable: '**Note**: This endpoint is in public beta.
3367233704

3367333705
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
33706+
put:
33707+
description: Updates an existing rule.
33708+
operationId: UpdateScorecardRule
33709+
parameters:
33710+
- $ref: '#/components/parameters/RuleId'
33711+
requestBody:
33712+
content:
33713+
application/json:
33714+
schema:
33715+
$ref: '#/components/schemas/UpdateRuleRequest'
33716+
description: Rule attributes.
33717+
required: true
33718+
responses:
33719+
'200':
33720+
content:
33721+
application/json:
33722+
schema:
33723+
$ref: '#/components/schemas/UpdateRuleResponse'
33724+
description: Rule updated successfully
33725+
'400':
33726+
$ref: '#/components/responses/BadRequestResponse'
33727+
'403':
33728+
$ref: '#/components/responses/ForbiddenResponse'
33729+
'429':
33730+
$ref: '#/components/responses/TooManyRequestsResponse'
33731+
security:
33732+
- apiKeyAuth: []
33733+
appKeyAuth: []
33734+
- AuthZ:
33735+
- apm_service_catalog_write
33736+
summary: Update an existing rule
33737+
tags:
33738+
- Service Scorecards
33739+
x-codegen-request-body-name: body
33740+
x-unstable: '**Note**: This endpoint is in public beta.
33741+
33742+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
3367433743
/api/v2/security/cloud_workload/policy/download:
3367533744
get:
3367633745
description: 'The download endpoint generates a Cloud Workload Security policy
@@ -38387,8 +38456,8 @@ tags:
3838738456

3838838457
and improve communication with internal and external users.'
3838938458
name: Service Level Objectives
38390-
- description: 'API to create, update scorecard rules and outcomes. See [Service Scorecards](https://docs.datadoghq.com/service_catalog/scorecards)
38391-
for more information.
38459+
- description: 'API to create and update scorecard rules and outcomes. See [Service
38460+
Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for more information.
3839238461

3839338462

3839438463
This feature is currently in BETA. If you have any feedback, contact [Datadog
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2024-07-30T02:47:12.976Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
"log": {
3+
"_recordingName": "Service Scorecards/Update an existing rule returns \"Rule updated successfully\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "ec027b2fbb4ef4cf6197f36609ded2d9",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 216,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 569,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"data\":{\"attributes\":{\"enabled\":true,\"name\":\"Test-Update_an_existing_rule_returns_Rule_updated_successfully_response-1722307632\",\"owner\":\"Datadog\",\"scorecard_name\":\"OpenAPI Spec Test Best Practices\"},\"type\":\"rule\"}}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/scorecard/rules"
39+
},
40+
"response": {
41+
"bodySize": 473,
42+
"content": {
43+
"mimeType": "application/vnd.api+json",
44+
"size": 473,
45+
"text": "{\"data\":{\"id\":\"L2uJseIxQCRLg_2z\",\"type\":\"rule\",\"attributes\":{\"category\":\"OpenAPI Spec Test Best Practices\",\"created_at\":\"2024-07-30T02:47:13.117302334Z\",\"custom\":true,\"enabled\":true,\"modified_at\":\"2024-07-30T02:47:13.117302334Z\",\"name\":\"Test-Update_an_existing_rule_returns_Rule_updated_successfully_response-1722307632\",\"owner\":\"Datadog\",\"scorecard_name\":\"OpenAPI Spec Test Best Practices\"},\"relationships\":{\"scorecard\":{\"data\":{\"id\":\"qsxpoYRhU_yz\",\"type\":\"scorecard\"}}}}}"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/vnd.api+json"
52+
}
53+
],
54+
"headersSize": 525,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 201,
58+
"statusText": "Created"
59+
},
60+
"startedDateTime": "2024-07-30T02:47:12.980Z",
61+
"time": 118
62+
},
63+
{
64+
"_id": "c173c2c3af4ee37c6f4319a3182dd04d",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 229,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
},
76+
{
77+
"_fromType": "array",
78+
"name": "content-type",
79+
"value": "application/json"
80+
}
81+
],
82+
"headersSize": 585,
83+
"httpVersion": "HTTP/1.1",
84+
"method": "PUT",
85+
"postData": {
86+
"mimeType": "application/json",
87+
"params": [],
88+
"text": "{\"data\":{\"attributes\":{\"description\":\"Updated description via test\",\"enabled\":true,\"name\":\"Test-Update_an_existing_rule_returns_Rule_updated_successfully_response-1722307632\",\"scorecard_name\":\"OpenAPI Spec Test Best Practices\"}}}"
89+
},
90+
"queryString": [],
91+
"url": "https://api.datadoghq.com/api/v2/scorecard/rules/L2uJseIxQCRLg_2z"
92+
},
93+
"response": {
94+
"bodySize": 494,
95+
"content": {
96+
"mimeType": "application/vnd.api+json",
97+
"size": 494,
98+
"text": "{\"data\":{\"id\":\"L2uJseIxQCRLg_2z\",\"type\":\"rule\",\"attributes\":{\"category\":\"OpenAPI Spec Test Best Practices\",\"created_at\":\"2024-07-30T02:47:13.117302Z\",\"custom\":true,\"description\":\"Updated description via test\",\"enabled\":true,\"modified_at\":\"2024-07-30T02:47:13.231478Z\",\"name\":\"Test-Update_an_existing_rule_returns_Rule_updated_successfully_response-1722307632\",\"scorecard_name\":\"OpenAPI Spec Test Best Practices\"},\"relationships\":{\"scorecard\":{\"data\":{\"id\":\"qsxpoYRhU_yz\",\"type\":\"scorecard\"}}}}}"
99+
},
100+
"cookies": [],
101+
"headers": [
102+
{
103+
"name": "content-type",
104+
"value": "application/vnd.api+json"
105+
}
106+
],
107+
"headersSize": 525,
108+
"httpVersion": "HTTP/1.1",
109+
"redirectURL": "",
110+
"status": 200,
111+
"statusText": "OK"
112+
},
113+
"startedDateTime": "2024-07-30T02:47:13.102Z",
114+
"time": 106
115+
},
116+
{
117+
"_id": "5d467d19526b6dacec4bbef75cf79c19",
118+
"_order": 0,
119+
"cache": {},
120+
"request": {
121+
"bodySize": 0,
122+
"cookies": [],
123+
"headers": [
124+
{
125+
"_fromType": "array",
126+
"name": "accept",
127+
"value": "*/*"
128+
}
129+
],
130+
"headersSize": 522,
131+
"httpVersion": "HTTP/1.1",
132+
"method": "DELETE",
133+
"queryString": [],
134+
"url": "https://api.datadoghq.com/api/v2/scorecard/rules/L2uJseIxQCRLg_2z"
135+
},
136+
"response": {
137+
"bodySize": 0,
138+
"content": {
139+
"mimeType": "application/vnd.api+json",
140+
"size": 0
141+
},
142+
"cookies": [],
143+
"headers": [
144+
{
145+
"name": "content-type",
146+
"value": "application/vnd.api+json"
147+
}
148+
],
149+
"headersSize": 504,
150+
"httpVersion": "HTTP/1.1",
151+
"redirectURL": "",
152+
"status": 204,
153+
"statusText": "No Content"
154+
},
155+
"startedDateTime": "2024-07-30T02:47:13.213Z",
156+
"time": 250
157+
}
158+
],
159+
"pages": [],
160+
"version": "1.2"
161+
}
162+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Update an existing rule returns "Rule updated successfully" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.updateScorecardRule"] = true;
9+
const apiInstance = new v2.ServiceScorecardsApi(configuration);
10+
11+
// there is a valid "create_scorecard_rule" in the system
12+
const CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME = process.env
13+
.CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME as string;
14+
const CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME = process.env
15+
.CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME as string;
16+
const CREATE_SCORECARD_RULE_DATA_ID = process.env
17+
.CREATE_SCORECARD_RULE_DATA_ID as string;
18+
19+
const params: v2.ServiceScorecardsApiUpdateScorecardRuleRequest = {
20+
body: {
21+
data: {
22+
attributes: {
23+
enabled: true,
24+
name: CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME,
25+
scorecardName: CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME,
26+
description: "Updated description via test",
27+
},
28+
},
29+
},
30+
ruleId: CREATE_SCORECARD_RULE_DATA_ID,
31+
};
32+
33+
apiInstance
34+
.updateScorecardRule(params)
35+
.then((data: v2.UpdateRuleResponse) => {
36+
console.log(
37+
"API called successfully. Returned data: " + JSON.stringify(data)
38+
);
39+
})
40+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

+11
Original file line numberDiff line numberDiff line change
@@ -5193,6 +5193,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
51935193
},
51945194
"operationResponseType": "void",
51955195
},
5196+
"v2.UpdateScorecardRule": {
5197+
"ruleId": {
5198+
"type": "string",
5199+
"format": "",
5200+
},
5201+
"body": {
5202+
"type": "UpdateRuleRequest",
5203+
"format": "",
5204+
},
5205+
"operationResponseType": "UpdateRuleResponse",
5206+
},
51965207
"v2.ListScanningGroups": {
51975208
"operationResponseType": "SensitiveDataScannerGetConfigResponse",
51985209
},

features/v2/service_scorecards.feature

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@endpoint(service-scorecards) @endpoint(service-scorecards-v2)
22
Feature: Service Scorecards
3-
API to create, update scorecard rules and outcomes. See [Service
3+
API to create and update scorecard rules and outcomes. See [Service
44
Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for
55
more information. This feature is currently in BETA. If you have any
66
feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
@@ -120,3 +120,22 @@ Feature: Service Scorecards
120120
When the request with pagination is sent
121121
Then the response status is 200 OK
122122
And the response has 4 items
123+
124+
@generated @skip @team:DataDog/service-catalog
125+
Scenario: Update an existing rule returns "Bad Request" response
126+
Given operation "UpdateScorecardRule" enabled
127+
And new "UpdateScorecardRule" request
128+
And request contains "rule_id" parameter from "REPLACE.ME"
129+
And body with value {"data": {"attributes": {"enabled": true, "name": "Team Defined", "scorecard_name": "Deployments automated via Deployment Trains"}, "type": "rule"}}
130+
When the request is sent
131+
Then the response status is 400 Bad Request
132+
133+
@team:DataDog/service-catalog
134+
Scenario: Update an existing rule returns "Rule updated successfully" response
135+
Given operation "UpdateScorecardRule" enabled
136+
And there is a valid "create_scorecard_rule" in the system
137+
And new "UpdateScorecardRule" request
138+
And request contains "rule_id" parameter from "create_scorecard_rule.data.id"
139+
And body with value {"data": { "attributes" : {"enabled": true, "name": "{{create_scorecard_rule.data.attributes.name}}", "scorecard_name": "{{create_scorecard_rule.data.attributes.scorecard_name}}", "description": "Updated description via test"}}}
140+
When the request is sent
141+
Then the response status is 200 Rule updated successfully

0 commit comments

Comments
 (0)