Skip to content

Commit e110341

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add CSM Ownership settings endpoints (#1853)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent eb81342 commit e110341

22 files changed

Lines changed: 2093 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75076,6 +75076,18 @@ components:
7507675076
required:
7507775077
- data
7507875078
type: object
75079+
OwnershipConfidenceLevel:
75080+
description: The ownership confidence level.
75081+
enum:
75082+
- high
75083+
- medium
75084+
- low
75085+
example: high
75086+
type: string
75087+
x-enum-varnames:
75088+
- HIGH
75089+
- MEDIUM
75090+
- LOW
7507975091
OwnershipEvidenceAttributes:
7508075092
description: The attributes of an ownership evidence response.
7508175093
properties:
@@ -75639,6 +75651,152 @@ components:
7563975651
- TEAM
7564075652
- SERVICE
7564175653
- UNKNOWN
75654+
OwnershipSettingsAttributes:
75655+
description: The attributes of the ownership settings response.
75656+
properties:
75657+
auto_tag:
75658+
description: Whether automatic ownership tagging is enabled.
75659+
example: true
75660+
type: boolean
75661+
confidence_level:
75662+
$ref: "#/components/schemas/OwnershipConfidenceLevel"
75663+
version:
75664+
description: The current version of the ownership settings.
75665+
example: 1
75666+
format: int64
75667+
type: integer
75668+
required:
75669+
- version
75670+
- auto_tag
75671+
- confidence_level
75672+
type: object
75673+
OwnershipSettingsData:
75674+
description: The data wrapper for an ownership settings response.
75675+
properties:
75676+
attributes:
75677+
$ref: "#/components/schemas/OwnershipSettingsAttributes"
75678+
id:
75679+
description: The identifier of the ownership settings resource.
75680+
example: settings
75681+
type: string
75682+
type:
75683+
$ref: "#/components/schemas/OwnershipSettingsType"
75684+
required:
75685+
- id
75686+
- type
75687+
- attributes
75688+
type: object
75689+
OwnershipSettingsRequest:
75690+
description: The request body for updating ownership settings.
75691+
properties:
75692+
data:
75693+
$ref: "#/components/schemas/OwnershipSettingsRequestData"
75694+
required:
75695+
- data
75696+
type: object
75697+
OwnershipSettingsRequestAttributes:
75698+
description: The attributes of an ownership settings request.
75699+
properties:
75700+
auto_tag:
75701+
description: Whether automatic ownership tagging is enabled.
75702+
example: true
75703+
type: boolean
75704+
confidence_level:
75705+
$ref: "#/components/schemas/OwnershipConfidenceLevel"
75706+
required:
75707+
- auto_tag
75708+
- confidence_level
75709+
type: object
75710+
OwnershipSettingsRequestData:
75711+
description: The data wrapper for an ownership settings request.
75712+
properties:
75713+
attributes:
75714+
$ref: "#/components/schemas/OwnershipSettingsRequestAttributes"
75715+
type:
75716+
$ref: "#/components/schemas/OwnershipSettingsType"
75717+
required:
75718+
- type
75719+
- attributes
75720+
type: object
75721+
OwnershipSettingsResponse:
75722+
description: The response returned when retrieving or updating ownership settings.
75723+
properties:
75724+
data:
75725+
$ref: "#/components/schemas/OwnershipSettingsData"
75726+
required:
75727+
- data
75728+
type: object
75729+
OwnershipSettingsType:
75730+
default: ownership_settings
75731+
description: The type of the ownership settings resource. The value should always be `ownership_settings`.
75732+
enum:
75733+
- ownership_settings
75734+
example: ownership_settings
75735+
type: string
75736+
x-enum-varnames:
75737+
- OWNERSHIP_SETTINGS
75738+
OwnershipUntaggedFindingsAttributes:
75739+
description: The counts of findings without a team tag by ownership confidence.
75740+
properties:
75741+
high_confidence:
75742+
description: The number of high confidence findings without a team tag.
75743+
example: 30
75744+
format: int64
75745+
type: integer
75746+
low_confidence:
75747+
description: The number of low confidence findings without a team tag.
75748+
example: 42
75749+
format: int64
75750+
type: integer
75751+
medium_confidence:
75752+
description: The number of medium confidence findings without a team tag.
75753+
example: 70
75754+
format: int64
75755+
type: integer
75756+
total:
75757+
description: The total number of findings without a team tag.
75758+
example: 142
75759+
format: int64
75760+
type: integer
75761+
required:
75762+
- total
75763+
- high_confidence
75764+
- medium_confidence
75765+
- low_confidence
75766+
type: object
75767+
OwnershipUntaggedFindingsData:
75768+
description: The data wrapper for an ownership untagged findings response.
75769+
properties:
75770+
attributes:
75771+
$ref: "#/components/schemas/OwnershipUntaggedFindingsAttributes"
75772+
id:
75773+
description: The identifier of the ownership untagged findings resource.
75774+
example: untagged
75775+
type: string
75776+
type:
75777+
$ref: "#/components/schemas/OwnershipUntaggedFindingsType"
75778+
required:
75779+
- id
75780+
- type
75781+
- attributes
75782+
type: object
75783+
OwnershipUntaggedFindingsResponse:
75784+
description: The response returned when counting findings without a team tag by ownership confidence.
75785+
properties:
75786+
data:
75787+
$ref: "#/components/schemas/OwnershipUntaggedFindingsData"
75788+
required:
75789+
- data
75790+
type: object
75791+
OwnershipUntaggedFindingsType:
75792+
default: ownership_untagged_findings
75793+
description: The type of the ownership untagged findings resource. The value should always be `ownership_untagged_findings`.
75794+
enum:
75795+
- ownership_untagged_findings
75796+
example: ownership_untagged_findings
75797+
type: string
75798+
x-enum-varnames:
75799+
- OWNERSHIP_UNTAGGED_FINDINGS
7564275800
PageAnnotationsAttributes:
7564375801
description: Attributes of the annotations on a page.
7564475802
properties:
@@ -132295,6 +132453,128 @@ paths:
132295132453
$ref: "#/components/responses/TooManyRequestsResponse"
132296132454
summary: Get all CSM Serverless Agents
132297132455
tags: ["CSM Agents"]
132456+
/api/v2/csm/ownership/settings:
132457+
get:
132458+
description: Get ownership settings for the org. When settings are unset, the API returns the default opt-out configuration with `auto_tag` set to `true` and `confidence_level` set to `high`.
132459+
operationId: GetOwnershipSettings
132460+
responses:
132461+
"200":
132462+
content:
132463+
application/json:
132464+
examples:
132465+
default:
132466+
value:
132467+
data:
132468+
attributes:
132469+
auto_tag: true
132470+
confidence_level: high
132471+
version: 1
132472+
id: settings
132473+
type: ownership_settings
132474+
schema:
132475+
$ref: "#/components/schemas/OwnershipSettingsResponse"
132476+
description: OK
132477+
"401":
132478+
content:
132479+
application/json:
132480+
schema:
132481+
$ref: "#/components/schemas/JSONAPIErrorResponse"
132482+
description: Unauthorized
132483+
"429":
132484+
$ref: "#/components/responses/TooManyRequestsResponse"
132485+
summary: Get ownership settings for the org
132486+
tags: ["CSM Ownership"]
132487+
x-unstable: |-
132488+
**Note**: This endpoint is in Preview and may be subject to change.
132489+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
132490+
post:
132491+
description: Update ownership settings for the org.
132492+
operationId: PostOwnershipSettings
132493+
requestBody:
132494+
content:
132495+
application/json:
132496+
examples:
132497+
default:
132498+
value:
132499+
data:
132500+
attributes:
132501+
auto_tag: true
132502+
confidence_level: high
132503+
type: ownership_settings
132504+
schema:
132505+
$ref: "#/components/schemas/OwnershipSettingsRequest"
132506+
required: true
132507+
responses:
132508+
"200":
132509+
content:
132510+
application/json:
132511+
examples:
132512+
default:
132513+
value:
132514+
data:
132515+
attributes:
132516+
auto_tag: true
132517+
confidence_level: high
132518+
version: 1
132519+
id: settings
132520+
type: ownership_settings
132521+
schema:
132522+
$ref: "#/components/schemas/OwnershipSettingsResponse"
132523+
description: OK
132524+
"400":
132525+
content:
132526+
application/json:
132527+
schema:
132528+
$ref: "#/components/schemas/JSONAPIErrorResponse"
132529+
description: Bad Request
132530+
"401":
132531+
content:
132532+
application/json:
132533+
schema:
132534+
$ref: "#/components/schemas/JSONAPIErrorResponse"
132535+
description: Unauthorized
132536+
"429":
132537+
$ref: "#/components/responses/TooManyRequestsResponse"
132538+
summary: Update ownership settings for the org
132539+
tags: ["CSM Ownership"]
132540+
x-unstable: |-
132541+
**Note**: This endpoint is in Preview and may be subject to change.
132542+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
132543+
/api/v2/csm/ownership/settings/untagged:
132544+
get:
132545+
description: Count findings with no team tag, grouped by ownership confidence level.
132546+
operationId: GetOwnershipUntaggedFindings
132547+
responses:
132548+
"200":
132549+
content:
132550+
application/json:
132551+
examples:
132552+
default:
132553+
value:
132554+
data:
132555+
attributes:
132556+
high_confidence: 30
132557+
low_confidence: 42
132558+
medium_confidence: 70
132559+
total: 142
132560+
id: untagged
132561+
type: ownership_untagged_findings
132562+
schema:
132563+
$ref: "#/components/schemas/OwnershipUntaggedFindingsResponse"
132564+
description: OK
132565+
"401":
132566+
content:
132567+
application/json:
132568+
schema:
132569+
$ref: "#/components/schemas/JSONAPIErrorResponse"
132570+
description: Unauthorized
132571+
"429":
132572+
$ref: "#/components/responses/TooManyRequestsResponse"
132573+
summary: Count untagged findings by ownership confidence
132574+
tags: ["CSM Ownership"]
132575+
x-unstable: |-
132576+
**Note**: This endpoint is in Preview and may be subject to change.
132577+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
132298132578
/api/v2/csm/ownership/{resource_id}:
132299132579
get:
132300132580
description: Get all current ownership inferences for a resource, one per owner type (`user`, `team`, `service`, `unknown`).
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Get ownership settings for the org returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_csm_ownership::CSMOwnershipAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.GetOwnershipSettings", true);
9+
let api = CSMOwnershipAPI::with_config(configuration);
10+
let resp = api.get_ownership_settings().await;
11+
if let Ok(value) = resp {
12+
println!("{:#?}", value);
13+
} else {
14+
println!("{:#?}", resp.unwrap_err());
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Count untagged findings by ownership confidence returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_csm_ownership::CSMOwnershipAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.GetOwnershipUntaggedFindings", true);
9+
let api = CSMOwnershipAPI::with_config(configuration);
10+
let resp = api.get_ownership_untagged_findings().await;
11+
if let Ok(value) = resp {
12+
println!("{:#?}", value);
13+
} else {
14+
println!("{:#?}", resp.unwrap_err());
15+
}
16+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Update ownership settings for the org returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_csm_ownership::CSMOwnershipAPI;
4+
use datadog_api_client::datadogV2::model::OwnershipConfidenceLevel;
5+
use datadog_api_client::datadogV2::model::OwnershipSettingsRequest;
6+
use datadog_api_client::datadogV2::model::OwnershipSettingsRequestAttributes;
7+
use datadog_api_client::datadogV2::model::OwnershipSettingsRequestData;
8+
use datadog_api_client::datadogV2::model::OwnershipSettingsType;
9+
10+
#[tokio::main]
11+
async fn main() {
12+
let body = OwnershipSettingsRequest::new(OwnershipSettingsRequestData::new(
13+
OwnershipSettingsRequestAttributes::new(true, OwnershipConfidenceLevel::HIGH),
14+
OwnershipSettingsType::OWNERSHIP_SETTINGS,
15+
));
16+
let mut configuration = datadog::Configuration::new();
17+
configuration.set_unstable_operation_enabled("v2.PostOwnershipSettings", true);
18+
let api = CSMOwnershipAPI::with_config(configuration);
19+
let resp = api.post_ownership_settings(body).await;
20+
if let Ok(value) = resp {
21+
println!("{:#?}", value);
22+
} else {
23+
println!("{:#?}", resp.unwrap_err());
24+
}
25+
}

src/datadog/configuration.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,12 @@ impl Default for Configuration {
481481
("v2.create_ownership_feedback".to_owned(), false),
482482
("v2.get_ownership_evidence".to_owned(), false),
483483
("v2.get_ownership_inference".to_owned(), false),
484+
("v2.get_ownership_settings".to_owned(), false),
485+
("v2.get_ownership_untagged_findings".to_owned(), false),
484486
("v2.list_ownership_history".to_owned(), false),
485487
("v2.list_ownership_history_by_owner_type".to_owned(), false),
486488
("v2.list_ownership_inferences".to_owned(), false),
489+
("v2.post_ownership_settings".to_owned(), false),
487490
("v2.get_csm_agentless_host_facet_info".to_owned(), false),
488491
("v2.get_csm_unified_host_facet_info".to_owned(), false),
489492
("v2.list_csm_agentless_host_facets".to_owned(), false),

0 commit comments

Comments
 (0)