Skip to content

Commit e9d1e30

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
add suppression version history (#1050)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 29971ba commit e9d1e30

22 files changed

+1124
-54
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 114 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24779,6 +24779,30 @@ components:
2477924779
required:
2478024780
- data
2478124781
type: object
24782+
GetSuppressionVersionHistoryData:
24783+
description: Data for the suppression version history.
24784+
properties:
24785+
attributes:
24786+
$ref: '#/components/schemas/SuppressionVersionHistory'
24787+
id:
24788+
description: ID of the suppression.
24789+
type: string
24790+
type:
24791+
$ref: '#/components/schemas/GetSuppressionVersionHistoryDataType'
24792+
type: object
24793+
GetSuppressionVersionHistoryDataType:
24794+
description: Type of data.
24795+
enum:
24796+
- suppression_version_history
24797+
type: string
24798+
x-enum-varnames:
24799+
- SUPPRESSIONVERSIONHISTORY
24800+
GetSuppressionVersionHistoryResponse:
24801+
description: Response for getting the suppression version history.
24802+
properties:
24803+
data:
24804+
$ref: '#/components/schemas/GetSuppressionVersionHistoryData'
24805+
type: object
2478224806
GetTeamMembershipsSort:
2478324807
description: Specifies the order of returned team memberships
2478424808
enum:
@@ -44242,38 +44266,13 @@ components:
4424244266
description: The `RuleVersionHistory` `data`.
4424344267
type: object
4424444268
type: object
44245-
RuleVersionUpdate:
44246-
description: A change in a rule version.
44247-
properties:
44248-
change:
44249-
description: The new value of the field.
44250-
example: cloud_provider:aws
44251-
type: string
44252-
field:
44253-
description: The field that was changed.
44254-
example: Tags
44255-
type: string
44256-
type:
44257-
$ref: '#/components/schemas/RuleVersionUpdateType'
44258-
type: object
44259-
RuleVersionUpdateType:
44260-
description: The type of change.
44261-
enum:
44262-
- create
44263-
- update
44264-
- delete
44265-
type: string
44266-
x-enum-varnames:
44267-
- CREATE
44268-
- UPDATE
44269-
- DELETE
4427044269
RuleVersions:
4427144270
description: A rule version with a list of updates.
4427244271
properties:
4427344272
changes:
4427444273
description: A list of changes.
4427544274
items:
44276-
$ref: '#/components/schemas/RuleVersionUpdate'
44275+
$ref: '#/components/schemas/VersionHistoryUpdate'
4427744276
type: array
4427844277
rule:
4427944278
$ref: '#/components/schemas/SecurityMonitoringRuleResponse'
@@ -52833,6 +52832,32 @@ components:
5283352832
format: double
5283452833
type: number
5283552834
type: object
52835+
SuppressionVersionHistory:
52836+
description: Response object containing the version history of a suppression.
52837+
properties:
52838+
count:
52839+
description: The number of suppression versions.
52840+
format: int32
52841+
maximum: 2147483647
52842+
type: integer
52843+
data:
52844+
additionalProperties:
52845+
$ref: '#/components/schemas/SuppressionVersions'
52846+
description: A suppression version with a list of updates.
52847+
description: The version history of a suppression.
52848+
type: object
52849+
type: object
52850+
SuppressionVersions:
52851+
description: A suppression version with a list of updates.
52852+
properties:
52853+
changes:
52854+
description: A list of changes.
52855+
items:
52856+
$ref: '#/components/schemas/VersionHistoryUpdate'
52857+
type: array
52858+
suppression:
52859+
$ref: '#/components/schemas/SecurityMonitoringSuppressionAttributes'
52860+
type: object
5283652861
TableResultV2:
5283752862
description: A reference table resource containing its full configuration and
5283852863
state.
@@ -57163,6 +57188,31 @@ components:
5716357188
example: 1
5716457189
format: int64
5716557190
type: integer
57191+
VersionHistoryUpdate:
57192+
description: A change in a rule version.
57193+
properties:
57194+
change:
57195+
description: The new value of the field.
57196+
example: cloud_provider:aws
57197+
type: string
57198+
field:
57199+
description: The field that was changed.
57200+
example: Tags
57201+
type: string
57202+
type:
57203+
$ref: '#/components/schemas/VersionHistoryUpdateType'
57204+
type: object
57205+
VersionHistoryUpdateType:
57206+
description: The type of change.
57207+
enum:
57208+
- create
57209+
- update
57210+
- delete
57211+
type: string
57212+
x-enum-varnames:
57213+
- CREATE
57214+
- UPDATE
57215+
- DELETE
5716657216
VirusTotalAPIKey:
5716757217
description: The definition of the `VirusTotalAPIKey` object.
5716857218
properties:
@@ -69034,6 +69084,9 @@ paths:
6903469084
operator: OR
6903569085
permissions:
6903669086
- incident_read
69087+
x-unstable: '**Note**: This endpoint is in Preview.
69088+
69089+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6903769090
post:
6903869091
description: Create an impact for an incident.
6903969092
operationId: CreateIncidentImpact
@@ -69077,6 +69130,9 @@ paths:
6907769130
operator: OR
6907869131
permissions:
6907969132
- incident_write
69133+
x-unstable: '**Note**: This endpoint is in Preview.
69134+
69135+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6908069136
/api/v2/incidents/{incident_id}/impacts/{impact_id}:
6908169137
delete:
6908269138
description: Delete an incident impact.
@@ -69107,6 +69163,9 @@ paths:
6910769163
operator: OR
6910869164
permissions:
6910969165
- incident_write
69166+
x-unstable: '**Note**: This endpoint is in Preview.
69167+
69168+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6911069169
/api/v2/incidents/{incident_id}/relationships/integrations:
6911169170
get:
6911269171
description: Get all integration metadata for an incident.
@@ -82039,6 +82098,35 @@ paths:
8203982098
summary: Update a suppression rule
8204082099
tags:
8204182100
- Security Monitoring
82101+
/api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history:
82102+
get:
82103+
description: Get a suppression's version history.
82104+
operationId: GetSuppressionVersionHistory
82105+
parameters:
82106+
- $ref: '#/components/parameters/SecurityMonitoringSuppressionID'
82107+
- $ref: '#/components/parameters/PageSize'
82108+
- $ref: '#/components/parameters/PageNumber'
82109+
responses:
82110+
'200':
82111+
content:
82112+
application/json:
82113+
schema:
82114+
$ref: '#/components/schemas/GetSuppressionVersionHistoryResponse'
82115+
description: OK
82116+
'403':
82117+
$ref: '#/components/responses/NotAuthorizedResponse'
82118+
'404':
82119+
$ref: '#/components/responses/NotFoundResponse'
82120+
'429':
82121+
$ref: '#/components/responses/TooManyRequestsResponse'
82122+
security:
82123+
- apiKeyAuth: []
82124+
appKeyAuth: []
82125+
- AuthZ:
82126+
- security_monitoring_suppressions_read
82127+
summary: Get a suppression's version history
82128+
tags:
82129+
- Security Monitoring
8204282130
/api/v2/security_monitoring/rules:
8204382131
get:
8204482132
description: List rules.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Get a suppression's version history returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_security_monitoring::GetSuppressionVersionHistoryOptionalParams;
4+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "suppression" in the system
9+
let suppression_data_id = std::env::var("SUPPRESSION_DATA_ID").unwrap();
10+
let configuration = datadog::Configuration::new();
11+
let api = SecurityMonitoringAPI::with_config(configuration);
12+
let resp = api
13+
.get_suppression_version_history(
14+
suppression_data_id.clone(),
15+
GetSuppressionVersionHistoryOptionalParams::default(),
16+
)
17+
.await;
18+
if let Ok(value) = resp {
19+
println!("{:#?}", value);
20+
} else {
21+
println!("{:#?}", resp.unwrap_err());
22+
}
23+
}

