Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
267 changes: 267 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41461,6 +41461,39 @@ components:
example: "/api/v2/scorecard/rules?page%5Blimit%5D=2&page%5Boffset%5D=2&page%5Bsize%5D=2"
type: string
type: object
ListScorecardScoresMeta:
description: Pagination metadata for scores.
properties:
count:
description: The number of results returned in this page.
format: int64
type: integer
limit:
description: The page limit.
format: int64
type: integer
offset:
description: The page offset.
format: int64
type: integer
total:
description: The total number of results.
format: int64
type: integer
type: object
ListScorecardScoresResponse:
description: A list of scorecard scores for a given aggregation type.
properties:
data:
description: Array of score objects.
items:
$ref: "#/components/schemas/ScorecardScoreData"
type: array
links:
$ref: "#/components/schemas/ListRulesResponseLinks"
meta:
$ref: "#/components/schemas/ListScorecardScoresMeta"
type: object
ListScorecardsResponse:
description: Response containing a list of scorecards.
properties:
Expand Down Expand Up @@ -62579,6 +62612,119 @@ components:
type: string
x-enum-varnames:
- SCORECARD
ScorecardScoreAttributes:
description: Attributes of a scorecard score.
properties:
aggregation:
$ref: "#/components/schemas/ScorecardScoresAggregation"
denominator:
description: The denominator used to compute the score ratio.
format: int64
type: integer
level:
description: The maturity level of the associated rule.
format: int64
type: integer
numerator:
description: The numerator used to compute the score ratio.
format: int64
type: integer
score:
description: The computed score ratio (numerator/denominator), from 0 to 1.
format: double
type: number
total_entities:
description: The total number of entities evaluated.
format: int64
type: integer
total_fail:
description: The number of rules that failed.
format: int64
type: integer
total_no_data:
description: The number of rules with no data.
format: int64
type: integer
total_pass:
description: The number of rules that passed.
format: int64
type: integer
total_skip:
description: The number of rules that were skipped.
format: int64
type: integer
type: object
ScorecardScoreData:
description: A scorecard score object for a single entity, rule, scorecard, service, or team.
properties:
attributes:
$ref: "#/components/schemas/ScorecardScoreAttributes"
id:
description: The ID of the entity or resource being scored.
example: ""
type: string
relationships:
$ref: "#/components/schemas/ScorecardScoreRelationships"
type:
$ref: "#/components/schemas/ScorecardScoreDataType"
required:
- id
- type
type: object
ScorecardScoreDataType:
default: score
description: The JSON:API resource type.
enum: [score]
example: score
type: string
x-enum-varnames:
- SCORE
ScorecardScoreRelationshipData:
description: A relationship data object for a score.
properties:
id:
description: The ID of the related resource.
example: ""
type: string
type:
description: The type of the related resource.
example: ""
type: string
required:
- id
- type
type: object
ScorecardScoreRelationshipItem:
description: A relationship item for a score.
properties:
data:
$ref: "#/components/schemas/ScorecardScoreRelationshipData"
type: object
ScorecardScoreRelationships:
description: Relationships for a scorecard score, depending on the aggregation type.
properties:
entity:
$ref: "#/components/schemas/ScorecardScoreRelationshipItem"
rule:
$ref: "#/components/schemas/ScorecardScoreRelationshipItem"
scorecard:
$ref: "#/components/schemas/ScorecardScoreRelationshipItem"
service:
$ref: "#/components/schemas/ScorecardScoreRelationshipItem"
team:
$ref: "#/components/schemas/ScorecardScoreRelationshipItem"
type: object
ScorecardScoresAggregation:
description: Dimension to group scores by.
enum: [by-entity, by-rule, by-scorecard, by-team, by-kind]
example: by-entity
type: string
x-enum-varnames:
- BY_ENTITY
- BY_RULE
- BY_SCORECARD
- BY_TEAM
- BY_KIND
ScorecardType:
default: scorecard
description: The JSON:API type for scorecard.
Expand Down Expand Up @@ -128170,6 +128316,127 @@ paths:
summary: List all scorecards
tags:
- Scorecards
/api/v2/scorecard/scores/{aggregation}:
get:
description: Returns a list of scorecard scores for each aggregation type, with score breakdowns.
operationId: ListScorecardScores
parameters:
- description: The type of scores being requested.
in: path
name: aggregation
required: true
schema:
$ref: "#/components/schemas/ScorecardScoresAggregation"
- description: Filter scores by an entity query string.
in: query
name: filter[entity][query]
required: false
schema:
type: string
- description: Filter scores by rule ID(s), comma-separated.
in: query
name: filter[rule][id]
required: false
schema:
type: string
- description: Filter scores by rule name.
in: query
name: filter[rule][name]
required: false
schema:
type: string
- description: Filter scores by rule level(s), comma-separated.
in: query
name: filter[rule][level]
required: false
schema:
type: string
- description: Filter scores by scorecard ID(s), comma-separated.
in: query
name: filter[rule][scorecard_id]
required: false
schema:
type: string
- description: Filter scores to show only custom rules.
in: query
name: filter[rule][is_custom]
required: false
schema:
type: boolean
- description: Filter scores to show only enabled rules.
in: query
name: filter[rule][is_enabled]
required: false
schema:
type: boolean
- description: "Sort scores by field. Use a hyphen prefix for descending order. Options: score, numerator, denominator, total_pass, total_fail, total_skip, total_no_data."
in: query
name: sort
required: false
schema:
type: string
- description: Offset for pagination.
in: query
name: page[offset]
required: false
schema:
default: 0
type: integer
- description: Number of scores to return. Max is 1000.
in: query
name: page[limit]
required: false
schema:
default: 100
type: integer
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
- attributes:
aggregation: by-entity
denominator: 4
numerator: 3
score: 0.75
total_fail: 1
total_no_data: 0
total_pass: 3
total_skip: 0
id: service:my-service
relationships:
entity:
data:
id: service:my-service
type: entity
type: score
links:
next: /api/v2/scorecard/scores/by-entity?page[offset]=100&page[limit]=100
meta:
count: 1
limit: 100
offset: 0
total: 42
schema:
$ref: "#/components/schemas/ListScorecardScoresResponse"
description: OK
"400":
$ref: "#/components/responses/BadRequestResponse"
"403":
$ref: "#/components/responses/ForbiddenResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- apm_service_catalog_read
summary: List all scores
tags:
- Scorecards
/api/v2/seats/users:
delete:
description: |-
Expand Down
5 changes: 5 additions & 0 deletions examples/v2/scorecards/ListScorecardScores.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# List all scores returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ScorecardsAPI.new
p api_instance.list_scorecard_scores(ScorecardScoresAggregation::BY_ENTITY)
13 changes: 13 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4001,6 +4001,19 @@
"filter_scorecard_name" => "String",
"filter_scorecard_description" => "String",
},
"v2.ListScorecardScores" => {
"aggregation" => "ScorecardScoresAggregation",
"filter_entity_query" => "String",
"filter_rule_id" => "String",
"filter_rule_name" => "String",
"filter_rule_level" => "String",
"filter_rule_scorecard_id" => "String",
"filter_rule_is_custom" => "Boolean",
"filter_rule_is_enabled" => "Boolean",
"sort" => "String",
"page_offset" => "Integer",
"page_limit" => "Integer",
},
"v2.UnassignSeatsUser" => {
"body" => "UnassignSeatsUserRequest",
},
Expand Down
14 changes: 14 additions & 0 deletions features/v2/scorecards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,20 @@ Feature: Scorecards
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/service-catalog
Scenario: List all scores returns "Bad Request" response
Given new "ListScorecardScores" request
And request contains "aggregation" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/service-catalog
Scenario: List all scores returns "OK" response
Given new "ListScorecardScores" request
And request contains "aggregation" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

