Skip to content

Commit c7cc65b

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit fc62e2e of spec repo
1 parent 71da684 commit c7cc65b

16 files changed

+504
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63779,6 +63779,65 @@ paths:
6377963779
tags:
6378063780
- Security Monitoring
6378163781
x-codegen-request-body-name: body
63782+
/api/v2/security_monitoring/configuration/suppressions/rules:
63783+
post:
63784+
description: Get the list of suppressions that would affect a rule.
63785+
operationId: GetSuppressionsAffectingFutureRule
63786+
requestBody:
63787+
content:
63788+
application/json:
63789+
schema:
63790+
$ref: '#/components/schemas/SecurityMonitoringRuleCreatePayload'
63791+
required: true
63792+
responses:
63793+
'200':
63794+
content:
63795+
application/json:
63796+
schema:
63797+
$ref: '#/components/schemas/SecurityMonitoringSuppressionsResponse'
63798+
description: OK
63799+
'400':
63800+
$ref: '#/components/responses/BadRequestResponse'
63801+
'403':
63802+
$ref: '#/components/responses/NotAuthorizedResponse'
63803+
'429':
63804+
$ref: '#/components/responses/TooManyRequestsResponse'
63805+
security:
63806+
- apiKeyAuth: []
63807+
appKeyAuth: []
63808+
- AuthZ:
63809+
- security_monitoring_suppressions_read
63810+
summary: Get suppressions affecting future rule
63811+
tags:
63812+
- Security Monitoring
63813+
/api/v2/security_monitoring/configuration/suppressions/rules/{rule_id}:
63814+
get:
63815+
description: Get the list of suppressions that affect a specific existing rule
63816+
by its ID.
63817+
operationId: GetSuppressionsAffectingRule
63818+
parameters:
63819+
- $ref: '#/components/parameters/SecurityMonitoringRuleID'
63820+
responses:
63821+
'200':
63822+
content:
63823+
application/json:
63824+
schema:
63825+
$ref: '#/components/schemas/SecurityMonitoringSuppressionsResponse'
63826+
description: OK
63827+
'403':
63828+
$ref: '#/components/responses/NotAuthorizedResponse'
63829+
'404':
63830+
$ref: '#/components/responses/NotFoundResponse'
63831+
'429':
63832+
$ref: '#/components/responses/TooManyRequestsResponse'
63833+
security:
63834+
- apiKeyAuth: []
63835+
appKeyAuth: []
63836+
- AuthZ:
63837+
- security_monitoring_suppressions_read
63838+
summary: Get suppressions affecting a specific rule
63839+
tags:
63840+
- Security Monitoring
6378263841
/api/v2/security_monitoring/configuration/suppressions/{suppression_id}:
6378363842
delete:
6378463843
description: Delete a specific suppression rule.

api/datadogV2/api_security_monitoring.go

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,6 +2683,164 @@ func (a *SecurityMonitoringApi) GetSignalNotificationRules(ctx _context.Context)
26832683
return localVarReturnValue, localVarHTTPResponse, nil
26842684
}
26852685

