Skip to content

Commit 58d892e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
add suppression version history (DataDog#3490)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 4bf2b08 commit 58d892e

22 files changed

Lines changed: 1139 additions & 131 deletions

.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.

api/datadog/configuration.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,12 +661,14 @@ func NewConfiguration() *Configuration {
661661
"v2.UpdateDeploymentGate": false,
662662
"v2.UpdateDeploymentRule": false,
663663
"v2.CreateIncident": false,
664+
"v2.CreateIncidentImpact": false,
664665
"v2.CreateIncidentIntegration": false,
665666
"v2.CreateIncidentNotificationRule": false,
666667
"v2.CreateIncidentNotificationTemplate": false,
667668
"v2.CreateIncidentTodo": false,
668669
"v2.CreateIncidentType": false,
669670
"v2.DeleteIncident": false,
671+
"v2.DeleteIncidentImpact": false,
670672
"v2.DeleteIncidentIntegration": false,
671673
"v2.DeleteIncidentNotificationRule": false,
672674
"v2.DeleteIncidentNotificationTemplate": false,
@@ -679,6 +681,7 @@ func NewConfiguration() *Configuration {
679681
"v2.GetIncidentTodo": false,
680682
"v2.GetIncidentType": false,
681683
"v2.ListIncidentAttachments": false,
684+
"v2.ListIncidentImpacts": false,
682685
"v2.ListIncidentIntegrations": false,
683686
"v2.ListIncidentNotificationRules": false,
684687
"v2.ListIncidentNotificationTemplates": false,

api/datadogV2/api_incidents.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ func (a *IncidentsApi) CreateIncidentImpact(ctx _context.Context, incidentId str
141141
optionalParams = o[0]
142142
}
143143

144+
operationId := "v2.CreateIncidentImpact"
145+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
146+
if !isOperationEnabled {
147+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
148+
}
149+
if isOperationEnabled && a.Client.Cfg.Debug {
150+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
151+
}
152+
144153
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentImpact")
145154
if err != nil {
146155
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
@@ -748,6 +757,15 @@ func (a *IncidentsApi) DeleteIncidentImpact(ctx _context.Context, incidentId str
748757
localVarPostBody interface{}
749758
)
750759

760+
operationId := "v2.DeleteIncidentImpact"
761+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
762+
if !isOperationEnabled {
763+
return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
764+
}
765+
if isOperationEnabled && a.Client.Cfg.Debug {
766+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
767+
}
768+
751769
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentImpact")
752770
if err != nil {
753771
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
@@ -2019,6 +2037,15 @@ func (a *IncidentsApi) ListIncidentImpacts(ctx _context.Context, incidentId stri
20192037
optionalParams = o[0]
20202038
}
20212039

2040+
operationId := "v2.ListIncidentImpacts"
2041+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
2042+
if !isOperationEnabled {
2043+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
2044+
}
2045+
if isOperationEnabled && a.Client.Cfg.Debug {
2046+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
2047+
}
2048+
20222049
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentImpacts")
20232050
if err != nil {
20242051
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}

api/datadogV2/api_security_monitoring.go

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3368,6 +3368,122 @@ func (a *SecurityMonitoringApi) GetSignalNotificationRules(ctx _context.Context)
33683368
return localVarReturnValue, localVarHTTPResponse, nil
33693369
}
33703370

3371+
// GetSuppressionVersionHistoryOptionalParameters holds optional parameters for GetSuppressionVersionHistory.
3372+
type GetSuppressionVersionHistoryOptionalParameters struct {
3373+
PageSize *int64
3374+
PageNumber *int64
3375+
}
3376+
3377+
// NewGetSuppressionVersionHistoryOptionalParameters creates an empty struct for parameters.
3378+
func NewGetSuppressionVersionHistoryOptionalParameters() *GetSuppressionVersionHistoryOptionalParameters {
3379+
this := GetSuppressionVersionHistoryOptionalParameters{}
3380+
return &this
3381+
}
3382+
3383+
// WithPageSize sets the corresponding parameter name and returns the struct.
3384+
func (r *GetSuppressionVersionHistoryOptionalParameters) WithPageSize(pageSize int64) *GetSuppressionVersionHistoryOptionalParameters {
3385+
r.PageSize = &pageSize
3386+
return r
3387+
}
3388+
3389+
// WithPageNumber sets the corresponding parameter name and returns the struct.
3390+
func (r *GetSuppressionVersionHistoryOptionalParameters) WithPageNumber(pageNumber int64) *GetSuppressionVersionHistoryOptionalParameters {
3391+
r.PageNumber = &pageNumber
3392+
return r
3393+
}
3394+
3395+
// GetSuppressionVersionHistory Get a suppression's version history.
3396+
// Get a suppression's version history.
3397+
func (a *SecurityMonitoringApi) GetSuppressionVersionHistory(ctx _context.Context, suppressionId string, o ...GetSuppressionVersionHistoryOptionalParameters) (GetSuppressionVersionHistoryResponse, *_nethttp.Response, error) {
3398+
var (
3399+
localVarHTTPMethod = _nethttp.MethodGet
3400+
localVarPostBody interface{}
3401+
localVarReturnValue GetSuppressionVersionHistoryResponse
3402+
optionalParams GetSuppressionVersionHistoryOptionalParameters
3403+
)
3404+
3405+
if len(o) > 1 {
3406+
return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetSuppressionVersionHistoryOptionalParameters is allowed")
3407+
}
3408+
if len(o) == 1 {
3409+
optionalParams = o[0]
3410+
}
3411+
3412+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.GetSuppressionVersionHistory")
3413+
if err != nil {
3414+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
3415+
}
3416+
3417+
localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/suppressions/{suppression_id}/version_history"
3418+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{suppression_id}", _neturl.PathEscape(datadog.ParameterToString(suppressionId, "")))
3419+
3420+
localVarHeaderParams := make(map[string]string)
3421+
localVarQueryParams := _neturl.Values{}
3422+
localVarFormParams := _neturl.Values{}
3423+
if optionalParams.PageSize != nil {
3424+
localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, ""))
3425+
}
3426+
if optionalParams.PageNumber != nil {
3427+
localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, ""))
3428+
}
3429+
localVarHeaderParams["Accept"] = "application/json"
3430+
3431+
if a.Client.Cfg.DelegatedTokenConfig != nil {
3432+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
3433+
if err != nil {
3434+
return localVarReturnValue, nil, err
3435+
}
3436+
} else {
3437+
datadog.SetAuthKeys(
3438+
ctx,
3439+
&localVarHeaderParams,
3440+
[2]string{"apiKeyAuth", "DD-API-KEY"},
3441+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
3442+
)
3443+
}
3444+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
3445+
if err != nil {
3446+
return localVarReturnValue, nil, err
3447+
}
3448+
3449+
localVarHTTPResponse, err := a.Client.CallAPI(req)
3450+
if err != nil || localVarHTTPResponse == nil {
3451+
return localVarReturnValue, localVarHTTPResponse, err
3452+
}
3453+
3454+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
3455+
if err != nil {
3456+
return localVarReturnValue, localVarHTTPResponse, err
3457+
}
3458+
3459+
if localVarHTTPResponse.StatusCode >= 300 {
3460+
newErr := datadog.GenericOpenAPIError{
3461+
ErrorBody: localVarBody,
3462+
ErrorMessage: localVarHTTPResponse.Status,
3463+
}
3464+
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
3465+
var v APIErrorResponse
3466+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
3467+
if err != nil {
3468+
return localVarReturnValue, localVarHTTPResponse, newErr
3469+
}
3470+
newErr.ErrorModel = v
3471+
}
3472+
return localVarReturnValue, localVarHTTPResponse, newErr
3473+
}
3474+
3475+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
3476+
if err != nil {
3477+
newErr := datadog.GenericOpenAPIError{
3478+
ErrorBody: localVarBody,
3479+
ErrorMessage: err.Error(),
3480+
}
3481+
return localVarReturnValue, localVarHTTPResponse, newErr
3482+
}
3483+
3484+
return localVarReturnValue, localVarHTTPResponse, nil
3485+
}
3486+
33713487
// GetSuppressionsAffectingFutureRule Get suppressions affecting future rule.
33723488
// Get the list of suppressions that would affect a rule.
33733489
func (a *SecurityMonitoringApi) GetSuppressionsAffectingFutureRule(ctx _context.Context, body SecurityMonitoringRuleCreatePayload) (SecurityMonitoringSuppressionsResponse, *_nethttp.Response, error) {

0 commit comments

Comments
 (0)