@team:DataDog/service-catalog
Scenario: Update Scorecard outcomes asynchronously returns "Accepted" response
Given there is a valid "create_scorecard_rule" in the system
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5276,6 +5276,12 @@
"type": "safe"
}
},
"ListScorecardScores": {
"tag": "Scorecards",
"undo": {
"type": "safe"
}
},
"UnassignSeatsUser": {
"tag": "Seats",
"undo": {
Expand Down
9 changes: 9 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3487,6 +3487,8 @@ def overrides
"v2.list_rules_response" => "ListRulesResponse",
"v2.list_rules_response_data_item" => "ListRulesResponseDataItem",
"v2.list_rules_response_links" => "ListRulesResponseLinks",
"v2.list_scorecard_scores_meta" => "ListScorecardScoresMeta",
"v2.list_scorecard_scores_response" => "ListScorecardScoresResponse",
"v2.list_scorecards_response" => "ListScorecardsResponse",
"v2.list_security_findings_response" => "ListSecurityFindingsResponse",
"v2.list_tags_response" => "ListTagsResponse",
Expand Down Expand Up @@ -5057,6 +5059,13 @@ def overrides
"v2.scorecard_list_response_attributes" => "ScorecardListResponseAttributes",
"v2.scorecard_list_response_data" => "ScorecardListResponseData",
"v2.scorecard_list_type" => "ScorecardListType",
"v2.scorecard_score_attributes" => "ScorecardScoreAttributes",
"v2.scorecard_score_data" => "ScorecardScoreData",
"v2.scorecard_score_data_type" => "ScorecardScoreDataType",
"v2.scorecard_score_relationship_data" => "ScorecardScoreRelationshipData",
"v2.scorecard_score_relationship_item" => "ScorecardScoreRelationshipItem",
"v2.scorecard_score_relationships" => "ScorecardScoreRelationships",
"v2.scorecard_scores_aggregation" => "ScorecardScoresAggregation",
"v2.scorecard_type" => "ScorecardType",
"v2.search_issues_include_query_parameter_item" => "SearchIssuesIncludeQueryParameterItem",
"v2.seat_assignments_data_type" => "SeatAssignmentsDataType",
Expand Down
Loading
Loading