src/datadog/configuration.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,14 @@ impl Default for Configuration {
188188
("v2.update_deployment_gate".to_owned(), false),
189189
("v2.update_deployment_rule".to_owned(), false),
190190
("v2.create_incident".to_owned(), false),
191+
("v2.create_incident_impact".to_owned(), false),
191192
("v2.create_incident_integration".to_owned(), false),
192193
("v2.create_incident_notification_rule".to_owned(), false),
193194
("v2.create_incident_notification_template".to_owned(), false),
194195
("v2.create_incident_todo".to_owned(), false),
195196
("v2.create_incident_type".to_owned(), false),
196197
("v2.delete_incident".to_owned(), false),
198+
("v2.delete_incident_impact".to_owned(), false),
197199
("v2.delete_incident_integration".to_owned(), false),
198200
("v2.delete_incident_notification_rule".to_owned(), false),
199201
("v2.delete_incident_notification_template".to_owned(), false),
@@ -206,6 +208,7 @@ impl Default for Configuration {
206208
("v2.get_incident_todo".to_owned(), false),
207209
("v2.get_incident_type".to_owned(), false),
208210
("v2.list_incident_attachments".to_owned(), false),
211+
("v2.list_incident_impacts".to_owned(), false),
209212
("v2.list_incident_integrations".to_owned(), false),
210213
("v2.list_incident_notification_rules".to_owned(), false),
211214
("v2.list_incident_notification_templates".to_owned(), false),

src/datadogV2/api/api_incidents.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,14 @@ impl IncidentsAPI {
901901
> {
902902
let local_configuration = &self.config;
903903
let operation_id = "v2.create_incident_impact";
904+
if local_configuration.is_unstable_operation_enabled(operation_id) {
905+
warn!("Using unstable operation {operation_id}");
906+
} else {
907+
let local_error = datadog::UnstableOperationDisabledError {
908+
msg: "Operation 'v2.create_incident_impact' is not enabled".to_string(),
909+
};
910+
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
911+
}
904912

905913
// unbox and build optional parameters
906914
let include = params.include;
@@ -1987,6 +1995,14 @@ impl IncidentsAPI {
19871995
) -> Result<datadog::ResponseContent<()>, datadog::Error<DeleteIncidentImpactError>> {
19881996
let local_configuration = &self.config;
19891997
let operation_id = "v2.delete_incident_impact";
1998+
if local_configuration.is_unstable_operation_enabled(operation_id) {
1999+
warn!("Using unstable operation {operation_id}");
2000+
} else {
2001+
let local_error = datadog::UnstableOperationDisabledError {
2002+
msg: "Operation 'v2.delete_incident_impact' is not enabled".to_string(),
2003+
};
2004+
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
2005+
}
19902006

19912007
let local_client = &self.client;
19922008

@@ -3521,6 +3537,14 @@ impl IncidentsAPI {
35213537
> {
35223538
let local_configuration = &self.config;
35233539
let operation_id = "v2.list_incident_impacts";
3540+
if local_configuration.is_unstable_operation_enabled(operation_id) {
3541+
warn!("Using unstable operation {operation_id}");
3542+
} else {
3543+
let local_error = datadog::UnstableOperationDisabledError {
3544+
msg: "Operation 'v2.list_incident_impacts' is not enabled".to_string(),
3545+
};
3546+
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
3547+
}
35243548

35253549
// unbox and build optional parameters
35263550
let include = params.include;

0 commit comments

Comments
 (0)