From a5b07357f0a74590a1b0a9d5436cfa9d8ee40b31 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 16 Oct 2026 20:24:11 +0000 Subject: [PATCH] Regenerate client from commit 2874815 of spec repo --- .generator/schemas/v2/openapi.yaml | 317 ---------- examples/v2_spa_GetSPARecommendations.rs | 22 - examples/v2_spa_GetSPARecommendationsV2.rs | 26 - .../v2_spa_GetSPARecommendationsWithShard.rs | 23 - src/datadog/configuration.rs | 3 - src/datadogV2/api/api_spa.rs | 539 ------------------ src/datadogV2/api/mod.rs | 1 - src/datadogV2/mod.rs | 1 - src/datadogV2/model/mod.rs | 22 - .../model/model_component_recommendation.rs | 92 --- src/datadogV2/model/model_cpu.rs | 139 ----- src/datadogV2/model/model_estimation.rs | 174 ------ .../model/model_recommendation_attributes.rs | 142 ----- .../model/model_recommendation_data.rs | 133 ----- .../model/model_recommendation_document.rs | 92 --- .../model/model_recommendation_type.rs | 48 -- ...el_recommendation_v2_request_attributes.rs | 94 --- .../model_recommendation_v2_request_body.rs | 95 --- .../model_recommendation_v2_request_data.rs | 116 ---- .../model_recommendation_v2_request_type.rs | 48 -- tests/scenarios/features/v2/spa.feature | 101 ---- tests/scenarios/features/v2/undo.json | 18 - tests/scenarios/function_mappings.rs | 115 ---- 23 files changed, 2361 deletions(-) delete mode 100644 examples/v2_spa_GetSPARecommendations.rs delete mode 100644 examples/v2_spa_GetSPARecommendationsV2.rs delete mode 100644 examples/v2_spa_GetSPARecommendationsWithShard.rs delete mode 100644 src/datadogV2/api/api_spa.rs delete mode 100644 src/datadogV2/model/model_component_recommendation.rs delete mode 100644 src/datadogV2/model/model_cpu.rs delete mode 100644 src/datadogV2/model/model_estimation.rs delete mode 100644 src/datadogV2/model/model_recommendation_attributes.rs delete mode 100644 src/datadogV2/model/model_recommendation_data.rs delete mode 100644 src/datadogV2/model/model_recommendation_document.rs delete mode 100644 src/datadogV2/model/model_recommendation_type.rs delete mode 100644 src/datadogV2/model/model_recommendation_v2_request_attributes.rs delete mode 100644 src/datadogV2/model/model_recommendation_v2_request_body.rs delete mode 100644 src/datadogV2/model/model_recommendation_v2_request_data.rs delete mode 100644 src/datadogV2/model/model_recommendation_v2_request_type.rs delete mode 100644 tests/scenarios/features/v2/spa.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 8e540e2cff..4ecfbd0c50 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21328,13 +21328,6 @@ components: - description: "If this is a string, it must be a valid JavaScript expression that evaluates to a boolean." example: "${true}" type: string - ComponentRecommendation: - description: Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. - properties: - estimation: - $ref: "#/components/schemas/Estimation" - required: [estimation] - type: object ComponentType: description: The UI component type. enum: @@ -24057,23 +24050,6 @@ components: type: string x-enum-varnames: - CI_APP_COVERAGE_SUMMARY - Cpu: - description: CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving risk profiles. - properties: - max: - description: Maximum CPU usage observed for the job, expressed in millicores. This represents the upper bound of usage. - format: int64 - type: integer - p75: - description: 75th percentile of CPU usage (millicores). Represents a cost-saving configuration while covering most workloads. - format: int64 - type: integer - p95: - description: 95th percentile of CPU usage (millicores). Balances performance and cost, providing a safer margin than p75. - format: int64 - type: integer - type: object - x-model-simple-name: SpaCpu CreateActionConnectionRequest: description: Request used to create an action connection. properties: @@ -40501,28 +40477,6 @@ components: type: string x-enum-varnames: - ESCALATION_POLICY_STEPS - Estimation: - description: Recommended resource values for a Spark driver or executor, derived from recent real usage metrics. Used by SPA to propose more efficient pod sizing. - properties: - cpu: - $ref: "#/components/schemas/Cpu" - ephemeral_storage: - description: Recommended ephemeral storage allocation (in MiB). Derived from job temporary storage patterns. - format: int64 - type: integer - heap: - description: Recommended JVM heap size (in MiB). - format: int64 - type: integer - memory: - description: Recommended total memory allocation (in MiB). Includes both heap and overhead. - format: int64 - type: integer - overhead: - description: Recommended JVM overhead (in MiB). Computed as total memory - heap. - format: int64 - type: integer - type: object Event: additionalProperties: {} description: The metadata associated with a request. @@ -101716,96 +101670,6 @@ components: required: - data type: object - RecommendationAttributes: - description: Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. - properties: - confidence_level: - description: The confidence level of the recommendation, expressed as a value between 0.0 (low confidence) and 1.0 (high confidence). - format: double - type: number - driver: - $ref: "#/components/schemas/ComponentRecommendation" - executor: - $ref: "#/components/schemas/ComponentRecommendation" - matched_params: - description: |- - Only returned by the v2 endpoint. The job parameters whose values the recommendation was matched on, as `parameter=value` pairs joined by `|`. - An empty string means the service-wide (coarse) recommendation was used. - example: "detailed_metrics=false|Region=US1" - type: string - required: [driver, executor] - type: object - RecommendationData: - description: JSON:API resource object for SPA Recommendation. Includes type, optional ID, and resource attributes with structured recommendations. - properties: - attributes: - $ref: "#/components/schemas/RecommendationAttributes" - id: - description: Resource identifier for the recommendation. Optional in responses. - type: string - type: - $ref: "#/components/schemas/RecommendationType" - required: [type, attributes] - type: object - RecommendationDocument: - description: JSON:API document containing a single Recommendation resource. Returned by SPA when the Spark Gateway requests recommendations. - properties: - data: - $ref: "#/components/schemas/RecommendationData" - required: [data] - type: object - RecommendationType: - default: recommendation - description: JSON:API resource type for Spark Pod Autosizing recommendations. Identifies the Recommendation resource returned by SPA. - enum: - - recommendation - example: recommendation - type: string - x-enum-varnames: - - RECOMMENDATION - RecommendationV2RequestAttributes: - description: |- - Attributes for requesting SPA recommendations by forwarding a Spark job's raw arguments - instead of a pre-computed shard. - properties: - arguments: - description: |- - Raw, unfiltered Spark job arguments as submitted (for example, `--org_id=2`). - SPA determines which arguments are relevant for the given service. - example: - - "" - items: - type: string - type: array - required: [arguments] - type: object - RecommendationV2RequestBody: - description: |- - Request body for retrieving SPA recommendations by forwarding a Spark job's raw arguments - instead of a pre-computed shard. - properties: - data: - $ref: "#/components/schemas/RecommendationV2RequestData" - required: [data] - type: object - RecommendationV2RequestData: - description: JSON:API resource object for the SPA v2 recommendation request. - properties: - attributes: - $ref: "#/components/schemas/RecommendationV2RequestAttributes" - type: - $ref: "#/components/schemas/RecommendationV2RequestType" - required: [type, attributes] - type: object - RecommendationV2RequestType: - default: recommendation_v2_request - description: JSON:API resource type for the SPA v2 recommendation request. - enum: - - recommendation_v2_request - example: recommendation_v2_request - type: string - x-enum-varnames: - - RECOMMENDATION_V2_REQUEST RecommendationsFilterRequest: description: JSON:API request body for filtering cost recommendations. example: @@ -234730,185 +234594,6 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - /api/v2/spa/recommendations-v2/{service}: - post: - description: |- - This endpoint is experimental and restricted to Datadog internal use only. - Retrieve resource recommendations for a Spark job. The caller (Spark Gateway) provides - a service name and the job's raw arguments. SPA determines which arguments are relevant - for the service and returns structured recommendations for driver and executor resources. - operationId: GetSPARecommendationsV2 - parameters: - - description: The service name for a Spark job - in: path - name: service - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: "#/components/schemas/RecommendationV2RequestBody" - required: true - responses: - "200": - content: - application/json: - example: - data: - attributes: - driver: - estimation: - cpu: {max: 1500, p75: 1000, p95: 1200} - ephemeral_storage: 896 - heap: 6144 - memory: 7168 - overhead: 1024 - executor: - estimation: - cpu: {max: 2000, p75: 1200, p95: 1500} - ephemeral_storage: 512 - heap: 3072 - memory: 4096 - overhead: 1024 - matched_params: "detailed_metrics=false" - id: "dedupeactivecontexts:adp_dedupeactivecontexts_org2" - type: recommendation - schema: - $ref: "#/components/schemas/RecommendationDocument" - description: OK - "400": - $ref: "#/components/responses/BadRequestResponse" - "403": - $ref: "#/components/responses/NotAuthorizedResponse" - "404": - $ref: "#/components/responses/NotFoundResponse" - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - AuthZ: [] - summary: Get SPA recommendations v2 - tags: - - Spa - x-unstable: |- - **Note**: This endpoint is in preview and may change in the future. It is not yet recommended for production use. - /api/v2/spa/recommendations/{service}: - get: - description: This endpoint is currently experimental and restricted to Datadog internal use only. Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and SPA returns structured recommendations for driver and executor resources. The version with a shard should be preferred, where possible, as it gives more accurate results. - operationId: GetSPARecommendations - parameters: - - description: The recommendation service should not use its metrics cache. - in: query - name: bypass_cache - schema: - type: string - - description: The service name for a spark job. - in: path - name: service - required: true - schema: - type: string - responses: - "200": - content: - application/json: - example: - data: - attributes: - driver: - estimation: - cpu: {max: 1500, p75: 1000, p95: 1200} - ephemeral_storage: 896 - heap: 6144 - memory: 7168 - overhead: 1024 - executor: - estimation: - cpu: {max: 2000, p75: 1200, p95: 1500} - ephemeral_storage: 512 - heap: 3072 - memory: 4096 - overhead: 1024 - id: "dedupeactivecontexts:adp_dedupeactivecontexts_org2" - type: recommendation - schema: - $ref: "#/components/schemas/RecommendationDocument" - description: OK - "400": - $ref: "#/components/responses/BadRequestResponse" - "403": - $ref: "#/components/responses/NotAuthorizedResponse" - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - AuthZ: [] - summary: Get SPA Recommendations - tags: - - Spa - x-unstable: |- - **Note**: This endpoint is in preview and may change in the future. It is not yet recommended for production use. - /api/v2/spa/recommendations/{service}/{shard}: - get: - description: This endpoint is currently experimental and restricted to Datadog internal use only. Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and shard identifier, and SPA returns structured recommendations for driver and executor resources. - operationId: GetSPARecommendationsWithShard - parameters: - - description: The shard tag for a spark job, which differentiates jobs within the same service that have different resource needs - in: path - name: shard - required: true - schema: - type: string - - description: The service name for a spark job - in: path - name: service - required: true - schema: - type: string - - description: The recommendation service should not use its metrics cache. - in: query - name: bypass_cache - schema: - type: string - responses: - "200": - content: - application/json: - example: - data: - attributes: - driver: - estimation: - cpu: {max: 1500, p75: 1000, p95: 1200} - ephemeral_storage: 896 - heap: 6144 - memory: 7168 - overhead: 1024 - executor: - estimation: - cpu: {max: 2000, p75: 1200, p95: 1500} - ephemeral_storage: 512 - heap: 3072 - memory: 4096 - overhead: 1024 - id: "dedupeactivecontexts:adp_dedupeactivecontexts_org2" - type: recommendation - schema: - $ref: "#/components/schemas/RecommendationDocument" - description: OK - "400": - $ref: "#/components/responses/BadRequestResponse" - "403": - $ref: "#/components/responses/NotAuthorizedResponse" - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - security: - - AuthZ: [] - summary: Get SPA Recommendations with a shard parameter - tags: - - Spa - x-unstable: |- - **Note**: This endpoint is in preview and may change in the future. It is not yet recommended for production use. /api/v2/spans/analytics/aggregate: post: description: |- @@ -249345,8 +249030,6 @@ tags: externalDocs: url: https://docs.datadoghq.com/service_catalog/service_definitions#metadata-schema-v30-beta name: Software Catalog - - description: SPA (Spark Pod Autosizing) API. Provides resource recommendations and cost insights to help optimize Spark job configurations. - name: Spa - description: |- Search and aggregate your spans from your Datadog platform over HTTP. name: Spans diff --git a/examples/v2_spa_GetSPARecommendations.rs b/examples/v2_spa_GetSPARecommendations.rs deleted file mode 100644 index 2a29b2df42..0000000000 --- a/examples/v2_spa_GetSPARecommendations.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Get SPA Recommendations returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_spa::GetSPARecommendationsOptionalParams; -use datadog_api_client::datadogV2::api_spa::SpaAPI; - -#[tokio::main] -async fn main() { - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.get_spa_recommendations", true); - let api = SpaAPI::with_config(configuration); - let resp = api - .get_spa_recommendations( - "service".to_string(), - GetSPARecommendationsOptionalParams::default(), - ) - .await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_spa_GetSPARecommendationsV2.rs b/examples/v2_spa_GetSPARecommendationsV2.rs deleted file mode 100644 index 238e08c8d7..0000000000 --- a/examples/v2_spa_GetSPARecommendationsV2.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Get SPA recommendations v2 returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_spa::SpaAPI; -use datadog_api_client::datadogV2::model::RecommendationV2RequestAttributes; -use datadog_api_client::datadogV2::model::RecommendationV2RequestBody; -use datadog_api_client::datadogV2::model::RecommendationV2RequestData; -use datadog_api_client::datadogV2::model::RecommendationV2RequestType; - -#[tokio::main] -async fn main() { - let body = RecommendationV2RequestBody::new(RecommendationV2RequestData::new( - RecommendationV2RequestAttributes::new(vec!["".to_string()]), - RecommendationV2RequestType::RECOMMENDATION_V2_REQUEST, - )); - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.get_spa_recommendations_v2", true); - let api = SpaAPI::with_config(configuration); - let resp = api - .get_spa_recommendations_v2("service".to_string(), body) - .await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/examples/v2_spa_GetSPARecommendationsWithShard.rs b/examples/v2_spa_GetSPARecommendationsWithShard.rs deleted file mode 100644 index c57c8d8f23..0000000000 --- a/examples/v2_spa_GetSPARecommendationsWithShard.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Get SPA Recommendations with a shard parameter returns "OK" response -use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_spa::GetSPARecommendationsWithShardOptionalParams; -use datadog_api_client::datadogV2::api_spa::SpaAPI; - -#[tokio::main] -async fn main() { - let mut configuration = datadog::Configuration::new(); - configuration.set_unstable_operation_enabled("v2.get_spa_recommendations_with_shard", true); - let api = SpaAPI::with_config(configuration); - let resp = api - .get_spa_recommendations_with_shard( - "shard".to_string(), - "service".to_string(), - GetSPARecommendationsWithShardOptionalParams::default(), - ) - .await; - if let Ok(value) = resp { - println!("{:#?}", value); - } else { - println!("{:#?}", resp.unwrap_err()); - } -} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index a8278679ed..e251faabbf 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -1001,9 +1001,6 @@ impl Default for Configuration { ("v2.get_slo_report_job_status".to_owned(), false), ("v2.get_slo_status".to_owned(), false), ("v2.create_snapshot".to_owned(), false), - ("v2.get_spa_recommendations".to_owned(), false), - ("v2.get_spa_recommendations_v2".to_owned(), false), - ("v2.get_spa_recommendations_with_shard".to_owned(), false), ("v2.create_ai_custom_rule".to_owned(), false), ("v2.create_ai_custom_rule_revision".to_owned(), false), ("v2.create_ai_custom_ruleset".to_owned(), false), diff --git a/src/datadogV2/api/api_spa.rs b/src/datadogV2/api/api_spa.rs deleted file mode 100644 index 63be9958b8..0000000000 --- a/src/datadogV2/api/api_spa.rs +++ /dev/null @@ -1,539 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use crate::datadog; -use flate2::{ - write::{GzEncoder, ZlibEncoder}, - Compression, -}; -use log::warn; -use reqwest::header::{HeaderMap, HeaderValue}; -use serde::{Deserialize, Serialize}; -use std::io::Write; - -/// GetSPARecommendationsOptionalParams is a struct for passing parameters to the method [`SpaAPI::get_spa_recommendations`] -#[non_exhaustive] -#[derive(Clone, Default, Debug)] -pub struct GetSPARecommendationsOptionalParams { - /// The recommendation service should not use its metrics cache. - pub bypass_cache: Option, -} - -impl GetSPARecommendationsOptionalParams { - /// The recommendation service should not use its metrics cache. - pub fn bypass_cache(mut self, value: String) -> Self { - self.bypass_cache = Some(value); - self - } -} - -/// GetSPARecommendationsWithShardOptionalParams is a struct for passing parameters to the method [`SpaAPI::get_spa_recommendations_with_shard`] -#[non_exhaustive] -#[derive(Clone, Default, Debug)] -pub struct GetSPARecommendationsWithShardOptionalParams { - /// The recommendation service should not use its metrics cache. - pub bypass_cache: Option, -} - -impl GetSPARecommendationsWithShardOptionalParams { - /// The recommendation service should not use its metrics cache. - pub fn bypass_cache(mut self, value: String) -> Self { - self.bypass_cache = Some(value); - self - } -} - -/// GetSPARecommendationsError is a struct for typed errors of method [`SpaAPI::get_spa_recommendations`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetSPARecommendationsError { - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// GetSPARecommendationsV2Error is a struct for typed errors of method [`SpaAPI::get_spa_recommendations_v2`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetSPARecommendationsV2Error { - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// GetSPARecommendationsWithShardError is a struct for typed errors of method [`SpaAPI::get_spa_recommendations_with_shard`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum GetSPARecommendationsWithShardError { - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// SPA (Spark Pod Autosizing) API. Provides resource recommendations and cost insights to help optimize Spark job configurations. -#[derive(Debug, Clone)] -pub struct SpaAPI { - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, -} - -impl Default for SpaAPI { - fn default() -> Self { - Self::with_config(datadog::Configuration::default()) - } -} - -impl SpaAPI { - pub fn new() -> Self { - Self::default() - } - pub fn with_config(config: datadog::Configuration) -> Self { - let reqwest_client_builder = { - let builder = config.apply_headers(reqwest::Client::builder()); - #[cfg(not(target_arch = "wasm32"))] - let builder = if let Some(proxy_url) = &config.proxy_url { - builder.proxy(reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL")) - } else { - builder - }; - builder - }; - - let middleware_client_builder = { - let builder = - reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); - #[cfg(feature = "retry")] - let builder = if config.enable_retry { - struct RetryableStatus; - impl reqwest_retry::RetryableStrategy for RetryableStatus { - fn handle( - &self, - res: &Result, - ) -> Option { - match res { - Ok(success) => reqwest_retry::default_on_request_success(success), - Err(_) => None, - } - } - } - let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() - .build_with_max_retries(config.max_retries); - - let retry_middleware = - reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( - backoff_policy, - RetryableStatus, - ); - - builder.with(retry_middleware) - } else { - builder - }; - builder - }; - - let client = middleware_client_builder.build(); - - Self { config, client } - } - - pub fn with_client_and_config( - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, - ) -> Self { - Self { config, client } - } - - /// This endpoint is currently experimental and restricted to Datadog internal use only. Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and SPA returns structured recommendations for driver and executor resources. The version with a shard should be preferred, where possible, as it gives more accurate results. - pub async fn get_spa_recommendations( - &self, - service: String, - params: GetSPARecommendationsOptionalParams, - ) -> Result< - crate::datadogV2::model::RecommendationDocument, - datadog::Error, - > { - match self - .get_spa_recommendations_with_http_info(service, params) - .await - { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// This endpoint is currently experimental and restricted to Datadog internal use only. Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and SPA returns structured recommendations for driver and executor resources. The version with a shard should be preferred, where possible, as it gives more accurate results. - pub async fn get_spa_recommendations_with_http_info( - &self, - service: String, - params: GetSPARecommendationsOptionalParams, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let local_operation_id = "v2.get_spa_recommendations"; - if local_configuration.is_unstable_operation_enabled(local_operation_id) { - warn!("Using unstable operation {local_operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_spa_recommendations' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let bypass_cache = params.bypass_cache; - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/spa/recommendations/{service}", - local_configuration.get_operation_host(local_operation_id), - service = datadog::urlencode(service) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = bypass_cache { - local_req_builder = - local_req_builder.query(&[("bypass_cache", &local_query_param.to_string())]); - }; - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// This endpoint is experimental and restricted to Datadog internal use only. - /// Retrieve resource recommendations for a Spark job. The caller (Spark Gateway) provides - /// a service name and the job's raw arguments. SPA determines which arguments are relevant - /// for the service and returns structured recommendations for driver and executor resources. - pub async fn get_spa_recommendations_v2( - &self, - service: String, - body: crate::datadogV2::model::RecommendationV2RequestBody, - ) -> Result< - crate::datadogV2::model::RecommendationDocument, - datadog::Error, - > { - match self - .get_spa_recommendations_v2_with_http_info(service, body) - .await - { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// This endpoint is experimental and restricted to Datadog internal use only. - /// Retrieve resource recommendations for a Spark job. The caller (Spark Gateway) provides - /// a service name and the job's raw arguments. SPA determines which arguments are relevant - /// for the service and returns structured recommendations for driver and executor resources. - pub async fn get_spa_recommendations_v2_with_http_info( - &self, - service: String, - body: crate::datadogV2::model::RecommendationV2RequestBody, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let local_operation_id = "v2.get_spa_recommendations_v2"; - if local_configuration.is_unstable_operation_enabled(local_operation_id) { - warn!("Using unstable operation {local_operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_spa_recommendations_v2' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/spa/recommendations-v2/{service}", - local_configuration.get_operation_host(local_operation_id), - service = datadog::urlencode(service) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// This endpoint is currently experimental and restricted to Datadog internal use only. Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and shard identifier, and SPA returns structured recommendations for driver and executor resources. - pub async fn get_spa_recommendations_with_shard( - &self, - shard: String, - service: String, - params: GetSPARecommendationsWithShardOptionalParams, - ) -> Result< - crate::datadogV2::model::RecommendationDocument, - datadog::Error, - > { - match self - .get_spa_recommendations_with_shard_with_http_info(shard, service, params) - .await - { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// This endpoint is currently experimental and restricted to Datadog internal use only. Retrieve resource recommendations for a Spark job. The caller (Spark Gateway or DJM UI) provides a service name and shard identifier, and SPA returns structured recommendations for driver and executor resources. - pub async fn get_spa_recommendations_with_shard_with_http_info( - &self, - shard: String, - service: String, - params: GetSPARecommendationsWithShardOptionalParams, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let local_operation_id = "v2.get_spa_recommendations_with_shard"; - if local_configuration.is_unstable_operation_enabled(local_operation_id) { - warn!("Using unstable operation {local_operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_spa_recommendations_with_shard' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let bypass_cache = params.bypass_cache; - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/spa/recommendations/{service}/{shard}", - local_configuration.get_operation_host(local_operation_id), - shard = datadog::urlencode(shard), - service = datadog::urlencode(service) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = bypass_cache { - local_req_builder = - local_req_builder.query(&[("bypass_cache", &local_query_param.to_string())]); - }; - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } -} diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index bf284e614b..22b9925157 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -134,7 +134,6 @@ pub mod api_service_now_integration; pub mod api_slack_integration; pub mod api_snowflake_integration; pub mod api_software_catalog; -pub mod api_spa; pub mod api_spans; pub mod api_spans_metrics; pub mod api_static_analysis; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index cb34dbca1b..5300007280 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -135,7 +135,6 @@ pub use self::api::api_service_now_integration; pub use self::api::api_slack_integration; pub use self::api::api_snowflake_integration; pub use self::api::api_software_catalog; -pub use self::api::api_spa; pub use self::api::api_spans; pub use self::api::api_spans_metrics; pub use self::api::api_static_analysis; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 11cc69f5ce..8a8f15b15e 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -14476,28 +14476,6 @@ pub mod model_service_repository_info_response_attributes; pub use self::model_service_repository_info_response_attributes::ServiceRepositoryInfoResponseAttributes; pub mod model_service_repository_info_status; pub use self::model_service_repository_info_status::ServiceRepositoryInfoStatus; -pub mod model_recommendation_v2_request_body; -pub use self::model_recommendation_v2_request_body::RecommendationV2RequestBody; -pub mod model_recommendation_v2_request_data; -pub use self::model_recommendation_v2_request_data::RecommendationV2RequestData; -pub mod model_recommendation_v2_request_attributes; -pub use self::model_recommendation_v2_request_attributes::RecommendationV2RequestAttributes; -pub mod model_recommendation_v2_request_type; -pub use self::model_recommendation_v2_request_type::RecommendationV2RequestType; -pub mod model_recommendation_document; -pub use self::model_recommendation_document::RecommendationDocument; -pub mod model_recommendation_data; -pub use self::model_recommendation_data::RecommendationData; -pub mod model_recommendation_attributes; -pub use self::model_recommendation_attributes::RecommendationAttributes; -pub mod model_component_recommendation; -pub use self::model_component_recommendation::ComponentRecommendation; -pub mod model_estimation; -pub use self::model_estimation::Estimation; -pub mod model_cpu; -pub use self::model_cpu::Cpu; -pub mod model_recommendation_type; -pub use self::model_recommendation_type::RecommendationType; pub mod model_spans_aggregate_request; pub use self::model_spans_aggregate_request::SpansAggregateRequest; pub mod model_spans_aggregate_data; diff --git a/src/datadogV2/model/model_component_recommendation.rs b/src/datadogV2/model/model_component_recommendation.rs deleted file mode 100644 index aab0da3693..0000000000 --- a/src/datadogV2/model/model_component_recommendation.rs +++ /dev/null @@ -1,92 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct ComponentRecommendation { - /// Recommended resource values for a Spark driver or executor, derived from recent real usage metrics. Used by SPA to propose more efficient pod sizing. - #[serde(rename = "estimation")] - pub estimation: crate::datadogV2::model::Estimation, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl ComponentRecommendation { - pub fn new(estimation: crate::datadogV2::model::Estimation) -> ComponentRecommendation { - ComponentRecommendation { - estimation, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for ComponentRecommendation { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct ComponentRecommendationVisitor; - impl<'a> Visitor<'a> for ComponentRecommendationVisitor { - type Value = ComponentRecommendation; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut estimation: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "estimation" => { - estimation = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let estimation = estimation.ok_or_else(|| M::Error::missing_field("estimation"))?; - - let content = ComponentRecommendation { - estimation, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(ComponentRecommendationVisitor) - } -} diff --git a/src/datadogV2/model/model_cpu.rs b/src/datadogV2/model/model_cpu.rs deleted file mode 100644 index 5c7f570e23..0000000000 --- a/src/datadogV2/model/model_cpu.rs +++ /dev/null @@ -1,139 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving risk profiles. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct Cpu { - /// Maximum CPU usage observed for the job, expressed in millicores. This represents the upper bound of usage. - #[serde(rename = "max")] - pub max: Option, - /// 75th percentile of CPU usage (millicores). Represents a cost-saving configuration while covering most workloads. - #[serde(rename = "p75")] - pub p75: Option, - /// 95th percentile of CPU usage (millicores). Balances performance and cost, providing a safer margin than p75. - #[serde(rename = "p95")] - pub p95: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl Cpu { - pub fn new() -> Cpu { - Cpu { - max: None, - p75: None, - p95: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn max(mut self, value: i64) -> Self { - self.max = Some(value); - self - } - - pub fn p75(mut self, value: i64) -> Self { - self.p75 = Some(value); - self - } - - pub fn p95(mut self, value: i64) -> Self { - self.p95 = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for Cpu { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for Cpu { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct CpuVisitor; - impl<'a> Visitor<'a> for CpuVisitor { - type Value = Cpu; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut max: Option = None; - let mut p75: Option = None; - let mut p95: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "max" => { - if v.is_null() { - continue; - } - max = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "p75" => { - if v.is_null() { - continue; - } - p75 = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "p95" => { - if v.is_null() { - continue; - } - p95 = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = Cpu { - max, - p75, - p95, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(CpuVisitor) - } -} diff --git a/src/datadogV2/model/model_estimation.rs b/src/datadogV2/model/model_estimation.rs deleted file mode 100644 index ab4517f893..0000000000 --- a/src/datadogV2/model/model_estimation.rs +++ /dev/null @@ -1,174 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Recommended resource values for a Spark driver or executor, derived from recent real usage metrics. Used by SPA to propose more efficient pod sizing. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct Estimation { - /// CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving risk profiles. - #[serde(rename = "cpu")] - pub cpu: Option, - /// Recommended ephemeral storage allocation (in MiB). Derived from job temporary storage patterns. - #[serde(rename = "ephemeral_storage")] - pub ephemeral_storage: Option, - /// Recommended JVM heap size (in MiB). - #[serde(rename = "heap")] - pub heap: Option, - /// Recommended total memory allocation (in MiB). Includes both heap and overhead. - #[serde(rename = "memory")] - pub memory: Option, - /// Recommended JVM overhead (in MiB). Computed as total memory - heap. - #[serde(rename = "overhead")] - pub overhead: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl Estimation { - pub fn new() -> Estimation { - Estimation { - cpu: None, - ephemeral_storage: None, - heap: None, - memory: None, - overhead: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn cpu(mut self, value: crate::datadogV2::model::Cpu) -> Self { - self.cpu = Some(value); - self - } - - pub fn ephemeral_storage(mut self, value: i64) -> Self { - self.ephemeral_storage = Some(value); - self - } - - pub fn heap(mut self, value: i64) -> Self { - self.heap = Some(value); - self - } - - pub fn memory(mut self, value: i64) -> Self { - self.memory = Some(value); - self - } - - pub fn overhead(mut self, value: i64) -> Self { - self.overhead = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl Default for Estimation { - fn default() -> Self { - Self::new() - } -} - -impl<'de> Deserialize<'de> for Estimation { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct EstimationVisitor; - impl<'a> Visitor<'a> for EstimationVisitor { - type Value = Estimation; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut cpu: Option = None; - let mut ephemeral_storage: Option = None; - let mut heap: Option = None; - let mut memory: Option = None; - let mut overhead: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "cpu" => { - if v.is_null() { - continue; - } - cpu = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "ephemeral_storage" => { - if v.is_null() { - continue; - } - ephemeral_storage = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "heap" => { - if v.is_null() { - continue; - } - heap = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "memory" => { - if v.is_null() { - continue; - } - memory = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "overhead" => { - if v.is_null() { - continue; - } - overhead = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - - let content = Estimation { - cpu, - ephemeral_storage, - heap, - memory, - overhead, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(EstimationVisitor) - } -} diff --git a/src/datadogV2/model/model_recommendation_attributes.rs b/src/datadogV2/model/model_recommendation_attributes.rs deleted file mode 100644 index 91434ebfc2..0000000000 --- a/src/datadogV2/model/model_recommendation_attributes.rs +++ /dev/null @@ -1,142 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct RecommendationAttributes { - /// The confidence level of the recommendation, expressed as a value between 0.0 (low confidence) and 1.0 (high confidence). - #[serde(rename = "confidence_level")] - pub confidence_level: Option, - /// Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. - #[serde(rename = "driver")] - pub driver: crate::datadogV2::model::ComponentRecommendation, - /// Resource recommendation for a single Spark component (driver or executor). Contains estimation data used to patch Spark job specs. - #[serde(rename = "executor")] - pub executor: crate::datadogV2::model::ComponentRecommendation, - /// Only returned by the v2 endpoint. The job parameters whose values the recommendation was matched on, as `parameter=value` pairs joined by `|`. - /// An empty string means the service-wide (coarse) recommendation was used. - #[serde(rename = "matched_params")] - pub matched_params: Option, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl RecommendationAttributes { - pub fn new( - driver: crate::datadogV2::model::ComponentRecommendation, - executor: crate::datadogV2::model::ComponentRecommendation, - ) -> RecommendationAttributes { - RecommendationAttributes { - confidence_level: None, - driver, - executor, - matched_params: None, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn confidence_level(mut self, value: f64) -> Self { - self.confidence_level = Some(value); - self - } - - pub fn matched_params(mut self, value: String) -> Self { - self.matched_params = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for RecommendationAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct RecommendationAttributesVisitor; - impl<'a> Visitor<'a> for RecommendationAttributesVisitor { - type Value = RecommendationAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut confidence_level: Option = None; - let mut driver: Option = None; - let mut executor: Option = None; - let mut matched_params: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "confidence_level" => { - if v.is_null() || v.as_str() == Some("") { - continue; - } - confidence_level = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "driver" => { - driver = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "executor" => { - executor = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "matched_params" => { - if v.is_null() { - continue; - } - matched_params = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let driver = driver.ok_or_else(|| M::Error::missing_field("driver"))?; - let executor = executor.ok_or_else(|| M::Error::missing_field("executor"))?; - - let content = RecommendationAttributes { - confidence_level, - driver, - executor, - matched_params, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(RecommendationAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_recommendation_data.rs b/src/datadogV2/model/model_recommendation_data.rs deleted file mode 100644 index 5e182b3b7f..0000000000 --- a/src/datadogV2/model/model_recommendation_data.rs +++ /dev/null @@ -1,133 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// JSON:API resource object for SPA Recommendation. Includes type, optional ID, and resource attributes with structured recommendations. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct RecommendationData { - /// Attributes of the SPA Recommendation resource. Contains recommendations for both driver and executor components. - #[serde(rename = "attributes")] - pub attributes: crate::datadogV2::model::RecommendationAttributes, - /// Resource identifier for the recommendation. Optional in responses. - #[serde(rename = "id")] - pub id: Option, - /// JSON:API resource type for Spark Pod Autosizing recommendations. Identifies the Recommendation resource returned by SPA. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::RecommendationType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl RecommendationData { - pub fn new( - attributes: crate::datadogV2::model::RecommendationAttributes, - type_: crate::datadogV2::model::RecommendationType, - ) -> RecommendationData { - RecommendationData { - attributes, - id: None, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn id(mut self, value: String) -> Self { - self.id = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for RecommendationData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct RecommendationDataVisitor; - impl<'a> Visitor<'a> for RecommendationDataVisitor { - type Value = RecommendationData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option = - None; - let mut id: Option = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "id" => { - if v.is_null() { - continue; - } - id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::RecommendationType::UnparsedObject( - _type_, - ) => { - _unparsed = true; - } - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = RecommendationData { - attributes, - id, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(RecommendationDataVisitor) - } -} diff --git a/src/datadogV2/model/model_recommendation_document.rs b/src/datadogV2/model/model_recommendation_document.rs deleted file mode 100644 index c9ac416d0d..0000000000 --- a/src/datadogV2/model/model_recommendation_document.rs +++ /dev/null @@ -1,92 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// JSON:API document containing a single Recommendation resource. Returned by SPA when the Spark Gateway requests recommendations. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct RecommendationDocument { - /// JSON:API resource object for SPA Recommendation. Includes type, optional ID, and resource attributes with structured recommendations. - #[serde(rename = "data")] - pub data: crate::datadogV2::model::RecommendationData, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl RecommendationDocument { - pub fn new(data: crate::datadogV2::model::RecommendationData) -> RecommendationDocument { - RecommendationDocument { - data, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for RecommendationDocument { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct RecommendationDocumentVisitor; - impl<'a> Visitor<'a> for RecommendationDocumentVisitor { - type Value = RecommendationDocument; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let data = data.ok_or_else(|| M::Error::missing_field("data"))?; - - let content = RecommendationDocument { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(RecommendationDocumentVisitor) - } -} diff --git a/src/datadogV2/model/model_recommendation_type.rs b/src/datadogV2/model/model_recommendation_type.rs deleted file mode 100644 index 219d27f471..0000000000 --- a/src/datadogV2/model/model_recommendation_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum RecommendationType { - RECOMMENDATION, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for RecommendationType { - fn to_string(&self) -> String { - match self { - Self::RECOMMENDATION => String::from("recommendation"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for RecommendationType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for RecommendationType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "recommendation" => Self::RECOMMENDATION, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/src/datadogV2/model/model_recommendation_v2_request_attributes.rs b/src/datadogV2/model/model_recommendation_v2_request_attributes.rs deleted file mode 100644 index fe145731a3..0000000000 --- a/src/datadogV2/model/model_recommendation_v2_request_attributes.rs +++ /dev/null @@ -1,94 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Attributes for requesting SPA recommendations by forwarding a Spark job's raw arguments -/// instead of a pre-computed shard. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct RecommendationV2RequestAttributes { - /// Raw, unfiltered Spark job arguments as submitted (for example, `--org_id=2`). - /// SPA determines which arguments are relevant for the given service. - #[serde(rename = "arguments")] - pub arguments: Vec, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl RecommendationV2RequestAttributes { - pub fn new(arguments: Vec) -> RecommendationV2RequestAttributes { - RecommendationV2RequestAttributes { - arguments, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for RecommendationV2RequestAttributes { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct RecommendationV2RequestAttributesVisitor; - impl<'a> Visitor<'a> for RecommendationV2RequestAttributesVisitor { - type Value = RecommendationV2RequestAttributes; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut arguments: Option> = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "arguments" => { - arguments = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let arguments = arguments.ok_or_else(|| M::Error::missing_field("arguments"))?; - - let content = RecommendationV2RequestAttributes { - arguments, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(RecommendationV2RequestAttributesVisitor) - } -} diff --git a/src/datadogV2/model/model_recommendation_v2_request_body.rs b/src/datadogV2/model/model_recommendation_v2_request_body.rs deleted file mode 100644 index 24cd7124e9..0000000000 --- a/src/datadogV2/model/model_recommendation_v2_request_body.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// Request body for retrieving SPA recommendations by forwarding a Spark job's raw arguments -/// instead of a pre-computed shard. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct RecommendationV2RequestBody { - /// JSON:API resource object for the SPA v2 recommendation request. - #[serde(rename = "data")] - pub data: crate::datadogV2::model::RecommendationV2RequestData, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl RecommendationV2RequestBody { - pub fn new( - data: crate::datadogV2::model::RecommendationV2RequestData, - ) -> RecommendationV2RequestBody { - RecommendationV2RequestBody { - data, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for RecommendationV2RequestBody { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct RecommendationV2RequestBodyVisitor; - impl<'a> Visitor<'a> for RecommendationV2RequestBodyVisitor { - type Value = RecommendationV2RequestBody; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut data: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "data" => { - data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let data = data.ok_or_else(|| M::Error::missing_field("data"))?; - - let content = RecommendationV2RequestBody { - data, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(RecommendationV2RequestBodyVisitor) - } -} diff --git a/src/datadogV2/model/model_recommendation_v2_request_data.rs b/src/datadogV2/model/model_recommendation_v2_request_data.rs deleted file mode 100644 index b3ab89de25..0000000000 --- a/src/datadogV2/model/model_recommendation_v2_request_data.rs +++ /dev/null @@ -1,116 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use serde::de::{Error, MapAccess, Visitor}; -use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; - -/// JSON:API resource object for the SPA v2 recommendation request. -#[non_exhaustive] -#[skip_serializing_none] -#[derive(Clone, Debug, PartialEq, Serialize)] -pub struct RecommendationV2RequestData { - /// Attributes for requesting SPA recommendations by forwarding a Spark job's raw arguments - /// instead of a pre-computed shard. - #[serde(rename = "attributes")] - pub attributes: crate::datadogV2::model::RecommendationV2RequestAttributes, - /// JSON:API resource type for the SPA v2 recommendation request. - #[serde(rename = "type")] - pub type_: crate::datadogV2::model::RecommendationV2RequestType, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl RecommendationV2RequestData { - pub fn new( - attributes: crate::datadogV2::model::RecommendationV2RequestAttributes, - type_: crate::datadogV2::model::RecommendationV2RequestType, - ) -> RecommendationV2RequestData { - RecommendationV2RequestData { - attributes, - type_, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } -} - -impl<'de> Deserialize<'de> for RecommendationV2RequestData { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct RecommendationV2RequestDataVisitor; - impl<'a> Visitor<'a> for RecommendationV2RequestDataVisitor { - type Value = RecommendationV2RequestData; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") - } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut attributes: Option< - crate::datadogV2::model::RecommendationV2RequestAttributes, - > = None; - let mut type_: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "attributes" => { - attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "type" => { - type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _type_) = type_ { - match _type_ { - crate::datadogV2::model::RecommendationV2RequestType::UnparsedObject(_type_) => { - _unparsed = true; - }, - _ => {} - } - } - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; - let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; - - let content = RecommendationV2RequestData { - attributes, - type_, - additional_properties, - _unparsed, - }; - - Ok(content) - } - } - - deserializer.deserialize_any(RecommendationV2RequestDataVisitor) - } -} diff --git a/src/datadogV2/model/model_recommendation_v2_request_type.rs b/src/datadogV2/model/model_recommendation_v2_request_type.rs deleted file mode 100644 index dc7bbab4f0..0000000000 --- a/src/datadogV2/model/model_recommendation_v2_request_type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[non_exhaustive] -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum RecommendationV2RequestType { - RECOMMENDATION_V2_REQUEST, - UnparsedObject(crate::datadog::UnparsedObject), -} - -impl ToString for RecommendationV2RequestType { - fn to_string(&self) -> String { - match self { - Self::RECOMMENDATION_V2_REQUEST => String::from("recommendation_v2_request"), - Self::UnparsedObject(v) => v.value.to_string(), - } - } -} - -impl Serialize for RecommendationV2RequestType { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - Self::UnparsedObject(v) => v.serialize(serializer), - _ => serializer.serialize_str(self.to_string().as_str()), - } - } -} - -impl<'de> Deserialize<'de> for RecommendationV2RequestType { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let s: String = String::deserialize(deserializer)?; - Ok(match s.as_str() { - "recommendation_v2_request" => Self::RECOMMENDATION_V2_REQUEST, - _ => Self::UnparsedObject(crate::datadog::UnparsedObject { - value: serde_json::Value::String(s.into()), - }), - }) - } -} diff --git a/tests/scenarios/features/v2/spa.feature b/tests/scenarios/features/v2/spa.feature deleted file mode 100644 index c175f767e9..0000000000 --- a/tests/scenarios/features/v2/spa.feature +++ /dev/null @@ -1,101 +0,0 @@ -@endpoint(spa) @endpoint(spa-v2) -Feature: Spa - SPA (Spark Pod Autosizing) API. Provides resource recommendations and cost - insights to help optimize Spark job configurations. - - Background: - Given an instance of "Spa" API - - @generated @skip @team:ddoghq/data-and-analytics-processing - Scenario: Get SPA Recommendations returns "Bad Request" response - Given operation "GetSPARecommendations" enabled - And new "GetSPARecommendations" request - And request contains "service" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:ddoghq/data-and-analytics-processing - Scenario: Get SPA Recommendations returns "OK" response - Given operation "GetSPARecommendations" enabled - And new "GetSPARecommendations" request - And request contains "service" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:ddoghq/data-and-analytics-processing - Scenario: Get SPA Recommendations with a shard parameter returns "Bad Request" response - Given operation "GetSPARecommendationsWithShard" enabled - And new "GetSPARecommendationsWithShard" request - And request contains "shard" parameter from "REPLACE.ME" - And request contains "service" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:ddoghq/data-and-analytics-processing - Scenario: Get SPA Recommendations with a shard parameter returns "OK" response - Given operation "GetSPARecommendationsWithShard" enabled - And new "GetSPARecommendationsWithShard" request - And request contains "shard" parameter from "REPLACE.ME" - And request contains "service" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:ddoghq/data-and-analytics-processing - Scenario: Get SPA recommendations v2 returns "Bad Request" response - Given operation "GetSPARecommendationsV2" enabled - And new "GetSPARecommendationsV2" request - And request contains "service" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"arguments": [""]}, "type": "recommendation_v2_request"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:ddoghq/data-and-analytics-processing - Scenario: Get SPA recommendations v2 returns "Not Found" response - Given operation "GetSPARecommendationsV2" enabled - And new "GetSPARecommendationsV2" request - And request contains "service" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"arguments": [""]}, "type": "recommendation_v2_request"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:ddoghq/data-and-analytics-processing - Scenario: Get SPA recommendations v2 returns "OK" response - Given operation "GetSPARecommendationsV2" enabled - And new "GetSPARecommendationsV2" request - And request contains "service" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"arguments": [""]}, "type": "recommendation_v2_request"}} - When the request is sent - Then the response status is 200 OK - - @skip @team:ddoghq/data-and-analytics-processing - Scenario: GetSPARecommendations returns a JSON:API Recommendation with driver and executor estimations - Given new "GetSPARecommendations" request - And a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And operation "GetSPARecommendations" enabled - And request contains "service" parameter with value "dedupeactivecontexts" - And request contains "shard" parameter with value "adp_dedupeactivecontexts_org2" - When the request is sent - Then the response status is 404 Not Found - And the response "data.type" is equal to "recommendation" - And the response "data" has field "attributes" - And the response "data.attributes" has field "driver" - And the response "data.attributes" has field "executor" - And the response "data.attributes.driver" has field "estimation" - And the response "data.attributes.driver.estimation" has field "cpu" - And the response "data.attributes.driver.estimation" has field "memory" - And the response "data.attributes.driver.estimation" has field "ephemeral_storage" - And the response "data.attributes.driver.estimation" has field "heap" - And the response "data.attributes.driver.estimation" has field "overhead" - And the response "data.attributes.driver.estimation.cpu" has field "max" - And the response "data.attributes.driver.estimation.cpu" has field "p95" - And the response "data.attributes.driver.estimation.cpu" has field "p75" - And the response "data.attributes.executor" has field "estimation" - And the response "data.attributes.executor.estimation" has field "cpu" - And the response "data.attributes.executor.estimation" has field "memory" - And the response "data.attributes.executor.estimation" has field "ephemeral_storage" - And the response "data.attributes.executor.estimation" has field "heap" - And the response "data.attributes.executor.estimation" has field "overhead" - And the response "data.attributes.executor.estimation.cpu" has field "max" - And the response "data.attributes.executor.estimation.cpu" has field "p95" - And the response "data.attributes.executor.estimation.cpu" has field "p75" diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 8b44c94157..e121a0e357 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -9837,24 +9837,6 @@ "type": "unsafe" } }, - "GetSPARecommendationsV2": { - "tag": "Spa", - "undo": { - "type": "safe" - } - }, - "GetSPARecommendations": { - "tag": "Spa", - "undo": { - "type": "safe" - } - }, - "GetSPARecommendationsWithShard": { - "tag": "Spa", - "undo": { - "type": "safe" - } - }, "AggregateSpans": { "tag": "Spans", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index d082bed83a..e99de2f624 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -241,7 +241,6 @@ pub struct ApiInstances { Option, pub v2_api_reporting_and_sharing: Option, - pub v2_api_spa: Option, pub v2_api_spans: Option, pub v2_api_static_analysis: Option, pub v2_api_status_pages: Option, @@ -1525,13 +1524,6 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone() )); } - "Spa" => { - world.api_instances.v2_api_spa = - Some(datadogV2::api_spa::SpaAPI::with_client_and_config( - world.config.clone(), - world.http_client.as_ref().unwrap().clone(), - )); - } "Spans" => { world.api_instances.v2_api_spans = Some(datadogV2::api_spans::SpansAPI::with_client_and_config( @@ -8217,18 +8209,6 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.CreateSnapshot".into(), test_v2_create_snapshot); - world.function_mappings.insert( - "v2.GetSPARecommendationsV2".into(), - test_v2_get_spa_recommendations_v2, - ); - world.function_mappings.insert( - "v2.GetSPARecommendations".into(), - test_v2_get_spa_recommendations, - ); - world.function_mappings.insert( - "v2.GetSPARecommendationsWithShard".into(), - test_v2_get_spa_recommendations_with_shard, - ); world .function_mappings .insert("v2.AggregateSpans".into(), test_v2_aggregate_spans); @@ -65712,101 +65692,6 @@ fn test_v2_create_snapshot(world: &mut DatadogWorld, _parameters: &HashMap, -) { - let api = world - .api_instances - .v2_api_spa - .as_ref() - .expect("api instance not found"); - let service = serde_json::from_value(_parameters.get("service").unwrap().clone()).unwrap(); - let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); - let response = match block_on(api.get_spa_recommendations_v2_with_http_info(service, body)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_get_spa_recommendations(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_spa - .as_ref() - .expect("api instance not found"); - let service = serde_json::from_value(_parameters.get("service").unwrap().clone()).unwrap(); - let bypass_cache = _parameters - .get("bypass_cache") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let mut params = datadogV2::api_spa::GetSPARecommendationsOptionalParams::default(); - params.bypass_cache = bypass_cache; - let response = match block_on(api.get_spa_recommendations_with_http_info(service, params)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_get_spa_recommendations_with_shard( - world: &mut DatadogWorld, - _parameters: &HashMap, -) { - let api = world - .api_instances - .v2_api_spa - .as_ref() - .expect("api instance not found"); - let shard = serde_json::from_value(_parameters.get("shard").unwrap().clone()).unwrap(); - let service = serde_json::from_value(_parameters.get("service").unwrap().clone()).unwrap(); - let bypass_cache = _parameters - .get("bypass_cache") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let mut params = datadogV2::api_spa::GetSPARecommendationsWithShardOptionalParams::default(); - params.bypass_cache = bypass_cache; - let response = match block_on( - api.get_spa_recommendations_with_shard_with_http_info(shard, service, params), - ) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - fn test_v2_aggregate_spans(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances