Skip to content

Commit 8c2c5d9

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Adds async Scorecard outcomes batch update endpoint (#3277)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent b6d3002 commit 8c2c5d9

26 files changed

Lines changed: 1211 additions & 6 deletions

File tree

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "62a19e4",
3-
"generated": "2025-08-27 15:03:04.000"
2+
"spec_repo_commit": "6d9663b",
3+
"generated": "2025-08-27 16:39:32.240"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14485,6 +14485,10 @@ components:
1448514485
description: Entity definition in raw JSON or YAML representation.
1448614486
example: "apiVersion: v3\nkind: service\nmetadata:\n name: myservice\n"
1448714487
type: string
14488+
EntityReference:
14489+
description: The unique reference for an IDP entity.
14490+
example: service:my-service
14491+
type: string
1448814492
EntityRelationships:
1448914493
description: Entity relationships.
1449014494
properties:
@@ -34444,6 +34448,8 @@ components:
3444434448
description: If enabled, the rule is calculated as part of the score.
3444534449
example: true
3444634450
type: boolean
34451+
level:
34452+
$ref: '#/components/schemas/RuleLevel'
3444734453
modified_at:
3444834454
description: Time of the last rule outcome modification.
3444934455
format: date-time
@@ -34464,6 +34470,13 @@ components:
3446434470
description: The unique ID for a scorecard rule.
3446534471
example: q8MQxk8TCqrHnWkx
3446634472
type: string
34473+
RuleLevel:
34474+
description: The maturity level of the rule (1, 2, or 3).
34475+
example: 2
34476+
format: int32
34477+
maximum: 3
34478+
minimum: 1
34479+
type: integer
3446734480
RuleName:
3446834481
description: Name of the notification rule.
3446934482
example: Rule 1
@@ -43835,6 +43848,57 @@ components:
4383543848
id:
4383643849
$ref: '#/components/schemas/ApiID'
4383743850
type: object
43851+
UpdateOutcomesAsyncAttributes:
43852+
description: The JSON:API attributes for a batched set of scorecard outcomes.
43853+
properties:
43854+
results:
43855+
description: Set of scorecard outcomes to update asynchronously.
43856+
items:
43857+
$ref: '#/components/schemas/UpdateOutcomesAsyncRequestItem'
43858+
type: array
43859+
type: object
43860+
UpdateOutcomesAsyncRequest:
43861+
description: Scorecard outcomes batch request.
43862+
properties:
43863+
data:
43864+
$ref: '#/components/schemas/UpdateOutcomesAsyncRequestData'
43865+
type: object
43866+
UpdateOutcomesAsyncRequestData:
43867+
description: Scorecard outcomes batch request data.
43868+
properties:
43869+
attributes:
43870+
$ref: '#/components/schemas/UpdateOutcomesAsyncAttributes'
43871+
type:
43872+
$ref: '#/components/schemas/UpdateOutcomesAsyncType'
43873+
type: object
43874+
UpdateOutcomesAsyncRequestItem:
43875+
description: Scorecard outcome for a single entity and rule.
43876+
properties:
43877+
entity_reference:
43878+
$ref: '#/components/schemas/EntityReference'
43879+
remarks:
43880+
description: Any remarks regarding the scorecard rule's evaluation. Supports
43881+
HTML hyperlinks.
43882+
example: 'See: <a href="https://app.datadoghq.com/services">Services</a>'
43883+
type: string
43884+
rule_id:
43885+
$ref: '#/components/schemas/RuleId'
43886+
state:
43887+
$ref: '#/components/schemas/State'
43888+
required:
43889+
- rule_id
43890+
- entity_reference
43891+
- state
43892+
type: object
43893+
UpdateOutcomesAsyncType:
43894+
default: batched-outcome
43895+
description: The JSON:API type for scorecard outcomes.
43896+
enum:
43897+
- batched-outcome
43898+
example: batched-outcome
43899+
type: string
43900+
x-enum-varnames:
43901+
- BATCHED_OUTCOME
4383843902
UpdateResourceEvaluationFiltersRequest:
4383943903
description: Request object to update a resource filter.
4384043904
properties:
@@ -61882,6 +61946,39 @@ paths:
6188261946
resultsPath: data
6188361947
x-unstable: '**Note**: This endpoint is in public beta.
6188461948

61949+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
61950+
post:
61951+
description: Updates multiple scorecard rule outcomes in a single batched request.
61952+
operationId: UpdateScorecardOutcomesAsync
61953+
requestBody:
61954+
content:
61955+
application/json:
61956+
schema:
61957+
$ref: '#/components/schemas/UpdateOutcomesAsyncRequest'
61958+
description: Set of scorecard outcomes.
61959+
required: true
61960+
responses:
61961+
'202':
61962+
description: Accepted
61963+
'400':
61964+
$ref: '#/components/responses/BadRequestResponse'
61965+
'403':
61966+
$ref: '#/components/responses/ForbiddenResponse'
61967+
'409':
61968+
$ref: '#/components/responses/ConflictResponse'
61969+
'429':
61970+
$ref: '#/components/responses/TooManyRequestsResponse'
61971+
security:
61972+
- apiKeyAuth: []
61973+
appKeyAuth: []
61974+
- AuthZ:
61975+
- apm_service_catalog_write
61976+
summary: Update Scorecard outcomes asynchronously
61977+
tags:
61978+
- Service Scorecards
61979+
x-codegen-request-body-name: body
61980+
x-unstable: '**Note**: This endpoint is in public beta.
61981+
6188561982
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6188661983
/api/v2/scorecard/outcomes/batch:
6188761984
post:

api/datadog/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ func NewConfiguration() *Configuration {
676676
"v2.DeleteScorecardRule": false,
677677
"v2.ListScorecardOutcomes": false,
678678
"v2.ListScorecardRules": false,
679+
"v2.UpdateScorecardOutcomesAsync": false,
679680
"v2.UpdateScorecardRule": false,
680681
"v2.CreateIncidentService": false,
681682
"v2.DeleteIncidentService": false,

api/datadogV2/api_service_scorecards.go

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,85 @@ func (a *ServiceScorecardsApi) ListScorecardRulesWithPagination(ctx _context.Con
780780
return items, cancel
781781
}
782782

783+
// UpdateScorecardOutcomesAsync Update Scorecard outcomes asynchronously.
784+
// Updates multiple scorecard rule outcomes in a single batched request.
785+
func (a *ServiceScorecardsApi) UpdateScorecardOutcomesAsync(ctx _context.Context, body UpdateOutcomesAsyncRequest) (*_nethttp.Response, error) {
786+
var (
787+
localVarHTTPMethod = _nethttp.MethodPost
788+
localVarPostBody interface{}
789+
)
790+
791+
operationId := "v2.UpdateScorecardOutcomesAsync"
792+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
793+
if !isOperationEnabled {
794+
return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
795+
}
796+
if isOperationEnabled && a.Client.Cfg.Debug {
797+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
798+
}
799+
800+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ServiceScorecardsApi.UpdateScorecardOutcomesAsync")
801+
if err != nil {
802+
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
803+
}
804+
805+
localVarPath := localBasePath + "/api/v2/scorecard/outcomes"
806+
807+
localVarHeaderParams := make(map[string]string)
808+
localVarQueryParams := _neturl.Values{}
809+
localVarFormParams := _neturl.Values{}
810+
localVarHeaderParams["Content-Type"] = "application/json"
811+
localVarHeaderParams["Accept"] = "*/*"
812+
813+
// body params
814+
localVarPostBody = &body
815+
if a.Client.Cfg.DelegatedTokenConfig != nil {
816+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
817+
if err != nil {
818+
return nil, err
819+
}
820+
} else {
821+
datadog.SetAuthKeys(
822+
ctx,
823+
&localVarHeaderParams,
824+
[2]string{"apiKeyAuth", "DD-API-KEY"},
825+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
826+
)
827+
}
828+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
829+
if err != nil {
830+
return nil, err
831+
}
832+
833+
localVarHTTPResponse, err := a.Client.CallAPI(req)
834+
if err != nil || localVarHTTPResponse == nil {
835+
return localVarHTTPResponse, err
836+
}
837+
838+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
839+
if err != nil {
840+
return localVarHTTPResponse, err
841+
}
842+
843+
if localVarHTTPResponse.StatusCode >= 300 {
844+
newErr := datadog.GenericOpenAPIError{
845+
ErrorBody: localVarBody,
846+
ErrorMessage: localVarHTTPResponse.Status,
847+
}
848+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 429 {
849+
var v APIErrorResponse
850+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
851+
if err != nil {
852+
return localVarHTTPResponse, newErr
853+
}
854+
newErr.ErrorModel = v
855+
}
856+
return localVarHTTPResponse, newErr
857+
}
858+
859+
return localVarHTTPResponse, nil
860+
}
861+
783862
// UpdateScorecardRule Update an existing rule.
784863
// Updates an existing rule.
785864
func (a *ServiceScorecardsApi) UpdateScorecardRule(ctx _context.Context, ruleId string, body UpdateRuleRequest) (UpdateRuleResponse, *_nethttp.Response, error) {

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@
474474
// - [ServiceScorecardsApi.DeleteScorecardRule]
475475
// - [ServiceScorecardsApi.ListScorecardOutcomes]
476476
// - [ServiceScorecardsApi.ListScorecardRules]
477+
// - [ServiceScorecardsApi.UpdateScorecardOutcomesAsync]
477478
// - [ServiceScorecardsApi.UpdateScorecardRule]
478479
// - [SoftwareCatalogApi.DeleteCatalogEntity]
479480
// - [SoftwareCatalogApi.DeleteCatalogKind]

api/datadogV2/model_rule_attributes.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ type RuleAttributes struct {
2323
Description *string `json:"description,omitempty"`
2424
// If enabled, the rule is calculated as part of the score.
2525
Enabled *bool `json:"enabled,omitempty"`
26+
// The maturity level of the rule (1, 2, or 3).
27+
Level *int32 `json:"level,omitempty"`
2628
// Time of the last rule outcome modification.
2729
ModifiedAt *time.Time `json:"modified_at,omitempty"`
2830
// Name of the rule.
@@ -196,6 +198,34 @@ func (o *RuleAttributes) SetEnabled(v bool) {
196198
o.Enabled = &v
197199
}
198200

201+
// GetLevel returns the Level field value if set, zero value otherwise.
202+
func (o *RuleAttributes) GetLevel() int32 {
203+
if o == nil || o.Level == nil {
204+
var ret int32
205+
return ret
206+
}
207+
return *o.Level
208+
}
209+
210+
// GetLevelOk returns a tuple with the Level field value if set, nil otherwise
211+
// and a boolean to check if the value has been set.
212+
func (o *RuleAttributes) GetLevelOk() (*int32, bool) {
213+
if o == nil || o.Level == nil {
214+
return nil, false
215+
}
216+
return o.Level, true
217+
}
218+
219+
// HasLevel returns a boolean if a field has been set.
220+
func (o *RuleAttributes) HasLevel() bool {
221+
return o != nil && o.Level != nil
222+
}
223+
224+
// SetLevel gets a reference to the given int32 and assigns it to the Level field.
225+
func (o *RuleAttributes) SetLevel(v int32) {
226+
o.Level = &v
227+
}
228+
199229
// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise.
200230
func (o *RuleAttributes) GetModifiedAt() time.Time {
201231
if o == nil || o.ModifiedAt == nil {
@@ -333,6 +363,9 @@ func (o RuleAttributes) MarshalJSON() ([]byte, error) {
333363
if o.Enabled != nil {
334364
toSerialize["enabled"] = o.Enabled
335365
}
366+
if o.Level != nil {
367+
toSerialize["level"] = o.Level
368+
}
336369
if o.ModifiedAt != nil {
337370
if o.ModifiedAt.Nanosecond() == 0 {
338371
toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00")
@@ -364,6 +397,7 @@ func (o *RuleAttributes) UnmarshalJSON(bytes []byte) (err error) {
364397
Custom *bool `json:"custom,omitempty"`
365398
Description *string `json:"description,omitempty"`
366399
Enabled *bool `json:"enabled,omitempty"`
400+
Level *int32 `json:"level,omitempty"`
367401
ModifiedAt *time.Time `json:"modified_at,omitempty"`
368402
Name *string `json:"name,omitempty"`
369403
Owner *string `json:"owner,omitempty"`
@@ -374,7 +408,7 @@ func (o *RuleAttributes) UnmarshalJSON(bytes []byte) (err error) {
374408
}
375409
additionalProperties := make(map[string]interface{})
376410
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
377-
datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "custom", "description", "enabled", "modified_at", "name", "owner", "scorecard_name"})
411+
datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "custom", "description", "enabled", "level", "modified_at", "name", "owner", "scorecard_name"})
378412
} else {
379413
return err
380414
}
@@ -383,6 +417,7 @@ func (o *RuleAttributes) UnmarshalJSON(bytes []byte) (err error) {
383417
o.Custom = all.Custom
384418
o.Description = all.Description
385419
o.Enabled = all.Enabled
420+
o.Level = all.Level
386421
o.ModifiedAt = all.ModifiedAt
387422
o.Name = all.Name
388423
o.Owner = all.Owner

0 commit comments

Comments
 (0)