2686+
// GetSuppressionsAffectingFutureRule Get suppressions affecting future rule.
2687+
// Get the list of suppressions that would affect a rule.
2688+
func (a *SecurityMonitoringApi) GetSuppressionsAffectingFutureRule(ctx _context.Context, body SecurityMonitoringRuleCreatePayload) (SecurityMonitoringSuppressionsResponse, *_nethttp.Response, error) {
2689+
var (
2690+
localVarHTTPMethod = _nethttp.MethodPost
2691+
localVarPostBody interface{}
2692+
localVarReturnValue SecurityMonitoringSuppressionsResponse
2693+
)
2694+
2695+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.GetSuppressionsAffectingFutureRule")
2696+
if err != nil {
2697+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
2698+
}
2699+
2700+
localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/suppressions/rules"
2701+
2702+
localVarHeaderParams := make(map[string]string)
2703+
localVarQueryParams := _neturl.Values{}
2704+
localVarFormParams := _neturl.Values{}
2705+
localVarHeaderParams["Content-Type"] = "application/json"
2706+
localVarHeaderParams["Accept"] = "application/json"
2707+
2708+
// body params
2709+
localVarPostBody = &body
2710+
if a.Client.Cfg.DelegatedTokenConfig != nil {
2711+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
2712+
if err != nil {
2713+
return localVarReturnValue, nil, err
2714+
}
2715+
} else {
2716+
datadog.SetAuthKeys(
2717+
ctx,
2718+
&localVarHeaderParams,
2719+
[2]string{"apiKeyAuth", "DD-API-KEY"},
2720+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
2721+
)
2722+
}
2723+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
2724+
if err != nil {
2725+
return localVarReturnValue, nil, err
2726+
}
2727+
2728+
localVarHTTPResponse, err := a.Client.CallAPI(req)
2729+
if err != nil || localVarHTTPResponse == nil {
2730+
return localVarReturnValue, localVarHTTPResponse, err
2731+
}
2732+
2733+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
2734+
if err != nil {
2735+
return localVarReturnValue, localVarHTTPResponse, err
2736+
}
2737+
2738+
if localVarHTTPResponse.StatusCode >= 300 {
2739+
newErr := datadog.GenericOpenAPIError{
2740+
ErrorBody: localVarBody,
2741+
ErrorMessage: localVarHTTPResponse.Status,
2742+
}
2743+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 {
2744+
var v APIErrorResponse
2745+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2746+
if err != nil {
2747+
return localVarReturnValue, localVarHTTPResponse, newErr
2748+
}
2749+
newErr.ErrorModel = v
2750+
}
2751+
return localVarReturnValue, localVarHTTPResponse, newErr
2752+
}
2753+
2754+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2755+
if err != nil {
2756+
newErr := datadog.GenericOpenAPIError{
2757+
ErrorBody: localVarBody,
2758+
ErrorMessage: err.Error(),
2759+
}
2760+
return localVarReturnValue, localVarHTTPResponse, newErr
2761+
}
2762+
2763+
return localVarReturnValue, localVarHTTPResponse, nil
2764+
}
2765+
2766+
// GetSuppressionsAffectingRule Get suppressions affecting a specific rule.
2767+
// Get the list of suppressions that affect a specific existing rule by its ID.
2768+
func (a *SecurityMonitoringApi) GetSuppressionsAffectingRule(ctx _context.Context, ruleId string) (SecurityMonitoringSuppressionsResponse, *_nethttp.Response, error) {
2769+
var (
2770+
localVarHTTPMethod = _nethttp.MethodGet
2771+
localVarPostBody interface{}
2772+
localVarReturnValue SecurityMonitoringSuppressionsResponse
2773+
)
2774+
2775+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.GetSuppressionsAffectingRule")
2776+
if err != nil {
2777+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
2778+
}
2779+
2780+
localVarPath := localBasePath + "/api/v2/security_monitoring/configuration/suppressions/rules/{rule_id}"
2781+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{rule_id}", _neturl.PathEscape(datadog.ParameterToString(ruleId, "")))
2782+
2783+
localVarHeaderParams := make(map[string]string)
2784+
localVarQueryParams := _neturl.Values{}
2785+
localVarFormParams := _neturl.Values{}
2786+
localVarHeaderParams["Accept"] = "application/json"
2787+
2788+
if a.Client.Cfg.DelegatedTokenConfig != nil {
2789+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
2790+
if err != nil {
2791+
return localVarReturnValue, nil, err
2792+
}
2793+
} else {
2794+
datadog.SetAuthKeys(
2795+
ctx,
2796+
&localVarHeaderParams,
2797+
[2]string{"apiKeyAuth", "DD-API-KEY"},
2798+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
2799+
)
2800+
}
2801+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
2802+
if err != nil {
2803+
return localVarReturnValue, nil, err
2804+
}
2805+
2806+
localVarHTTPResponse, err := a.Client.CallAPI(req)
2807+
if err != nil || localVarHTTPResponse == nil {
2808+
return localVarReturnValue, localVarHTTPResponse, err
2809+
}
2810+
2811+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
2812+
if err != nil {
2813+
return localVarReturnValue, localVarHTTPResponse, err
2814+
}
2815+
2816+
if localVarHTTPResponse.StatusCode >= 300 {
2817+
newErr := datadog.GenericOpenAPIError{
2818+
ErrorBody: localVarBody,
2819+
ErrorMessage: localVarHTTPResponse.Status,
2820+
}
2821+
if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
2822+
var v APIErrorResponse
2823+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2824+
if err != nil {
2825+
return localVarReturnValue, localVarHTTPResponse, newErr
2826+
}
2827+
newErr.ErrorModel = v
2828+
}
2829+
return localVarReturnValue, localVarHTTPResponse, newErr
2830+
}
2831+
2832+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2833+
if err != nil {
2834+
newErr := datadog.GenericOpenAPIError{
2835+
ErrorBody: localVarBody,
2836+
ErrorMessage: err.Error(),
2837+
}
2838+
return localVarReturnValue, localVarHTTPResponse, newErr
2839+
}
2840+
2841+
return localVarReturnValue, localVarHTTPResponse, nil
2842+
}
2843+
26862844
// GetVulnerabilityNotificationRule Get details of a vulnerability notification rule.
26872845
// Get the details of a notification rule for security vulnerabilities.
26882846
func (a *SecurityMonitoringApi) GetVulnerabilityNotificationRule(ctx _context.Context, id string) (NotificationRuleResponse, *_nethttp.Response, error) {

api/datadogV2/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@
424424
// - [SecurityMonitoringApi.GetSecurityMonitoringSuppression]
425425
// - [SecurityMonitoringApi.GetSignalNotificationRule]
426426
// - [SecurityMonitoringApi.GetSignalNotificationRules]
427+
// - [SecurityMonitoringApi.GetSuppressionsAffectingFutureRule]
428+
// - [SecurityMonitoringApi.GetSuppressionsAffectingRule]
427429
// - [SecurityMonitoringApi.GetVulnerabilityNotificationRule]
428430
// - [SecurityMonitoringApi.GetVulnerabilityNotificationRules]
429431
// - [SecurityMonitoringApi.ListAssetsSBOMs]
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Get suppressions affecting future rule returns "OK" response
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"encoding/json"
8+
"fmt"
9+
"os"
10+
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
12+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
13+
)
14+
15+
func main() {
16+
body := datadogV2.SecurityMonitoringRuleCreatePayload{
17+
SecurityMonitoringStandardRuleCreatePayload: &datadogV2.SecurityMonitoringStandardRuleCreatePayload{
18+
Name: "Example-Security-Monitoring",
19+
Queries: []datadogV2.SecurityMonitoringStandardRuleQuery{
20+
{
21+
Query: datadog.PtrString("@test:true"),
22+
Aggregation: datadogV2.SECURITYMONITORINGRULEQUERYAGGREGATION_COUNT.Ptr(),
23+
GroupByFields: []string{},
24+
DistinctFields: []string{},
25+
Metrics: []string{},
26+
},
27+
},
28+
Filters: []datadogV2.SecurityMonitoringFilter{},
29+
Cases: []datadogV2.SecurityMonitoringRuleCaseCreate{
30+
{
31+
Name: datadog.PtrString(""),
32+
Status: datadogV2.SECURITYMONITORINGRULESEVERITY_INFO,
33+
Condition: datadog.PtrString("a > 0"),
34+
Notifications: []string{},
35+
},
36+
},
37+
Options: datadogV2.SecurityMonitoringRuleOptions{
38+
EvaluationWindow: datadogV2.SECURITYMONITORINGRULEEVALUATIONWINDOW_FIFTEEN_MINUTES.Ptr(),
39+
KeepAlive: datadogV2.SECURITYMONITORINGRULEKEEPALIVE_ONE_HOUR.Ptr(),
40+
MaxSignalDuration: datadogV2.SECURITYMONITORINGRULEMAXSIGNALDURATION_ONE_DAY.Ptr(),
41+
},
42+
Message: "Test rule",
43+
Tags: []string{},
44+
IsEnabled: true,
45+
Type: datadogV2.SECURITYMONITORINGRULETYPECREATE_LOG_DETECTION.Ptr(),
46+
}}
47+
ctx := datadog.NewDefaultContext(context.Background())
48+
configuration := datadog.NewConfiguration()
49+
apiClient := datadog.NewAPIClient(configuration)
50+
api := datadogV2.NewSecurityMonitoringApi(apiClient)
51+
resp, r, err := api.GetSuppressionsAffectingFutureRule(ctx, body)
52+
53+
if err != nil {
54+
fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.GetSuppressionsAffectingFutureRule`: %v\n", err)
55+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
56+
}
57+
58+
responseContent, _ := json.MarshalIndent(resp, "", " ")
59+
fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.GetSuppressionsAffectingFutureRule`:\n%s\n", responseContent)
60+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Get suppressions affecting a specific rule returns "OK" response
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"encoding/json"
8+
"fmt"
9+
"os"
10+
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
12+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
13+
)
14+
15+
func main() {
16+
// there is a valid "security_rule" in the system
17+
SecurityRuleID := os.Getenv("SECURITY_RULE_ID")
18+
19+
ctx := datadog.NewDefaultContext(context.Background())
20+
configuration := datadog.NewConfiguration()
21+
apiClient := datadog.NewAPIClient(configuration)
22+
api := datadogV2.NewSecurityMonitoringApi(apiClient)
23+
resp, r, err := api.GetSuppressionsAffectingRule(ctx, SecurityRuleID)
24+
25+
if err != nil {
26+
fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.GetSuppressionsAffectingRule`: %v\n", err)
27+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
28+
}
29+
30+
responseContent, _ := json.MarshalIndent(resp, "", " ")
31+
fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.GetSuppressionsAffectingRule`:\n%s\n", responseContent)
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-08-30T15:29:04.687Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
interactions:
2+
- request:
3+
body: ''
4+
form: {}
5+
headers:
6+
Accept:
7+
- application/json
8+
id: 0
9+
method: GET
10+
url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/rules/aaa-bbb-ccc-ddd
11+
response:
12+
body: '{"errors":["not_found(Threat detection rule not found: aaa-bbb-ccc-ddd)"]}'
13+
code: 404
14+
duration: 0ms
15+
headers:
16+
Content-Type:
17+
- application/json
18+
status: 404 Not Found
19+
version: 2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-08-30T11:40:50.061Z

0 commit comments

Comments
 (0)