diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index f2d8715f87..a0bee37b64 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -9793,53 +9793,30 @@ components: - data_source - query type: object - MonitorFormulaAndFunctionDataJobsMonitorOptions: - description: Monitor configuration options for data jobs queries. - properties: - alert_on_every_failure: - description: |- - Alert separately for each failed run instead of on the count of trailing failures. - Only supported for `failed_runs` monitors with the `aastra` query dialect. It requires - a `> 0` threshold with no warning threshold, an evaluation window of at most two days, - and renotification disabled. - example: true - type: boolean - type: object MonitorFormulaAndFunctionDataJobsQueryDefinition: description: A formula and functions data jobs query. properties: job_type: description: |- The type of job being monitored. Valid values include: - `databricks.job`, `spark.application`, `airflow.dag`, `dbt.job`, `glue.job`, `adf.pipeline`. - The `aastra` dialect also accepts `airflow.job`, `dbt.model`, and `dbt.test`. + `databricks.job`, `spark.application`, `airflow.dag`, + `dbt.job`, `dbt.model`, `dbt.test`, `glue.job`. Custom job types are supported with the `custom.ol.` prefix. example: "databricks.job" type: string jobs_query: - description: |- - Filter expression used to select the jobs to monitor. Its syntax depends on `query_dialect`: - a metric tag filter such as `job_name:smoke*` for `metric`, or an Aastra entity search - such as ``search for databricks_job where `@team:data-eng` `` for `aastra`. + description: Filter expression used to select the jobs to monitor. example: "job_name:smoke*" type: string - monitor_options: - $ref: "#/components/schemas/MonitorFormulaAndFunctionDataJobsMonitorOptions" name: description: Name of the query for use in formulas. Must be `run_query`. example: "run_query" type: string query_dialect: description: |- - Query dialect for data jobs queries. Valid values are `metric` and `aastra`. + Query dialect for data jobs queries. Currently only `metric` is supported. example: "metric" type: string - run_filter: - description: |- - Optional filter on individual runs, using metrics filter syntax. - Only supported with the `aastra` query dialect. - example: "env:prod" - type: string required: - name - jobs_query @@ -9854,18 +9831,6 @@ components: type: string x-enum-varnames: - DATA_QUALITY_METRICS - MonitorFormulaAndFunctionDataQualityDetectionType: - description: |- - How a `data-jobs alert` job duration monitor detects a breach. Must match the - `.detection()` call in the monitor query. Required for job duration monitors. - enum: - - static - - anomaly - example: "anomaly" - type: string - x-enum-varnames: - - STATIC - - ANOMALY MonitorFormulaAndFunctionDataQualityDiffFunction: description: |- Function applied to the measure before it is compared against the predicted bounds. @@ -9926,8 +9891,7 @@ components: The data quality measure to query. Common values include: `bytes`, `cardinality`, `custom`, `freshness`, `max`, `mean`, `min`, `nullness`, `percent_negative`, `percent_zero`, `row_count`, `stddev`, - `sum`, `uniqueness`. `data-jobs alert` job duration monitors use `duration`. - Additional values may be supported. + `sum`, `uniqueness`. Additional values may be supported. example: "row_count" type: string MonitorFormulaAndFunctionDataQualityModelBoundsOverride: @@ -9997,14 +9961,6 @@ components: MonitorFormulaAndFunctionDataQualityMonitorOptions: description: Monitor configuration options for data quality queries. properties: - consecutive_runs: - description: |- - Number of consecutive runs that must breach before the monitor alerts. - Only supported by `data-jobs alert` job duration monitors. Defaults to `1`. - example: 1 - format: int64 - minimum: 1 - type: integer crontab_override: description: Crontab expression to override the default schedule. example: "* * * 10" @@ -10017,8 +9973,6 @@ components: description: Custom WHERE clause for the query. example: "USER_ID = 123" type: string - detection_type: - $ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityDetectionType" group_by_columns: description: Columns to group results by. example: ["col1", "col2"] @@ -10066,12 +10020,6 @@ components: description: Name of the query for use in formulas. example: "query1" type: string - run_filter: - description: |- - Optional filter on individual runs, using metrics filter syntax. - Only supported by `data-jobs alert` job duration monitors. - example: "env:prod" - type: string schema_version: description: Schema version for the data quality query. example: "0.0.1" @@ -37331,22 +37279,6 @@ paths: - `time_window` #m (between 1 and 2880), #h (between 1 and 48). - `operator` `<`, `<=`, `>`, `>=`, `==`, or `!=`. - `#` an integer or decimal number used to set the threshold. - - **Data Jobs Alert Query** - - Job status example: `formula("failed_runs(run_query)").by(group_keys).last(time_window) > #` - - Job duration examples: `formula("job_duration(run_query)").detection(static).by(group_keys) > duration` - and `formula("job_duration(run_query)").detection(anomaly).by(group_keys) > 0` - - - `run_query`: The name of the single query variable in `options.variables`. Job status monitors - use a data jobs query; job duration monitors use a data quality query with the `duration` measure. - - `group_keys`: The tags to group by, such as `entity_id,name,workspace_name`. - - `time_window`: Number of minutes (#m), hours (#h), or days (#d), up to `10d`. - - `#`: The number of trailing failed runs to alert above, as a non-negative integer. - - `duration`: The duration to alert above, such as `2h`, `30m`, or a number of seconds. - - `options.thresholds.critical`: Must equal the query threshold, in seconds for job duration. - Anomaly job duration monitors omit `options.thresholds`. operationId: CreateMonitor requestBody: content: diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 57865d0cfe..40d61fede8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -741,6 +741,22 @@ components: required: true schema: type: string + CostRecommendationCustomRuleID: + description: The ID of the custom rule. + example: 8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b + in: path + name: custom_rule_id + required: true + schema: + type: string + CostRecommendationNotificationRuleID: + description: The ID of the notification rule. + example: 2c59b248-6a91-4f95-972a-dc236cae9cbb + in: path + name: notification_rule_id + required: true + schema: + type: string CustomDestinationId: description: The ID of the custom destination. in: path @@ -10826,7 +10842,7 @@ components: - MAX AiGatewayNullableRoutingRuleTierOrdering: description: >- - How a tier orders its targets. Omission preserves the saved same-position tier on update; null resets to configured. New tiers default to configured. The weighted_affinity ordering distributes first-choice assignments by relative target weights and accepts only model targets with an explicit provider, without repeated provider and model pairs in the same tier. The `classified` ordering is allowed only in the first tier and requires a classifier, destination rubrics, and one default destination. + How a tier orders its targets. Omission preserves the saved same-position tier on update; null resets to configured. New tiers default to configured. The weighted_affinity ordering distributes first-choice assignments by relative target weights and accepts only model targets with an explicit provider, without repeated provider and model pairs in the same tier. The `classified` ordering is allowed only in the first tier and requires a classifier, destination rubrics, and one default destination. Its targets are model targets that each name one provider, not "*". Besides the default, it needs 1 to 9 destinations, each with a different rubric. Classified routing is in Preview: saving a classified tier returns 403 Forbidden unless the feature is enabled for the organization. enum: - configured - weighted_affinity @@ -12102,7 +12118,8 @@ components: example: gpt-6-luna type: string provider: - description: Decision-model provider slug. Omit together with model to preserve the saved selection. + description: >- + Decision-model provider slug. It must name a provider of type `openai`, `baseten`, or `typesafe`, the provider types that serve a decision model. Omit together with model to preserve the saved selection. example: openai type: string type: object @@ -12354,13 +12371,14 @@ components: minimum: 1 type: integer provider: - description: Provider slug. weighted_affinity requires an explicit provider and does not allow "*". + description: Provider slug. weighted_affinity and classified tiers require an explicit provider and do not allow "*". example: prod-us type: string reasoning_level: $ref: "#/components/schemas/AiGatewayRoutingReasoningLevel" rubric: - description: Destination rubric in a classified tier. Omission preserves a saved value; null clears it. Must be absent on the default destination. + description: >- + Destination rubric in a classified tier: when the decision model picks this destination. Up to 300 characters after leading and trailing spaces are trimmed, and different for each destination in the tier. Omission preserves a saved value; null clears it. Must be absent on the default destination. example: Short factual questions. maxLength: 300 nullable: true @@ -30335,6 +30353,273 @@ components: required: - data type: object + CostRecommendationCustomRuleAttributes: + description: Attributes of a custom recommendation rule. + properties: + cloud_provider: + description: The cloud provider of the recommender, such as `aws`, `azure`, or `gcp`. + example: aws + type: string + created_at: + description: When the rule was created. + example: "2026-10-31T12:00:00Z" + format: date-time + type: string + created_by: + description: The UUID of the user who created the rule. + example: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + type: string + enabled: + description: Whether the rule is applied when recommendations are generated. + example: true + type: boolean + filters: + $ref: "#/components/schemas/CostRecommendationCustomRuleFilters" + modified_at: + description: When the rule was last modified. + example: "2026-10-31T12:00:00Z" + format: date-time + type: string + modified_by: + description: The UUID of the user who last modified the rule. + example: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + type: string + name: + description: The name of the rule. + example: Staging instances + type: string + notes: + description: Free-form notes, such as the reason for the customization. + example: Staging instances can run with less headroom. + type: string + priority: + description: The order in which the rules of a recommender are evaluated, lowest first. It is assigned when the rule is created. + example: 0 + format: int64 + type: integer + recommender_id: + description: The recommender the rule customizes. + example: aws_ec2_instance_unused + type: string + settings: + $ref: "#/components/schemas/CostRecommendationCustomRuleSettings" + required: + - cloud_provider + - created_at + - created_by + - enabled + - filters + - modified_at + - modified_by + - name + - notes + - priority + - recommender_id + - settings + type: object + CostRecommendationCustomRuleCreateAttributes: + description: Attributes of a new custom recommendation rule. + properties: + enabled: + description: Whether the rule is applied when recommendations are generated. Defaults to `true`. + example: true + type: boolean + filters: + $ref: "#/components/schemas/CostRecommendationCustomRuleFilters" + name: + description: The name of the rule. + example: Staging instances + minLength: 1 + type: string + notes: + description: Free-form notes, such as the reason for the customization. + example: Staging instances can run with less headroom. + type: string + recommender_id: + description: The recommender to customize. It must be a recommender that supports custom rules. + example: aws_ec2_instance_unused + type: string + settings: + $ref: "#/components/schemas/CostRecommendationCustomRuleSettings" + required: + - name + - recommender_id + type: object + CostRecommendationCustomRuleCreateData: + description: A new custom recommendation rule. + properties: + attributes: + $ref: "#/components/schemas/CostRecommendationCustomRuleCreateAttributes" + type: + $ref: "#/components/schemas/CostRecommendationCustomRuleType" + required: + - attributes + - type + type: object + CostRecommendationCustomRuleCreateRequest: + description: Request to create a custom recommendation rule. + properties: + data: + $ref: "#/components/schemas/CostRecommendationCustomRuleCreateData" + required: + - data + type: object + CostRecommendationCustomRuleData: + description: A custom recommendation rule. + properties: + attributes: + $ref: "#/components/schemas/CostRecommendationCustomRuleAttributes" + id: + description: The ID of the custom rule. + example: 8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b + type: string + type: + $ref: "#/components/schemas/CostRecommendationCustomRuleType" + required: + - attributes + - id + - type + type: object + CostRecommendationCustomRuleFilter: + description: A tag filter. A rule applies to a resource only when every filter of the rule matches. + properties: + filter_type: + $ref: "#/components/schemas/CostRecommendationCustomRuleFilterType" + tag: + description: The tag key the filter compares. + example: env + type: string + values: + $ref: "#/components/schemas/CostRecommendationCustomRuleFilterValues" + required: + - tag + - filter_type + type: object + CostRecommendationCustomRuleFilterType: + description: |- + How the filter compares the tag. `is`, `is_not`, `contains`, `does_not_contain`, `like` (glob), and `not_like` + compare the tag values with `values`. `all` matches resources that have the tag and `untagged` matches resources + that do not, so both ignore `values`. + enum: + - is + - is_not + - contains + - does_not_contain + - like + - not_like + - all + - untagged + example: is + type: string + x-enum-varnames: + - IS + - IS_NOT + - CONTAINS + - DOES_NOT_CONTAIN + - LIKE + - NOT_LIKE + - ALL + - UNTAGGED + CostRecommendationCustomRuleFilterValues: + description: Tag values the filter compares. Required unless `filter_type` is `all` or `untagged`. + example: + - staging + items: + description: A tag value. + type: string + type: array + CostRecommendationCustomRuleFilters: + description: Tag filters that select the resources the rule applies to. An empty list selects every resource. + items: + $ref: "#/components/schemas/CostRecommendationCustomRuleFilter" + type: array + CostRecommendationCustomRuleResponse: + description: A custom recommendation rule. + properties: + data: + $ref: "#/components/schemas/CostRecommendationCustomRuleData" + required: + - data + type: object + CostRecommendationCustomRuleSettings: + additionalProperties: + description: The value of the setting. + format: double + type: number + description: |- + Setting overrides, keyed by setting name. Settings left out keep the recommender default. The accepted + settings and their ranges depend on the recommender. + example: + lookback_days: 14 + max_cpu_user_limit: 0.05 + type: object + CostRecommendationCustomRuleType: + default: custom_rules + description: Custom recommendation rule resource type. + enum: + - custom_rules + example: custom_rules + type: string + x-enum-varnames: + - CUSTOM_RULES + CostRecommendationCustomRuleUpdateAttributes: + description: |- + Attributes to change. Attributes left out keep their value. `filters` and `settings` replace the stored list + and map when sent. + properties: + enabled: + description: Whether the rule is applied when recommendations are generated. + example: false + type: boolean + filters: + $ref: "#/components/schemas/CostRecommendationCustomRuleFilters" + name: + description: The name of the rule. + example: Staging and development instances + minLength: 1 + type: string + notes: + description: Free-form notes, such as the reason for the customization. + example: Staging instances can run with less headroom. + type: string + settings: + $ref: "#/components/schemas/CostRecommendationCustomRuleSettings" + type: object + CostRecommendationCustomRuleUpdateData: + description: Changes to a custom recommendation rule. + properties: + attributes: + $ref: "#/components/schemas/CostRecommendationCustomRuleUpdateAttributes" + id: + description: The ID of the custom rule. It must match the ID in the path. + example: 8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b + type: string + type: + $ref: "#/components/schemas/CostRecommendationCustomRuleType" + required: + - attributes + - id + - type + type: object + CostRecommendationCustomRuleUpdateRequest: + description: Request to update a custom recommendation rule. + properties: + data: + $ref: "#/components/schemas/CostRecommendationCustomRuleUpdateData" + required: + - data + type: object + CostRecommendationCustomRulesResponse: + description: The custom recommendation rules of the organization. + properties: + data: + description: The custom rules, ordered by recommender and then by priority. + items: + $ref: "#/components/schemas/CostRecommendationCustomRuleData" + type: array + required: + - data + type: object CostRecommendationData: description: A single cost recommendation entry in JSON:API form. properties: @@ -30392,6 +30677,491 @@ components: type: string x-enum-varnames: - RECOMMENDATION + CostRecommendationNotificationRuleAttributes: + description: Attributes of a recommendation notification rule. + properties: + channel_id: + description: The Slack channel ID. Empty for `teams` rules. + example: C0456ABCD + type: string + created_at: + description: When the rule was created. + example: "2026-10-31T12:00:00Z" + format: date-time + type: string + created_by: + description: The UUID of the user who created the rule. + example: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + type: string + destination_type: + $ref: "#/components/schemas/CostRecommendationNotificationRuleDestinationType" + enabled: + description: Whether the digest is sent. + example: true + type: boolean + frequency: + $ref: "#/components/schemas/CostRecommendationNotificationRuleFrequency" + interval_execution_date: + description: The first date (`YYYY-MM-DD`) of an `every_30` or `every_90` schedule. + example: "2026-11-02" + nullable: true + type: string + interval_execution_time: + description: The time of day (`HH:MM`, in `timezone`) of an `every_30` or `every_90` schedule. + example: "09:30" + nullable: true + type: string + mention_targets: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMentionTargets" + message_customization: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMessageCustomization" + modified_at: + description: When the rule was last modified. + example: "2026-10-31T12:00:00Z" + format: date-time + type: string + modified_by: + description: The UUID of the user who last modified the rule. + example: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + type: string + name: + description: The name of the rule, unique within the organization. + example: Production recommendations + type: string + org_id: + description: The ID of the organization that owns the rule. + example: 2 + format: int64 + type: integer + scope_query: + description: The recommendation search query that selects what the digest includes. Empty selects every recommendation. + example: "service:api AND env:prod" + type: string + teams_channel_id: + description: The Microsoft Teams channel ID. Empty for `slack` rules. + example: "" + type: string + teams_channel_name: + description: The Microsoft Teams channel name. Empty for `slack` rules. + example: "" + type: string + teams_team_id: + description: The Microsoft Teams team ID. Empty for `slack` rules. + example: "" + type: string + teams_team_name: + description: The Microsoft Teams team name. Empty for `slack` rules. + example: "" + type: string + teams_tenant_id: + description: The Microsoft Teams tenant ID. Empty for `slack` rules. + example: "" + type: string + teams_tenant_name: + description: The Microsoft Teams tenant name. Empty for `slack` rules. + example: "" + type: string + timezone: + description: The IANA time zone of the schedule. + example: America/New_York + type: string + weekly_execution_day: + description: The day of the week of a `weekly` or `biweekly` schedule, such as `monday`. + example: monday + nullable: true + type: string + weekly_execution_time: + description: The time of day (`HH:MM`, in `timezone`) of a `weekly` or `biweekly` schedule. + example: "09:30" + nullable: true + type: string + workspace_id: + description: The Slack workspace ID. Empty for `teams` rules. + example: T0123ABCD + type: string + required: + - channel_id + - created_at + - created_by + - destination_type + - enabled + - frequency + - interval_execution_date + - interval_execution_time + - mention_targets + - message_customization + - modified_at + - modified_by + - name + - org_id + - scope_query + - teams_channel_id + - teams_channel_name + - teams_team_id + - teams_team_name + - teams_tenant_id + - teams_tenant_name + - timezone + - weekly_execution_day + - weekly_execution_time + - workspace_id + type: object + CostRecommendationNotificationRuleCreateAttributes: + description: |- + Attributes of a new recommendation notification rule. Schedule attributes depend on `frequency` and target + attributes depend on `destination_type`. + properties: + channel_id: + description: The Slack channel ID, starting with `C` or `G`. Required for `slack` rules. + example: C0456ABCD + type: string + destination_type: + $ref: "#/components/schemas/CostRecommendationNotificationRuleDestinationType" + enabled: + description: Whether the digest is sent. Defaults to `true`. + example: true + type: boolean + frequency: + $ref: "#/components/schemas/CostRecommendationNotificationRuleFrequency" + interval_execution_date: + description: The first date (`YYYY-MM-DD`) of an `every_30` or `every_90` schedule. + example: "2026-11-02" + type: string + interval_execution_time: + description: The time of day (`HH:MM`, in `timezone`) of an `every_30` or `every_90` schedule. + example: "09:30" + type: string + mention_targets: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMentionTargets" + message_customization: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMessageCustomization" + name: + description: The name of the rule, unique within the organization. + example: Production recommendations + type: string + scope_query: + description: The recommendation search query that selects what the digest includes. Empty selects every recommendation. + example: "service:api AND env:prod" + type: string + teams_channel_id: + description: The Microsoft Teams channel ID. Required for `teams` rules. + type: string + teams_channel_name: + description: The Microsoft Teams channel name. Required for `teams` rules. + type: string + teams_team_id: + description: The Microsoft Teams team ID. Required for `teams` rules. + type: string + teams_team_name: + description: The Microsoft Teams team name. Required for `teams` rules. + type: string + teams_tenant_id: + description: The Microsoft Teams tenant ID. Required for `teams` rules. + type: string + teams_tenant_name: + description: The Microsoft Teams tenant name. Required for `teams` rules. + type: string + timezone: + description: The IANA time zone of the schedule. + example: America/New_York + type: string + weekly_execution_day: + description: The day of the week of a `weekly` or `biweekly` schedule, such as `monday`. + example: monday + type: string + weekly_execution_time: + description: The time of day (`HH:MM`, in `timezone`) of a `weekly` or `biweekly` schedule. + example: "09:30" + type: string + workspace_id: + description: The Slack workspace ID, starting with `T`. Required for `slack` rules. + example: T0123ABCD + type: string + required: + - frequency + - name + - timezone + type: object + CostRecommendationNotificationRuleCreateData: + description: A new recommendation notification rule. + properties: + attributes: + $ref: "#/components/schemas/CostRecommendationNotificationRuleCreateAttributes" + type: + $ref: "#/components/schemas/CostRecommendationNotificationRuleType" + required: + - attributes + - type + type: object + CostRecommendationNotificationRuleCreateRequest: + description: Request to create a recommendation notification rule. + properties: + data: + $ref: "#/components/schemas/CostRecommendationNotificationRuleCreateData" + required: + - data + type: object + CostRecommendationNotificationRuleData: + description: A recommendation notification rule. + properties: + attributes: + $ref: "#/components/schemas/CostRecommendationNotificationRuleAttributes" + id: + description: The ID of the notification rule. + example: 2c59b248-6a91-4f95-972a-dc236cae9cbb + type: string + type: + $ref: "#/components/schemas/CostRecommendationNotificationRuleType" + required: + - attributes + - id + - type + type: object + CostRecommendationNotificationRuleDestinationType: + description: |- + Where the digest is sent. `slack` requires `workspace_id` and `channel_id`; `teams` requires the + `teams_*` attributes. Defaults to `slack`. + enum: + - slack + - teams + example: slack + type: string + x-enum-varnames: + - SLACK + - TEAMS + CostRecommendationNotificationRuleFrequency: + description: |- + How often the digest is sent. `weekly` and `biweekly` use `weekly_execution_day` and `weekly_execution_time`; + `every_30` and `every_90` (days) use `interval_execution_date` and `interval_execution_time`. + enum: + - weekly + - biweekly + - every_30 + - every_90 + example: weekly + type: string + x-enum-varnames: + - WEEKLY + - BIWEEKLY + - EVERY_30 + - EVERY_90 + CostRecommendationNotificationRuleIncludeTags: + description: Tag keys whose values are shown on each recommendation in the digest. + example: + - team + items: + description: A tag key. + type: string + type: array + CostRecommendationNotificationRuleMentionTargets: + description: Slack member IDs to mention in the digest. Only valid for `slack` rules. + example: + - U01ABCDE + items: + description: A Slack member ID. + type: string + type: array + CostRecommendationNotificationRuleMessageAction: + description: Where a message action appears. + properties: + bulk: + description: Whether the action appears once for the whole digest. + example: true + type: boolean + per_rec: + description: Whether the action appears on each recommendation. + example: true + type: boolean + type: object + CostRecommendationNotificationRuleMessageActions: + description: Links the digest shows. `view_in_ccm` is the link to review the recommendations in Cloud Cost Management. + properties: + view_in_ccm: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMessageAction" + type: object + CostRecommendationNotificationRuleMessageCustomization: + description: |- + Which sections the digest shows. Sent as a whole: sections left out of a request use their defaults, which + show everything. + properties: + actions: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMessageActions" + header: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMessageCustomizationHeader" + include_tags: + $ref: "#/components/schemas/CostRecommendationNotificationRuleIncludeTags" + mode: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMessageCustomizationMode" + per_rec: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMessageCustomizationPerRec" + type: object + CostRecommendationNotificationRuleMessageCustomizationHeader: + description: What the digest header shows. + properties: + custom_text: + description: |- + Text shown in the header, up to 500 characters. It can use the `{{ total_savings }}`, `{{ rec_count }}`, + and `{{ digest_date }}` variables. + example: "{{ rec_count }} recommendations to review this week." + maxLength: 500 + type: string + notification_name: + description: Whether the header shows the rule name. + example: true + type: boolean + total_savings: + description: Whether the header shows the total potential savings. + example: true + type: boolean + type: object + CostRecommendationNotificationRuleMessageCustomizationMode: + description: How the message is customized. + enum: + - structured + example: structured + type: string + x-enum-varnames: + - STRUCTURED + CostRecommendationNotificationRuleMessageCustomizationPerRec: + description: What each recommendation in the digest shows. + properties: + effort: + description: Whether each recommendation shows its effort. + example: true + type: boolean + risk: + description: Whether each recommendation shows its risk. + example: true + type: boolean + why: + description: Whether each recommendation shows why it was made. + example: true + type: boolean + type: object + CostRecommendationNotificationRuleResponse: + description: A recommendation notification rule. + properties: + data: + $ref: "#/components/schemas/CostRecommendationNotificationRuleData" + required: + - data + type: object + CostRecommendationNotificationRuleType: + default: notification_rules + description: Recommendation notification rule resource type. + enum: + - notification_rules + example: notification_rules + type: string + x-enum-varnames: + - NOTIFICATION_RULES + CostRecommendationNotificationRuleUpdateAttributes: + description: |- + Attributes to change. Attributes left out keep their value; `mention_targets` and `message_customization` + replace the stored value when sent. + properties: + channel_id: + description: The Slack channel ID, starting with `C` or `G`. + example: C0456ABCD + type: string + destination_type: + $ref: "#/components/schemas/CostRecommendationNotificationRuleDestinationType" + enabled: + description: Whether the digest is sent. + example: false + type: boolean + frequency: + $ref: "#/components/schemas/CostRecommendationNotificationRuleFrequency" + interval_execution_date: + description: The first date (`YYYY-MM-DD`) of an `every_30` or `every_90` schedule. + example: "2026-11-02" + type: string + interval_execution_time: + description: The time of day (`HH:MM`, in `timezone`) of an `every_30` or `every_90` schedule. + example: "09:30" + type: string + mention_targets: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMentionTargets" + message_customization: + $ref: "#/components/schemas/CostRecommendationNotificationRuleMessageCustomization" + name: + description: The name of the rule, unique within the organization. + example: Production recommendations + type: string + scope_query: + description: The recommendation search query that selects what the digest includes. Empty selects every recommendation. + example: "service:api AND env:prod" + type: string + teams_channel_id: + description: The Microsoft Teams channel ID. + type: string + teams_channel_name: + description: The Microsoft Teams channel name. + type: string + teams_team_id: + description: The Microsoft Teams team ID. + type: string + teams_team_name: + description: The Microsoft Teams team name. + type: string + teams_tenant_id: + description: The Microsoft Teams tenant ID. + type: string + teams_tenant_name: + description: The Microsoft Teams tenant name. + type: string + timezone: + description: The IANA time zone of the schedule. + example: America/New_York + type: string + weekly_execution_day: + description: The day of the week of a `weekly` or `biweekly` schedule, such as `monday`. + example: monday + type: string + weekly_execution_time: + description: The time of day (`HH:MM`, in `timezone`) of a `weekly` or `biweekly` schedule. + example: "09:30" + type: string + workspace_id: + description: The Slack workspace ID, starting with `T`. + example: T0123ABCD + type: string + type: object + CostRecommendationNotificationRuleUpdateData: + description: Changes to a recommendation notification rule. + properties: + attributes: + $ref: "#/components/schemas/CostRecommendationNotificationRuleUpdateAttributes" + id: + description: The ID of the notification rule. It must match the ID in the path. + example: 2c59b248-6a91-4f95-972a-dc236cae9cbb + type: string + type: + $ref: "#/components/schemas/CostRecommendationNotificationRuleType" + required: + - attributes + - id + - type + type: object + CostRecommendationNotificationRuleUpdateRequest: + description: Request to update a recommendation notification rule. + properties: + data: + $ref: "#/components/schemas/CostRecommendationNotificationRuleUpdateData" + required: + - data + type: object + CostRecommendationNotificationRulesResponse: + description: The recommendation notification rules of the organization. + properties: + data: + description: The notification rules. + items: + $ref: "#/components/schemas/CostRecommendationNotificationRuleData" + type: array + required: + - data + type: object CostTag: description: A Cloud Cost Management tag. properties: @@ -174309,6 +175079,790 @@ 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/cost/recommendations/custom_rules: + get: + description: List the custom recommendation rules of the organization. A custom rule overrides recommender settings for the resources its tag filters match. + operationId: ListCostRecommendationCustomRules + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + cloud_provider: aws + created_at: "2026-10-31T12:00:00Z" + created_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + enabled: true + filters: + - filter_type: is + tag: env + values: + - staging + modified_at: "2026-10-31T12:00:00Z" + modified_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + name: Staging instances + notes: Staging instances can run with less headroom. + priority: 0 + recommender_id: aws_ec2_instance_unused + settings: + lookback_days: 14 + max_cpu_user_limit: 0.05 + id: 8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b + type: custom_rules + schema: + $ref: "#/components/schemas/CostRecommendationCustomRulesResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List cost recommendation custom rules + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + 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/). + post: + description: Create a custom recommendation rule. The rule overrides the settings it lists for the resources its tag filters match; every other setting keeps the recommender default. Only the settings in the request are stored. + operationId: CreateCostRecommendationCustomRule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + filters: + - filter_type: is + tag: env + values: + - staging + name: Staging instances + notes: Staging instances can run with less headroom. + recommender_id: aws_ec2_instance_unused + settings: + lookback_days: 14 + max_cpu_user_limit: 0.05 + type: custom_rules + schema: + $ref: "#/components/schemas/CostRecommendationCustomRuleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + cloud_provider: aws + created_at: "2026-10-31T12:00:00Z" + created_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + enabled: true + filters: + - filter_type: is + tag: env + values: + - staging + modified_at: "2026-10-31T12:00:00Z" + modified_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + name: Staging instances + notes: Staging instances can run with less headroom. + priority: 0 + recommender_id: aws_ec2_instance_unused + settings: + lookback_days: 14 + max_cpu_user_limit: 0.05 + id: 8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b + type: custom_rules + schema: + $ref: "#/components/schemas/CostRecommendationCustomRuleResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Create a cost recommendation custom rule + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + 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/cost/recommendations/custom_rules/{custom_rule_id}: + delete: + description: Delete a custom recommendation rule. + operationId: DeleteCostRecommendationCustomRule + parameters: + - $ref: "#/components/parameters/CostRecommendationCustomRuleID" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Delete a cost recommendation custom rule + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + 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/). + get: + description: Get a custom recommendation rule. + operationId: GetCostRecommendationCustomRule + parameters: + - $ref: "#/components/parameters/CostRecommendationCustomRuleID" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + cloud_provider: aws + created_at: "2026-10-31T12:00:00Z" + created_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + enabled: true + filters: + - filter_type: is + tag: env + values: + - staging + modified_at: "2026-10-31T12:00:00Z" + modified_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + name: Staging instances + notes: Staging instances can run with less headroom. + priority: 0 + recommender_id: aws_ec2_instance_unused + settings: + lookback_days: 14 + max_cpu_user_limit: 0.05 + id: 8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b + type: custom_rules + schema: + $ref: "#/components/schemas/CostRecommendationCustomRuleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get a cost recommendation custom rule + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + 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/). + patch: + description: Update a custom recommendation rule. Attributes left out keep their value; `filters` and `settings` replace the stored list and map when sent. The recommender of a rule cannot change. + operationId: UpdateCostRecommendationCustomRule + parameters: + - $ref: "#/components/parameters/CostRecommendationCustomRuleID" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enabled: false + name: Staging and development instances + id: 8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b + type: custom_rules + schema: + $ref: "#/components/schemas/CostRecommendationCustomRuleUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + cloud_provider: aws + created_at: "2026-10-31T12:00:00Z" + created_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + enabled: true + filters: + - filter_type: is + tag: env + values: + - staging + modified_at: "2026-10-31T12:00:00Z" + modified_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + name: Staging instances + notes: Staging instances can run with less headroom. + priority: 0 + recommender_id: aws_ec2_instance_unused + settings: + lookback_days: 14 + max_cpu_user_limit: 0.05 + id: 8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b + type: custom_rules + schema: + $ref: "#/components/schemas/CostRecommendationCustomRuleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Update a cost recommendation custom rule + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + 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/cost/recommendations/notification_rules: + get: + description: List the recommendation notification rules of the organization. A notification rule sends a digest of the cost recommendations that match its query to Slack or Microsoft Teams on a schedule. + operationId: ListCostRecommendationNotificationRules + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + channel_id: C0456ABCD + created_at: "2026-10-31T12:00:00Z" + created_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + destination_type: slack + enabled: true + frequency: weekly + interval_execution_date: + interval_execution_time: + mention_targets: [] + message_customization: + actions: + view_in_ccm: + bulk: true + per_rec: true + header: + notification_name: true + total_savings: true + mode: structured + per_rec: + effort: true + risk: true + why: true + modified_at: "2026-10-31T12:00:00Z" + modified_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + name: Production recommendations + org_id: 2 + scope_query: "service:api AND env:prod" + teams_channel_id: "" + teams_channel_name: "" + teams_team_id: "" + teams_team_name: "" + teams_tenant_id: "" + teams_tenant_name: "" + timezone: America/New_York + weekly_execution_day: monday + weekly_execution_time: "09:30" + workspace_id: T0123ABCD + id: 2c59b248-6a91-4f95-972a-dc236cae9cbb + type: notification_rules + schema: + $ref: "#/components/schemas/CostRecommendationNotificationRulesResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List cost recommendation notification rules + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + 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/). + post: + description: Create a rule that sends a digest of the cost recommendations matching `scope_query` to Slack or Microsoft Teams on a schedule. + operationId: CreateCostRecommendationNotificationRule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + channel_id: C0456ABCD + destination_type: slack + enabled: true + frequency: weekly + name: Production recommendations + scope_query: "service:api AND env:prod" + timezone: America/New_York + weekly_execution_day: monday + weekly_execution_time: "09:30" + workspace_id: T0123ABCD + type: notification_rules + schema: + $ref: "#/components/schemas/CostRecommendationNotificationRuleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + channel_id: C0456ABCD + created_at: "2026-10-31T12:00:00Z" + created_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + destination_type: slack + enabled: true + frequency: weekly + interval_execution_date: + interval_execution_time: + mention_targets: [] + message_customization: + actions: + view_in_ccm: + bulk: true + per_rec: true + header: + notification_name: true + total_savings: true + mode: structured + per_rec: + effort: true + risk: true + why: true + modified_at: "2026-10-31T12:00:00Z" + modified_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + name: Production recommendations + org_id: 2 + scope_query: "service:api AND env:prod" + teams_channel_id: "" + teams_channel_name: "" + teams_team_id: "" + teams_team_name: "" + teams_tenant_id: "" + teams_tenant_name: "" + timezone: America/New_York + weekly_execution_day: monday + weekly_execution_time: "09:30" + workspace_id: T0123ABCD + id: 2c59b248-6a91-4f95-972a-dc236cae9cbb + type: notification_rules + schema: + $ref: "#/components/schemas/CostRecommendationNotificationRuleResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Create a cost recommendation notification rule + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + 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/cost/recommendations/notification_rules/{notification_rule_id}: + delete: + description: Delete a recommendation notification rule. + operationId: DeleteCostRecommendationNotificationRule + parameters: + - $ref: "#/components/parameters/CostRecommendationNotificationRuleID" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Delete a cost recommendation notification rule + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + 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/). + get: + description: Get a recommendation notification rule. + operationId: GetCostRecommendationNotificationRule + parameters: + - $ref: "#/components/parameters/CostRecommendationNotificationRuleID" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + channel_id: C0456ABCD + created_at: "2026-10-31T12:00:00Z" + created_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + destination_type: slack + enabled: true + frequency: weekly + interval_execution_date: + interval_execution_time: + mention_targets: [] + message_customization: + actions: + view_in_ccm: + bulk: true + per_rec: true + header: + notification_name: true + total_savings: true + mode: structured + per_rec: + effort: true + risk: true + why: true + modified_at: "2026-10-31T12:00:00Z" + modified_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + name: Production recommendations + org_id: 2 + scope_query: "service:api AND env:prod" + teams_channel_id: "" + teams_channel_name: "" + teams_team_id: "" + teams_team_name: "" + teams_tenant_id: "" + teams_tenant_name: "" + timezone: America/New_York + weekly_execution_day: monday + weekly_execution_time: "09:30" + workspace_id: T0123ABCD + id: 2c59b248-6a91-4f95-972a-dc236cae9cbb + type: notification_rules + schema: + $ref: "#/components/schemas/CostRecommendationNotificationRuleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get a cost recommendation notification rule + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + 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/). + patch: + description: Update a recommendation notification rule. Attributes left out keep their value. + operationId: UpdateCostRecommendationNotificationRule + parameters: + - $ref: "#/components/parameters/CostRecommendationNotificationRuleID" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enabled: false + id: 2c59b248-6a91-4f95-972a-dc236cae9cbb + type: notification_rules + schema: + $ref: "#/components/schemas/CostRecommendationNotificationRuleUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + channel_id: C0456ABCD + created_at: "2026-10-31T12:00:00Z" + created_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + destination_type: slack + enabled: true + frequency: weekly + interval_execution_date: + interval_execution_time: + mention_targets: [] + message_customization: + actions: + view_in_ccm: + bulk: true + per_rec: true + header: + notification_name: true + total_savings: true + mode: structured + per_rec: + effort: true + risk: true + why: true + modified_at: "2026-10-31T12:00:00Z" + modified_by: 9c1b5d2e-7f3a-4c8b-a6d4-2e1f0b9c8a7d + name: Production recommendations + org_id: 2 + scope_query: "service:api AND env:prod" + teams_channel_id: "" + teams_channel_name: "" + teams_team_id: "" + teams_team_name: "" + teams_tenant_id: "" + teams_tenant_name: "" + timezone: America/New_York + weekly_execution_day: monday + weekly_execution_time: "09:30" + workspace_id: T0123ABCD + id: 2c59b248-6a91-4f95-972a-dc236cae9cbb + type: notification_rules + schema: + $ref: "#/components/schemas/CostRecommendationNotificationRuleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Update a cost recommendation notification rule + tags: + - Cloud Cost Management + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + 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/cost/tag_descriptions: get: description: List Cloud Cost Management tag key descriptions for the organization. Use `filter[cloud]` to scope the result to a single cloud provider; when omitted, both cross-cloud defaults and cloud-specific descriptions are returned. diff --git a/examples/v1/monitors/CreateMonitor_1267012748.py b/examples/v1/monitors/CreateMonitor_1267012748.py deleted file mode 100644 index cbffcecde0..0000000000 --- a/examples/v1/monitors/CreateMonitor_1267012748.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -Create a Data Jobs duration monitor returns "OK" response -""" - -from os import environ -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v1.api.monitors_api import MonitorsApi -from datadog_api_client.v1.model.monitor import Monitor -from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_data_source import ( - MonitorFormulaAndFunctionDataQualityDataSource, -) -from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_detection_type import ( - MonitorFormulaAndFunctionDataQualityDetectionType, -) -from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_monitor_options import ( - MonitorFormulaAndFunctionDataQualityMonitorOptions, -) -from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_query_definition import ( - MonitorFormulaAndFunctionDataQualityQueryDefinition, -) -from datadog_api_client.v1.model.monitor_options import MonitorOptions -from datadog_api_client.v1.model.monitor_type import MonitorType - -body = Monitor( - name="Example-Monitor", - type=MonitorType.DATA_JOBS_ALERT, - query='formula("job_duration(run_query)").detection(anomaly).by(name,workspace_name,entity_id) > 0', - message="Data jobs duration alert triggered", - tags=[ - "test:examplemonitor", - "env:ci", - ], - options=MonitorOptions( - variables=[ - MonitorFormulaAndFunctionDataQualityQueryDefinition( - name="run_query", - data_source=MonitorFormulaAndFunctionDataQualityDataSource.DATA_QUALITY_METRICS, - schema_version="0.0.1", - measure="duration", - filter="search for databricks_job", - run_filter="env:prod", - group_by=[ - "name", - "workspace_name", - "entity_id", - ], - monitor_options=MonitorFormulaAndFunctionDataQualityMonitorOptions( - detection_type=MonitorFormulaAndFunctionDataQualityDetectionType.ANOMALY, - consecutive_runs=2, - ), - ), - ], - ), -) - -configuration = Configuration() -configuration.access_token = environ["DD_BEARER_TOKEN"] -with ApiClient(configuration) as api_client: - api_instance = MonitorsApi(api_client) - response = api_instance.create_monitor(body=body) - - print(response) diff --git a/examples/v1/monitors/CreateMonitor_1302731819.py b/examples/v1/monitors/CreateMonitor_1302731819.py deleted file mode 100644 index da9748f655..0000000000 --- a/examples/v1/monitors/CreateMonitor_1302731819.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -Create a Data Jobs monitor with the aastra query dialect returns "OK" response -""" - -from os import environ -from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v1.api.monitors_api import MonitorsApi -from datadog_api_client.v1.model.monitor import Monitor -from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_monitor_options import ( - MonitorFormulaAndFunctionDataJobsMonitorOptions, -) -from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_query_definition import ( - MonitorFormulaAndFunctionDataJobsQueryDefinition, -) -from datadog_api_client.v1.model.monitor_options import MonitorOptions -from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds -from datadog_api_client.v1.model.monitor_type import MonitorType - -body = Monitor( - name="Example-Monitor", - type=MonitorType.DATA_JOBS_ALERT, - query='formula("failed_runs(run_query)").by(name,workspace_name,entity_id).last(1d) > 0', - message="Data jobs alert triggered", - tags=[ - "test:examplemonitor", - "env:ci", - ], - options=MonitorOptions( - thresholds=MonitorThresholds( - critical=0.0, - ), - variables=[ - MonitorFormulaAndFunctionDataJobsQueryDefinition( - name="run_query", - jobs_query="search for databricks_job", - job_type="databricks.job", - query_dialect="aastra", - run_filter="env:prod", - monitor_options=MonitorFormulaAndFunctionDataJobsMonitorOptions( - alert_on_every_failure=True, - ), - ), - ], - ), -) - -configuration = Configuration() -configuration.access_token = environ["DD_BEARER_TOKEN"] -with ApiClient(configuration) as api_client: - api_instance = MonitorsApi(api_client) - response = api_instance.create_monitor(body=body) - - print(response) diff --git a/examples/v2/cloud-cost-management/CreateCostRecommendationCustomRule.py b/examples/v2/cloud-cost-management/CreateCostRecommendationCustomRule.py new file mode 100644 index 0000000000..e6bc3717fe --- /dev/null +++ b/examples/v2/cloud-cost-management/CreateCostRecommendationCustomRule.py @@ -0,0 +1,56 @@ +""" +Create a cost recommendation custom rule returns "Created" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi +from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_attributes import ( + CostRecommendationCustomRuleCreateAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_data import ( + CostRecommendationCustomRuleCreateData, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_request import ( + CostRecommendationCustomRuleCreateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import CostRecommendationCustomRuleFilter +from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter_type import ( + CostRecommendationCustomRuleFilterType, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import CostRecommendationCustomRuleSettings +from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType + +body = CostRecommendationCustomRuleCreateRequest( + data=CostRecommendationCustomRuleCreateData( + attributes=CostRecommendationCustomRuleCreateAttributes( + enabled=True, + filters=[ + CostRecommendationCustomRuleFilter( + filter_type=CostRecommendationCustomRuleFilterType.IS, + tag="env", + values=[ + "staging", + ], + ), + ], + name="Staging instances", + notes="Staging instances can run with less headroom.", + recommender_id="aws_ec2_instance_unused", + settings=CostRecommendationCustomRuleSettings( + lookback_days=14.0, + max_cpu_user_limit=0.05, + ), + ), + type=CostRecommendationCustomRuleType.CUSTOM_RULES, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["create_cost_recommendation_custom_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.create_cost_recommendation_custom_rule(body=body) + + print(response) diff --git a/examples/v2/cloud-cost-management/CreateCostRecommendationNotificationRule.py b/examples/v2/cloud-cost-management/CreateCostRecommendationNotificationRule.py new file mode 100644 index 0000000000..b89ac66c61 --- /dev/null +++ b/examples/v2/cloud-cost-management/CreateCostRecommendationNotificationRule.py @@ -0,0 +1,97 @@ +""" +Create a cost recommendation notification rule returns "Created" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi +from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_attributes import ( + CostRecommendationNotificationRuleCreateAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_data import ( + CostRecommendationNotificationRuleCreateData, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_request import ( + CostRecommendationNotificationRuleCreateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_action import ( + CostRecommendationNotificationRuleMessageAction, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_actions import ( + CostRecommendationNotificationRuleMessageActions, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_header import ( + CostRecommendationNotificationRuleMessageCustomizationHeader, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_mode import ( + CostRecommendationNotificationRuleMessageCustomizationMode, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_per_rec import ( + CostRecommendationNotificationRuleMessageCustomizationPerRec, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, +) + +body = CostRecommendationNotificationRuleCreateRequest( + data=CostRecommendationNotificationRuleCreateData( + attributes=CostRecommendationNotificationRuleCreateAttributes( + channel_id="C0456ABCD", + destination_type=CostRecommendationNotificationRuleDestinationType.SLACK, + enabled=True, + frequency=CostRecommendationNotificationRuleFrequency.WEEKLY, + interval_execution_date="2026-11-02", + interval_execution_time="09:30", + mention_targets=[ + "U01ABCDE", + ], + message_customization=CostRecommendationNotificationRuleMessageCustomization( + actions=CostRecommendationNotificationRuleMessageActions( + view_in_ccm=CostRecommendationNotificationRuleMessageAction( + bulk=True, + per_rec=True, + ), + ), + header=CostRecommendationNotificationRuleMessageCustomizationHeader( + custom_text=" recommendations to review this week.", + notification_name=True, + total_savings=True, + ), + include_tags=[ + "team", + ], + mode=CostRecommendationNotificationRuleMessageCustomizationMode.STRUCTURED, + per_rec=CostRecommendationNotificationRuleMessageCustomizationPerRec( + effort=True, + risk=True, + why=True, + ), + ), + name="Production recommendations", + scope_query="service:api AND env:prod", + timezone="America/New_York", + weekly_execution_day="monday", + weekly_execution_time="09:30", + workspace_id="T0123ABCD", + ), + type=CostRecommendationNotificationRuleType.NOTIFICATION_RULES, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["create_cost_recommendation_notification_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.create_cost_recommendation_notification_rule(body=body) + + print(response) diff --git a/examples/v2/cloud-cost-management/DeleteCostRecommendationCustomRule.py b/examples/v2/cloud-cost-management/DeleteCostRecommendationCustomRule.py new file mode 100644 index 0000000000..93d4e66e4d --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCostRecommendationCustomRule.py @@ -0,0 +1,16 @@ +""" +Delete a cost recommendation custom rule returns "No Content" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["delete_cost_recommendation_custom_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + api_instance.delete_cost_recommendation_custom_rule( + custom_rule_id="custom_rule_id", + ) diff --git a/examples/v2/cloud-cost-management/DeleteCostRecommendationNotificationRule.py b/examples/v2/cloud-cost-management/DeleteCostRecommendationNotificationRule.py new file mode 100644 index 0000000000..13a144e495 --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCostRecommendationNotificationRule.py @@ -0,0 +1,16 @@ +""" +Delete a cost recommendation notification rule returns "No Content" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["delete_cost_recommendation_notification_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + api_instance.delete_cost_recommendation_notification_rule( + notification_rule_id="notification_rule_id", + ) diff --git a/examples/v2/cloud-cost-management/GetCostRecommendationCustomRule.py b/examples/v2/cloud-cost-management/GetCostRecommendationCustomRule.py new file mode 100644 index 0000000000..2af57ba129 --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCostRecommendationCustomRule.py @@ -0,0 +1,18 @@ +""" +Get a cost recommendation custom rule returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["get_cost_recommendation_custom_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.get_cost_recommendation_custom_rule( + custom_rule_id="custom_rule_id", + ) + + print(response) diff --git a/examples/v2/cloud-cost-management/GetCostRecommendationNotificationRule.py b/examples/v2/cloud-cost-management/GetCostRecommendationNotificationRule.py new file mode 100644 index 0000000000..39cd5e7120 --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCostRecommendationNotificationRule.py @@ -0,0 +1,18 @@ +""" +Get a cost recommendation notification rule returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["get_cost_recommendation_notification_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.get_cost_recommendation_notification_rule( + notification_rule_id="notification_rule_id", + ) + + print(response) diff --git a/examples/v2/cloud-cost-management/ListCostRecommendationCustomRules.py b/examples/v2/cloud-cost-management/ListCostRecommendationCustomRules.py new file mode 100644 index 0000000000..6e0d474813 --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostRecommendationCustomRules.py @@ -0,0 +1,16 @@ +""" +List cost recommendation custom rules returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_cost_recommendation_custom_rules"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.list_cost_recommendation_custom_rules() + + print(response) diff --git a/examples/v2/cloud-cost-management/ListCostRecommendationNotificationRules.py b/examples/v2/cloud-cost-management/ListCostRecommendationNotificationRules.py new file mode 100644 index 0000000000..9ae554f68b --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCostRecommendationNotificationRules.py @@ -0,0 +1,16 @@ +""" +List cost recommendation notification rules returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_cost_recommendation_notification_rules"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.list_cost_recommendation_notification_rules() + + print(response) diff --git a/examples/v2/cloud-cost-management/UpdateCostRecommendationCustomRule.py b/examples/v2/cloud-cost-management/UpdateCostRecommendationCustomRule.py new file mode 100644 index 0000000000..2fc9864076 --- /dev/null +++ b/examples/v2/cloud-cost-management/UpdateCostRecommendationCustomRule.py @@ -0,0 +1,56 @@ +""" +Update a cost recommendation custom rule returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi +from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import CostRecommendationCustomRuleFilter +from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter_type import ( + CostRecommendationCustomRuleFilterType, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import CostRecommendationCustomRuleSettings +from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType +from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_attributes import ( + CostRecommendationCustomRuleUpdateAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_data import ( + CostRecommendationCustomRuleUpdateData, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_request import ( + CostRecommendationCustomRuleUpdateRequest, +) + +body = CostRecommendationCustomRuleUpdateRequest( + data=CostRecommendationCustomRuleUpdateData( + attributes=CostRecommendationCustomRuleUpdateAttributes( + enabled=False, + filters=[ + CostRecommendationCustomRuleFilter( + filter_type=CostRecommendationCustomRuleFilterType.IS, + tag="env", + values=[ + "staging", + ], + ), + ], + name="Staging and development instances", + notes="Staging instances can run with less headroom.", + settings=CostRecommendationCustomRuleSettings( + lookback_days=14.0, + max_cpu_user_limit=0.05, + ), + ), + id="8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b", + type=CostRecommendationCustomRuleType.CUSTOM_RULES, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["update_cost_recommendation_custom_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.update_cost_recommendation_custom_rule(custom_rule_id="custom_rule_id", body=body) + + print(response) diff --git a/examples/v2/cloud-cost-management/UpdateCostRecommendationNotificationRule.py b/examples/v2/cloud-cost-management/UpdateCostRecommendationNotificationRule.py new file mode 100644 index 0000000000..89be85772e --- /dev/null +++ b/examples/v2/cloud-cost-management/UpdateCostRecommendationNotificationRule.py @@ -0,0 +1,100 @@ +""" +Update a cost recommendation notification rule returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.cloud_cost_management_api import CloudCostManagementApi +from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_action import ( + CostRecommendationNotificationRuleMessageAction, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_actions import ( + CostRecommendationNotificationRuleMessageActions, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_header import ( + CostRecommendationNotificationRuleMessageCustomizationHeader, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_mode import ( + CostRecommendationNotificationRuleMessageCustomizationMode, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_per_rec import ( + CostRecommendationNotificationRuleMessageCustomizationPerRec, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_attributes import ( + CostRecommendationNotificationRuleUpdateAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_data import ( + CostRecommendationNotificationRuleUpdateData, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_request import ( + CostRecommendationNotificationRuleUpdateRequest, +) + +body = CostRecommendationNotificationRuleUpdateRequest( + data=CostRecommendationNotificationRuleUpdateData( + attributes=CostRecommendationNotificationRuleUpdateAttributes( + channel_id="C0456ABCD", + destination_type=CostRecommendationNotificationRuleDestinationType.SLACK, + enabled=False, + frequency=CostRecommendationNotificationRuleFrequency.WEEKLY, + interval_execution_date="2026-11-02", + interval_execution_time="09:30", + mention_targets=[ + "U01ABCDE", + ], + message_customization=CostRecommendationNotificationRuleMessageCustomization( + actions=CostRecommendationNotificationRuleMessageActions( + view_in_ccm=CostRecommendationNotificationRuleMessageAction( + bulk=True, + per_rec=True, + ), + ), + header=CostRecommendationNotificationRuleMessageCustomizationHeader( + custom_text=" recommendations to review this week.", + notification_name=True, + total_savings=True, + ), + include_tags=[ + "team", + ], + mode=CostRecommendationNotificationRuleMessageCustomizationMode.STRUCTURED, + per_rec=CostRecommendationNotificationRuleMessageCustomizationPerRec( + effort=True, + risk=True, + why=True, + ), + ), + name="Production recommendations", + scope_query="service:api AND env:prod", + timezone="America/New_York", + weekly_execution_day="monday", + weekly_execution_time="09:30", + workspace_id="T0123ABCD", + ), + id="2c59b248-6a91-4f95-972a-dc236cae9cbb", + type=CostRecommendationNotificationRuleType.NOTIFICATION_RULES, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["update_cost_recommendation_notification_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = CloudCostManagementApi(api_client) + response = api_instance.update_cost_recommendation_notification_rule( + notification_rule_id="notification_rule_id", body=body + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 0f851d3305..06fe566384 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -526,7 +526,11 @@ def __init__( "v2.validate_security_monitoring_integration_config": False, "v2.validate_security_monitoring_integration_credentials": False, "v2.get_rule_based_view": False, + "v2.create_cost_recommendation_custom_rule": False, + "v2.create_cost_recommendation_notification_rule": False, "v2.create_unit_cost": False, + "v2.delete_cost_recommendation_custom_rule": False, + "v2.delete_cost_recommendation_notification_rule": False, "v2.delete_unit_cost": False, "v2.get_commitments_commitment_list": False, "v2.get_commitments_coverage_scalar": False, @@ -537,9 +541,13 @@ def __init__( "v2.get_commitments_utilization_scalar": False, "v2.get_commitments_utilization_timeseries": False, "v2.get_cost_anomaly": False, + "v2.get_cost_recommendation_custom_rule": False, + "v2.get_cost_recommendation_notification_rule": False, "v2.get_cost_tag_metadata_currency": False, "v2.get_unit_cost": False, "v2.list_cost_anomalies": False, + "v2.list_cost_recommendation_custom_rules": False, + "v2.list_cost_recommendation_notification_rules": False, "v2.list_cost_tag_key_sources": False, "v2.list_cost_tag_metadata": False, "v2.list_cost_tag_metadata_metrics": False, @@ -547,6 +555,8 @@ def __init__( "v2.list_cost_tag_metadata_orchestrators": False, "v2.list_unit_costs": False, "v2.search_cost_recommendations": False, + "v2.update_cost_recommendation_custom_rule": False, + "v2.update_cost_recommendation_notification_rule": False, "v2.update_unit_cost": False, "v2.create_quotas": False, "v2.create_temporary_grant_request": False, diff --git a/src/datadog_api_client/v1/api/monitors_api.py b/src/datadog_api_client/v1/api/monitors_api.py index 4e94af9f88..47bbf4cded 100644 --- a/src/datadog_api_client/v1/api/monitors_api.py +++ b/src/datadog_api_client/v1/api/monitors_api.py @@ -623,22 +623,6 @@ def create_monitor( * ``operator`` ``<`` , ``<=`` , ``>`` , ``>=`` , ``==`` , or ``!=``. * ``#`` an integer or decimal number used to set the threshold. - **Data Jobs Alert Query** - - Job status example: ``formula("failed_runs(run_query)").by(group_keys).last(time_window) > #`` - - Job duration examples: ``formula("job_duration(run_query)").detection(static).by(group_keys) > duration`` - and ``formula("job_duration(run_query)").detection(anomaly).by(group_keys) > 0`` - - * ``run_query`` : The name of the single query variable in ``options.variables``. Job status monitors - use a data jobs query; job duration monitors use a data quality query with the ``duration`` measure. - * ``group_keys`` : The tags to group by, such as ``entity_id,name,workspace_name``. - * ``time_window`` : Number of minutes (#m), hours (#h), or days (#d), up to ``10d``. - * ``#`` : The number of trailing failed runs to alert above, as a non-negative integer. - * ``duration`` : The duration to alert above, such as ``2h`` , ``30m`` , or a number of seconds. - * ``options.thresholds.critical`` : Must equal the query threshold, in seconds for job duration. - Anomaly job duration monitors omit ``options.thresholds``. - :param body: Create a monitor request body. :type body: Monitor :rtype: Monitor diff --git a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_jobs_monitor_options.py b/src/datadog_api_client/v1/model/monitor_formula_and_function_data_jobs_monitor_options.py deleted file mode 100644 index 44194f5a82..0000000000 --- a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_jobs_monitor_options.py +++ /dev/null @@ -1,39 +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. -from __future__ import annotations - -from typing import Union - -from datadog_api_client.model_utils import ( - ModelNormal, - cached_property, - unset, - UnsetType, -) - - -class MonitorFormulaAndFunctionDataJobsMonitorOptions(ModelNormal): - @cached_property - def openapi_types(_): - return { - "alert_on_every_failure": (bool,), - } - - attribute_map = { - "alert_on_every_failure": "alert_on_every_failure", - } - - def __init__(self_, alert_on_every_failure: Union[bool, UnsetType] = unset, **kwargs): - """ - Monitor configuration options for data jobs queries. - - :param alert_on_every_failure: Alert separately for each failed run instead of on the count of trailing failures. - Only supported for ``failed_runs`` monitors with the ``aastra`` query dialect. It requires - a ``> 0`` threshold with no warning threshold, an evaluation window of at most two days, - and renotification disabled. - :type alert_on_every_failure: bool, optional - """ - if alert_on_every_failure is not unset: - kwargs["alert_on_every_failure"] = alert_on_every_failure - super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_jobs_query_definition.py b/src/datadog_api_client/v1/model/monitor_formula_and_function_data_jobs_query_definition.py index 8b0c95eb60..cad58de6f0 100644 --- a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_jobs_query_definition.py +++ b/src/datadog_api_client/v1/model/monitor_formula_and_function_data_jobs_query_definition.py @@ -3,88 +3,49 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, - unset, - UnsetType, ) -if TYPE_CHECKING: - from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_monitor_options import ( - MonitorFormulaAndFunctionDataJobsMonitorOptions, - ) - - class MonitorFormulaAndFunctionDataJobsQueryDefinition(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_monitor_options import ( - MonitorFormulaAndFunctionDataJobsMonitorOptions, - ) - return { "job_type": (str,), "jobs_query": (str,), - "monitor_options": (MonitorFormulaAndFunctionDataJobsMonitorOptions,), "name": (str,), "query_dialect": (str,), - "run_filter": (str,), } attribute_map = { "job_type": "job_type", "jobs_query": "jobs_query", - "monitor_options": "monitor_options", "name": "name", "query_dialect": "query_dialect", - "run_filter": "run_filter", } - def __init__( - self_, - job_type: str, - jobs_query: str, - name: str, - query_dialect: str, - monitor_options: Union[MonitorFormulaAndFunctionDataJobsMonitorOptions, UnsetType] = unset, - run_filter: Union[str, UnsetType] = unset, - **kwargs, - ): + def __init__(self_, job_type: str, jobs_query: str, name: str, query_dialect: str, **kwargs): """ A formula and functions data jobs query. :param job_type: The type of job being monitored. Valid values include: - ``databricks.job`` , ``spark.application`` , ``airflow.dag`` , ``dbt.job`` , ``glue.job`` , ``adf.pipeline``. - The ``aastra`` dialect also accepts ``airflow.job`` , ``dbt.model`` , and ``dbt.test``. + ``databricks.job`` , ``spark.application`` , ``airflow.dag`` , + ``dbt.job`` , ``dbt.model`` , ``dbt.test`` , ``glue.job``. Custom job types are supported with the ``custom.ol.`` prefix. :type job_type: str - :param jobs_query: Filter expression used to select the jobs to monitor. Its syntax depends on ``query_dialect`` : - a metric tag filter such as ``job_name:smoke*`` for ``metric`` , or an Aastra entity search - such as ``search for databricks_job where `@team:data-eng` `` for ``aastra``. + :param jobs_query: Filter expression used to select the jobs to monitor. :type jobs_query: str - :param monitor_options: Monitor configuration options for data jobs queries. - :type monitor_options: MonitorFormulaAndFunctionDataJobsMonitorOptions, optional - :param name: Name of the query for use in formulas. Must be ``run_query``. :type name: str - :param query_dialect: Query dialect for data jobs queries. Valid values are ``metric`` and ``aastra``. + :param query_dialect: Query dialect for data jobs queries. Currently only ``metric`` is supported. :type query_dialect: str - - :param run_filter: Optional filter on individual runs, using metrics filter syntax. - Only supported with the ``aastra`` query dialect. - :type run_filter: str, optional """ - if monitor_options is not unset: - kwargs["monitor_options"] = monitor_options - if run_filter is not unset: - kwargs["run_filter"] = run_filter super().__init__(kwargs) self_.job_type = job_type diff --git a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_detection_type.py b/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_detection_type.py deleted file mode 100644 index bd3bb5e5d1..0000000000 --- a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_detection_type.py +++ /dev/null @@ -1,39 +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. -from __future__ import annotations - - -from datadog_api_client.model_utils import ( - ModelSimple, - cached_property, -) - -from typing import ClassVar - - -class MonitorFormulaAndFunctionDataQualityDetectionType(ModelSimple): - """ - How a `data-jobs alert` job duration monitor detects a breach. Must match the - `.detection()` call in the monitor query. Required for job duration monitors. - - :param value: Must be one of ["static", "anomaly"]. - :type value: str - """ - - allowed_values = { - "static", - "anomaly", - } - STATIC: ClassVar["MonitorFormulaAndFunctionDataQualityDetectionType"] - ANOMALY: ClassVar["MonitorFormulaAndFunctionDataQualityDetectionType"] - - @cached_property - def openapi_types(_): - return { - "value": (str,), - } - - -MonitorFormulaAndFunctionDataQualityDetectionType.STATIC = MonitorFormulaAndFunctionDataQualityDetectionType("static") -MonitorFormulaAndFunctionDataQualityDetectionType.ANOMALY = MonitorFormulaAndFunctionDataQualityDetectionType("anomaly") diff --git a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_monitor_options.py b/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_monitor_options.py index b5a7d592c8..e457b56c12 100644 --- a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_monitor_options.py +++ b/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_monitor_options.py @@ -14,9 +14,6 @@ if TYPE_CHECKING: - from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_detection_type import ( - MonitorFormulaAndFunctionDataQualityDetectionType, - ) from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_model_configuration import ( MonitorFormulaAndFunctionDataQualityModelConfiguration, ) @@ -29,17 +26,8 @@ class MonitorFormulaAndFunctionDataQualityMonitorOptions(ModelNormal): - validations = { - "consecutive_runs": { - "inclusive_minimum": 1, - }, - } - @cached_property def openapi_types(_): - from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_detection_type import ( - MonitorFormulaAndFunctionDataQualityDetectionType, - ) from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_model_configuration import ( MonitorFormulaAndFunctionDataQualityModelConfiguration, ) @@ -51,11 +39,9 @@ def openapi_types(_): ) return { - "consecutive_runs": (int,), "crontab_override": (str,), "custom_sql": (str,), "custom_where": (str,), - "detection_type": (MonitorFormulaAndFunctionDataQualityDetectionType,), "group_by_columns": ([str],), "model_configuration": (MonitorFormulaAndFunctionDataQualityModelConfiguration,), "model_type_override": (MonitorFormulaAndFunctionDataQualityModelTypeOverride,), @@ -64,11 +50,9 @@ def openapi_types(_): } attribute_map = { - "consecutive_runs": "consecutive_runs", "crontab_override": "crontab_override", "custom_sql": "custom_sql", "custom_where": "custom_where", - "detection_type": "detection_type", "group_by_columns": "group_by_columns", "model_configuration": "model_configuration", "model_type_override": "model_type_override", @@ -78,11 +62,9 @@ def openapi_types(_): def __init__( self_, - consecutive_runs: Union[int, UnsetType] = unset, crontab_override: Union[str, UnsetType] = unset, custom_sql: Union[str, UnsetType] = unset, custom_where: Union[str, UnsetType] = unset, - detection_type: Union[MonitorFormulaAndFunctionDataQualityDetectionType, UnsetType] = unset, group_by_columns: Union[List[str], UnsetType] = unset, model_configuration: Union[MonitorFormulaAndFunctionDataQualityModelConfiguration, UnsetType] = unset, model_type_override: Union[MonitorFormulaAndFunctionDataQualityModelTypeOverride, UnsetType] = unset, @@ -93,10 +75,6 @@ def __init__( """ Monitor configuration options for data quality queries. - :param consecutive_runs: Number of consecutive runs that must breach before the monitor alerts. - Only supported by ``data-jobs alert`` job duration monitors. Defaults to ``1``. - :type consecutive_runs: int, optional - :param crontab_override: Crontab expression to override the default schedule. :type crontab_override: str, optional @@ -106,10 +84,6 @@ def __init__( :param custom_where: Custom WHERE clause for the query. :type custom_where: str, optional - :param detection_type: How a ``data-jobs alert`` job duration monitor detects a breach. Must match the - ``.detection()`` call in the monitor query. Required for job duration monitors. - :type detection_type: MonitorFormulaAndFunctionDataQualityDetectionType, optional - :param group_by_columns: Columns to group results by. :type group_by_columns: [str], optional @@ -128,16 +102,12 @@ def __init__( across two data entities and alerts on the difference between them. :type source_to_target_config: MonitorFormulaAndFunctionDataQualitySourceToTargetConfig, optional """ - if consecutive_runs is not unset: - kwargs["consecutive_runs"] = consecutive_runs if crontab_override is not unset: kwargs["crontab_override"] = crontab_override if custom_sql is not unset: kwargs["custom_sql"] = custom_sql if custom_where is not unset: kwargs["custom_where"] = custom_where - if detection_type is not unset: - kwargs["detection_type"] = detection_type if group_by_columns is not unset: kwargs["group_by_columns"] = group_by_columns if model_configuration is not unset: diff --git a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_query_definition.py b/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_query_definition.py index 7958de3ca6..ef57341eaa 100644 --- a/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_query_definition.py +++ b/src/datadog_api_client/v1/model/monitor_formula_and_function_data_quality_query_definition.py @@ -39,7 +39,6 @@ def openapi_types(_): "measure": (str,), "monitor_options": (MonitorFormulaAndFunctionDataQualityMonitorOptions,), "name": (str,), - "run_filter": (str,), "schema_version": (str,), "scope": (str,), } @@ -51,7 +50,6 @@ def openapi_types(_): "measure": "measure", "monitor_options": "monitor_options", "name": "name", - "run_filter": "run_filter", "schema_version": "schema_version", "scope": "scope", } @@ -64,7 +62,6 @@ def __init__( name: str, group_by: Union[List[str], UnsetType] = unset, monitor_options: Union[MonitorFormulaAndFunctionDataQualityMonitorOptions, UnsetType] = unset, - run_filter: Union[str, UnsetType] = unset, schema_version: Union[str, UnsetType] = unset, scope: Union[str, UnsetType] = unset, **kwargs, @@ -84,8 +81,7 @@ def __init__( :param measure: The data quality measure to query. Common values include: ``bytes`` , ``cardinality`` , ``custom`` , ``freshness`` , ``max`` , ``mean`` , ``min`` , ``nullness`` , ``percent_negative`` , ``percent_zero`` , ``row_count`` , ``stddev`` , - ``sum`` , ``uniqueness``. ``data-jobs alert`` job duration monitors use ``duration``. - Additional values may be supported. + ``sum`` , ``uniqueness``. Additional values may be supported. :type measure: str :param monitor_options: Monitor configuration options for data quality queries. @@ -94,10 +90,6 @@ def __init__( :param name: Name of the query for use in formulas. :type name: str - :param run_filter: Optional filter on individual runs, using metrics filter syntax. - Only supported by ``data-jobs alert`` job duration monitors. - :type run_filter: str, optional - :param schema_version: Schema version for the data quality query. :type schema_version: str, optional @@ -109,8 +101,6 @@ def __init__( kwargs["group_by"] = group_by if monitor_options is not unset: kwargs["monitor_options"] = monitor_options - if run_filter is not unset: - kwargs["run_filter"] = run_filter if schema_version is not unset: kwargs["schema_version"] = schema_version if scope is not unset: diff --git a/src/datadog_api_client/v1/model/monitor_formula_and_function_query_definition.py b/src/datadog_api_client/v1/model/monitor_formula_and_function_query_definition.py index 07eb35e8a3..ce4c3bbda6 100644 --- a/src/datadog_api_client/v1/model/monitor_formula_and_function_query_definition.py +++ b/src/datadog_api_client/v1/model/monitor_formula_and_function_query_definition.py @@ -45,17 +45,12 @@ def __init__(self, **kwargs): :param measure: The data quality measure to query. Common values include: `bytes`, `cardinality`, `custom`, `freshness`, `max`, `mean`, `min`, `nullness`, `percent_negative`, `percent_zero`, `row_count`, `stddev`, - `sum`, `uniqueness`. `data-jobs alert` job duration monitors use `duration`. - Additional values may be supported. + `sum`, `uniqueness`. Additional values may be supported. :type measure: str :param monitor_options: Monitor configuration options for data quality queries. :type monitor_options: MonitorFormulaAndFunctionDataQualityMonitorOptions, optional - :param run_filter: Optional filter on individual runs, using metrics filter syntax. - Only supported by `data-jobs alert` job duration monitors. - :type run_filter: str, optional - :param schema_version: Schema version for the data quality query. :type schema_version: str, optional @@ -64,17 +59,15 @@ def __init__(self, **kwargs): :type scope: str, optional :param job_type: The type of job being monitored. Valid values include: - `databricks.job`, `spark.application`, `airflow.dag`, `dbt.job`, `glue.job`, `adf.pipeline`. - The `aastra` dialect also accepts `airflow.job`, `dbt.model`, and `dbt.test`. + `databricks.job`, `spark.application`, `airflow.dag`, + `dbt.job`, `dbt.model`, `dbt.test`, `glue.job`. Custom job types are supported with the `custom.ol.` prefix. :type job_type: str - :param jobs_query: Filter expression used to select the jobs to monitor. Its syntax depends on `query_dialect`: - a metric tag filter such as `job_name:smoke*` for `metric`, or an Aastra entity search - such as ``search for databricks_job where `@team:data-eng` `` for `aastra`. + :param jobs_query: Filter expression used to select the jobs to monitor. :type jobs_query: str - :param query_dialect: Query dialect for data jobs queries. Valid values are `metric` and `aastra`. + :param query_dialect: Query dialect for data jobs queries. Currently only `metric` is supported. :type query_dialect: str :param augment_query: Augment query for aggregate augmented queries. Can be an events query or a reference table query. diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 85954dfc40..135ebf6b1f 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -558,18 +558,12 @@ from datadog_api_client.v1.model.monitor_formula_and_function_cost_query_definition import ( MonitorFormulaAndFunctionCostQueryDefinition, ) -from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_monitor_options import ( - MonitorFormulaAndFunctionDataJobsMonitorOptions, -) from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_query_definition import ( MonitorFormulaAndFunctionDataJobsQueryDefinition, ) from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_data_source import ( MonitorFormulaAndFunctionDataQualityDataSource, ) -from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_detection_type import ( - MonitorFormulaAndFunctionDataQualityDetectionType, -) from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_diff_function import ( MonitorFormulaAndFunctionDataQualityDiffFunction, ) @@ -2023,10 +2017,8 @@ "MonitorFormulaAndFunctionCostAggregator", "MonitorFormulaAndFunctionCostDataSource", "MonitorFormulaAndFunctionCostQueryDefinition", - "MonitorFormulaAndFunctionDataJobsMonitorOptions", "MonitorFormulaAndFunctionDataJobsQueryDefinition", "MonitorFormulaAndFunctionDataQualityDataSource", - "MonitorFormulaAndFunctionDataQualityDetectionType", "MonitorFormulaAndFunctionDataQualityDiffFunction", "MonitorFormulaAndFunctionDataQualityDiffType", "MonitorFormulaAndFunctionDataQualityEntityMetricConfig", diff --git a/src/datadog_api_client/v2/api/cloud_cost_management_api.py b/src/datadog_api_client/v2/api/cloud_cost_management_api.py index a1f510b64b..9ce62b60ce 100644 --- a/src/datadog_api_client/v2/api/cloud_cost_management_api.py +++ b/src/datadog_api_client/v2/api/cloud_cost_management_api.py @@ -66,6 +66,26 @@ from datadog_api_client.v2.model.oci_configs_response import OCIConfigsResponse from datadog_api_client.v2.model.cost_recommendation_array import CostRecommendationArray from datadog_api_client.v2.model.recommendations_filter_request import RecommendationsFilterRequest +from datadog_api_client.v2.model.cost_recommendation_custom_rules_response import CostRecommendationCustomRulesResponse +from datadog_api_client.v2.model.cost_recommendation_custom_rule_response import CostRecommendationCustomRuleResponse +from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_request import ( + CostRecommendationCustomRuleCreateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_request import ( + CostRecommendationCustomRuleUpdateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rules_response import ( + CostRecommendationNotificationRulesResponse, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_response import ( + CostRecommendationNotificationRuleResponse, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_request import ( + CostRecommendationNotificationRuleCreateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_request import ( + CostRecommendationNotificationRuleUpdateRequest, +) from datadog_api_client.v2.model.cost_tag_descriptions_response import CostTagDescriptionsResponse from datadog_api_client.v2.model.cost_tag_description_response import CostTagDescriptionResponse from datadog_api_client.v2.model.cost_tag_description_upsert_request import CostTagDescriptionUpsertRequest @@ -164,6 +184,46 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_cost_recommendation_custom_rule_endpoint = _Endpoint( + settings={ + "response_type": (CostRecommendationCustomRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/custom_rules", + "operation_id": "create_cost_recommendation_custom_rule", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (CostRecommendationCustomRuleCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._create_cost_recommendation_notification_rule_endpoint = _Endpoint( + settings={ + "response_type": (CostRecommendationNotificationRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/notification_rules", + "operation_id": "create_cost_recommendation_notification_rule", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (CostRecommendationNotificationRuleCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_custom_allocation_rule_endpoint = _Endpoint( settings={ "response_type": (ArbitraryRuleResponse,), @@ -316,6 +376,52 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_cost_recommendation_custom_rule_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/custom_rules/{custom_rule_id}", + "operation_id": "delete_cost_recommendation_custom_rule", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "custom_rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "custom_rule_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._delete_cost_recommendation_notification_rule_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/notification_rules/{notification_rule_id}", + "operation_id": "delete_cost_recommendation_notification_rule", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "notification_rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "notification_rule_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._delete_cost_tag_description_by_key_endpoint = _Endpoint( settings={ "response_type": None, @@ -1023,6 +1129,52 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_cost_recommendation_custom_rule_endpoint = _Endpoint( + settings={ + "response_type": (CostRecommendationCustomRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/custom_rules/{custom_rule_id}", + "operation_id": "get_cost_recommendation_custom_rule", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "custom_rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "custom_rule_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_cost_recommendation_notification_rule_endpoint = _Endpoint( + settings={ + "response_type": (CostRecommendationNotificationRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/notification_rules/{notification_rule_id}", + "operation_id": "get_cost_recommendation_notification_rule", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "notification_rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "notification_rule_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_cost_tag_description_by_key_endpoint = _Endpoint( settings={ "response_type": (CostTagDescriptionResponse,), @@ -1406,6 +1558,38 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_cost_recommendation_custom_rules_endpoint = _Endpoint( + settings={ + "response_type": (CostRecommendationCustomRulesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/custom_rules", + "operation_id": "list_cost_recommendation_custom_rules", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_cost_recommendation_notification_rules_endpoint = _Endpoint( + settings={ + "response_type": (CostRecommendationNotificationRulesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/notification_rules", + "operation_id": "list_cost_recommendation_notification_rules", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_cost_tag_descriptions_endpoint = _Endpoint( settings={ "response_type": (CostTagDescriptionsResponse,), @@ -1964,6 +2148,58 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_cost_recommendation_custom_rule_endpoint = _Endpoint( + settings={ + "response_type": (CostRecommendationCustomRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/custom_rules/{custom_rule_id}", + "operation_id": "update_cost_recommendation_custom_rule", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "custom_rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "custom_rule_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CostRecommendationCustomRuleUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._update_cost_recommendation_notification_rule_endpoint = _Endpoint( + settings={ + "response_type": (CostRecommendationNotificationRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/cost/recommendations/notification_rules/{notification_rule_id}", + "operation_id": "update_cost_recommendation_notification_rule", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "notification_rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "notification_rule_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CostRecommendationNotificationRuleUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_custom_allocation_rule_endpoint = _Endpoint( settings={ "response_type": (ArbitraryRuleResponse,), @@ -2264,6 +2500,38 @@ def create_cost_gcp_usage_cost_config( return self._create_cost_gcp_usage_cost_config_endpoint.call_with_http_info(**kwargs) + def create_cost_recommendation_custom_rule( + self, + body: CostRecommendationCustomRuleCreateRequest, + ) -> CostRecommendationCustomRuleResponse: + """Create a cost recommendation custom rule. + + Create a custom recommendation rule. The rule overrides the settings it lists for the resources its tag filters match; every other setting keeps the recommender default. Only the settings in the request are stored. + + :type body: CostRecommendationCustomRuleCreateRequest + :rtype: CostRecommendationCustomRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_cost_recommendation_custom_rule_endpoint.call_with_http_info(**kwargs) + + def create_cost_recommendation_notification_rule( + self, + body: CostRecommendationNotificationRuleCreateRequest, + ) -> CostRecommendationNotificationRuleResponse: + """Create a cost recommendation notification rule. + + Create a rule that sends a digest of the cost recommendations matching ``scope_query`` to Slack or Microsoft Teams on a schedule. + + :type body: CostRecommendationNotificationRuleCreateRequest + :rtype: CostRecommendationNotificationRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_cost_recommendation_notification_rule_endpoint.call_with_http_info(**kwargs) + def create_custom_allocation_rule( self, body: ArbitraryCostUpsertRequest, @@ -2394,6 +2662,40 @@ def delete_cost_gcp_usage_cost_config( return self._delete_cost_gcp_usage_cost_config_endpoint.call_with_http_info(**kwargs) + def delete_cost_recommendation_custom_rule( + self, + custom_rule_id: str, + ) -> None: + """Delete a cost recommendation custom rule. + + Delete a custom recommendation rule. + + :param custom_rule_id: The ID of the custom rule. + :type custom_rule_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["custom_rule_id"] = custom_rule_id + + return self._delete_cost_recommendation_custom_rule_endpoint.call_with_http_info(**kwargs) + + def delete_cost_recommendation_notification_rule( + self, + notification_rule_id: str, + ) -> None: + """Delete a cost recommendation notification rule. + + Delete a recommendation notification rule. + + :param notification_rule_id: The ID of the notification rule. + :type notification_rule_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["notification_rule_id"] = notification_rule_id + + return self._delete_cost_recommendation_notification_rule_endpoint.call_with_http_info(**kwargs) + def delete_cost_tag_description_by_key( self, tag_key: str, @@ -2977,6 +3279,40 @@ def get_cost_gcp_usage_cost_config( return self._get_cost_gcp_usage_cost_config_endpoint.call_with_http_info(**kwargs) + def get_cost_recommendation_custom_rule( + self, + custom_rule_id: str, + ) -> CostRecommendationCustomRuleResponse: + """Get a cost recommendation custom rule. + + Get a custom recommendation rule. + + :param custom_rule_id: The ID of the custom rule. + :type custom_rule_id: str + :rtype: CostRecommendationCustomRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["custom_rule_id"] = custom_rule_id + + return self._get_cost_recommendation_custom_rule_endpoint.call_with_http_info(**kwargs) + + def get_cost_recommendation_notification_rule( + self, + notification_rule_id: str, + ) -> CostRecommendationNotificationRuleResponse: + """Get a cost recommendation notification rule. + + Get a recommendation notification rule. + + :param notification_rule_id: The ID of the notification rule. + :type notification_rule_id: str + :rtype: CostRecommendationNotificationRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["notification_rule_id"] = notification_rule_id + + return self._get_cost_recommendation_notification_rule_endpoint.call_with_http_info(**kwargs) + def get_cost_tag_description_by_key( self, tag_key: str, @@ -3310,6 +3646,30 @@ def list_cost_oci_configs( warnings.warn("list_cost_oci_configs is deprecated", DeprecationWarning, stacklevel=2) return self._list_cost_oci_configs_endpoint.call_with_http_info(**kwargs) + def list_cost_recommendation_custom_rules( + self, + ) -> CostRecommendationCustomRulesResponse: + """List cost recommendation custom rules. + + List the custom recommendation rules of the organization. A custom rule overrides recommender settings for the resources its tag filters match. + + :rtype: CostRecommendationCustomRulesResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_cost_recommendation_custom_rules_endpoint.call_with_http_info(**kwargs) + + def list_cost_recommendation_notification_rules( + self, + ) -> CostRecommendationNotificationRulesResponse: + """List cost recommendation notification rules. + + List the recommendation notification rules of the organization. A notification rule sends a digest of the cost recommendations that match its query to Slack or Microsoft Teams on a schedule. + + :rtype: CostRecommendationNotificationRulesResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_cost_recommendation_notification_rules_endpoint.call_with_http_info(**kwargs) + def list_cost_tag_descriptions( self, *, @@ -3798,6 +4158,48 @@ def update_cost_gcp_usage_cost_config( return self._update_cost_gcp_usage_cost_config_endpoint.call_with_http_info(**kwargs) + def update_cost_recommendation_custom_rule( + self, + custom_rule_id: str, + body: CostRecommendationCustomRuleUpdateRequest, + ) -> CostRecommendationCustomRuleResponse: + """Update a cost recommendation custom rule. + + Update a custom recommendation rule. Attributes left out keep their value; ``filters`` and ``settings`` replace the stored list and map when sent. The recommender of a rule cannot change. + + :param custom_rule_id: The ID of the custom rule. + :type custom_rule_id: str + :type body: CostRecommendationCustomRuleUpdateRequest + :rtype: CostRecommendationCustomRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["custom_rule_id"] = custom_rule_id + + kwargs["body"] = body + + return self._update_cost_recommendation_custom_rule_endpoint.call_with_http_info(**kwargs) + + def update_cost_recommendation_notification_rule( + self, + notification_rule_id: str, + body: CostRecommendationNotificationRuleUpdateRequest, + ) -> CostRecommendationNotificationRuleResponse: + """Update a cost recommendation notification rule. + + Update a recommendation notification rule. Attributes left out keep their value. + + :param notification_rule_id: The ID of the notification rule. + :type notification_rule_id: str + :type body: CostRecommendationNotificationRuleUpdateRequest + :rtype: CostRecommendationNotificationRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["notification_rule_id"] = notification_rule_id + + kwargs["body"] = body + + return self._update_cost_recommendation_notification_rule_endpoint.call_with_http_info(**kwargs) + def update_custom_allocation_rule( self, rule_id: int, diff --git a/src/datadog_api_client/v2/model/ai_gateway_nullable_routing_rule_tier_ordering.py b/src/datadog_api_client/v2/model/ai_gateway_nullable_routing_rule_tier_ordering.py index c43b289658..247d5dae46 100644 --- a/src/datadog_api_client/v2/model/ai_gateway_nullable_routing_rule_tier_ordering.py +++ b/src/datadog_api_client/v2/model/ai_gateway_nullable_routing_rule_tier_ordering.py @@ -14,7 +14,7 @@ class AiGatewayNullableRoutingRuleTierOrdering(ModelSimple): """ - How a tier orders its targets. Omission preserves the saved same-position tier on update; null resets to configured. New tiers default to configured. The weighted_affinity ordering distributes first-choice assignments by relative target weights and accepts only model targets with an explicit provider, without repeated provider and model pairs in the same tier. The `classified` ordering is allowed only in the first tier and requires a classifier, destination rubrics, and one default destination. + How a tier orders its targets. Omission preserves the saved same-position tier on update; null resets to configured. New tiers default to configured. The weighted_affinity ordering distributes first-choice assignments by relative target weights and accepts only model targets with an explicit provider, without repeated provider and model pairs in the same tier. The `classified` ordering is allowed only in the first tier and requires a classifier, destination rubrics, and one default destination. Its targets are model targets that each name one provider, not "*". Besides the default, it needs 1 to 9 destinations, each with a different rubric. Classified routing is in Preview: saving a classified tier returns 403 Forbidden unless the feature is enabled for the organization. :param value: Must be one of ["configured", "weighted_affinity", "classified"]. :type value: str diff --git a/src/datadog_api_client/v2/model/ai_gateway_routing_classifier_request.py b/src/datadog_api_client/v2/model/ai_gateway_routing_classifier_request.py index d8b34f0b01..0d921231a1 100644 --- a/src/datadog_api_client/v2/model/ai_gateway_routing_classifier_request.py +++ b/src/datadog_api_client/v2/model/ai_gateway_routing_classifier_request.py @@ -62,7 +62,7 @@ def __init__( :param model: Decision model on the provider. Omit together with provider to preserve the saved selection. :type model: str, optional - :param provider: Decision-model provider slug. Omit together with model to preserve the saved selection. + :param provider: Decision-model provider slug. It must name a provider of type ``openai`` , ``baseten`` , or ``typesafe`` , the provider types that serve a decision model. Omit together with model to preserve the saved selection. :type provider: str, optional """ if confidence_threshold is not unset: diff --git a/src/datadog_api_client/v2/model/ai_gateway_routing_rule_target_request.py b/src/datadog_api_client/v2/model/ai_gateway_routing_rule_target_request.py index 1e2cab70d7..b230f9a7a6 100644 --- a/src/datadog_api_client/v2/model/ai_gateway_routing_rule_target_request.py +++ b/src/datadog_api_client/v2/model/ai_gateway_routing_rule_target_request.py @@ -96,13 +96,13 @@ def __init__( :param model_id: Opaque model catalog ID for a concrete model target. New selections require provider View; saved selections can be retained without metadata. :type model_id: int, optional - :param provider: Provider slug. weighted_affinity requires an explicit provider and does not allow "*". + :param provider: Provider slug. weighted_affinity and classified tiers require an explicit provider and do not allow "*". :type provider: str, optional :param reasoning_level: Optional reasoning effort preference for this model destination. Must be supported by the selected model and provider. For provider "*", every eligible provider must support the level. An explicit value overrides the request's reasoning setting, subject to model-group policy. Omitted or null preserves request and provider behavior; none is an explicit level, not the default. On update, omission preserves a saved target override; null explicitly clears it. Routing-rule references cannot set this field; each referenced model destination owns its override. If an override cannot be applied at runtime, the gateway keeps the destination and restores the caller's original reasoning settings, or preserves the provider default when omitted. It rechecks all applicable route and model-group policies against those settings before sending. Model-group max_reasoning_level enforces hard limits; the override is not an additional cap. Normal fallback applies if governance denies the resulting request or the destination cannot otherwise serve it. Metrics and span tags record the override outcome and incompatibility reason. When response headers have not already been committed, ``X-Ai-Gateway-Reasoning-Override`` reports applied or not_applied for the returned attempt, and ``X-Ai-Gateway-Reasoning-Override-Reason`` reports the reason when not applied. :type reasoning_level: AiGatewayRoutingReasoningLevel, none_type, optional - :param rubric: Destination rubric in a classified tier. Omission preserves a saved value; null clears it. Must be absent on the default destination. + :param rubric: Destination rubric in a classified tier: when the decision model picks this destination. Up to 300 characters after leading and trailing spaces are trimmed, and different for each destination in the tier. Omission preserves a saved value; null clears it. Must be absent on the default destination. :type rubric: str, none_type, optional :param slug: Organization-unique routing rule slug. New references require route View. Omit to retain a saved target by its parent-local ID. Allowed only in configured tiers. diff --git a/src/datadog_api_client/v2/model/ai_gateway_routing_rule_tier_request.py b/src/datadog_api_client/v2/model/ai_gateway_routing_rule_tier_request.py index d5362c86e9..c490489e8d 100644 --- a/src/datadog_api_client/v2/model/ai_gateway_routing_rule_tier_request.py +++ b/src/datadog_api_client/v2/model/ai_gateway_routing_rule_tier_request.py @@ -62,7 +62,7 @@ def __init__( :param classifier: Decision model and settings for a classified tier. Omission preserves the saved classifier; null clears it. Newly selected models require provider View. :type classifier: AiGatewayRoutingClassifierRequest, none_type, optional - :param ordering: How a tier orders its targets. Omission preserves the saved same-position tier on update; null resets to configured. New tiers default to configured. The weighted_affinity ordering distributes first-choice assignments by relative target weights and accepts only model targets with an explicit provider, without repeated provider and model pairs in the same tier. The ``classified`` ordering is allowed only in the first tier and requires a classifier, destination rubrics, and one default destination. + :param ordering: How a tier orders its targets. Omission preserves the saved same-position tier on update; null resets to configured. New tiers default to configured. The weighted_affinity ordering distributes first-choice assignments by relative target weights and accepts only model targets with an explicit provider, without repeated provider and model pairs in the same tier. The ``classified`` ordering is allowed only in the first tier and requires a classifier, destination rubrics, and one default destination. Its targets are model targets that each name one provider, not "*". Besides the default, it needs 1 to 9 destinations, each with a different rubric. Classified routing is in Preview: saving a classified tier returns 403 Forbidden unless the feature is enabled for the organization. :type ordering: AiGatewayNullableRoutingRuleTierOrdering, none_type, optional :param targets: diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_attributes.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_attributes.py new file mode 100644 index 0000000000..c7bd3a8a99 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_attributes.py @@ -0,0 +1,131 @@ +# 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. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import CostRecommendationCustomRuleFilter + from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import ( + CostRecommendationCustomRuleSettings, + ) + + +class CostRecommendationCustomRuleAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import ( + CostRecommendationCustomRuleFilter, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import ( + CostRecommendationCustomRuleSettings, + ) + + return { + "cloud_provider": (str,), + "created_at": (datetime,), + "created_by": (str,), + "enabled": (bool,), + "filters": ([CostRecommendationCustomRuleFilter],), + "modified_at": (datetime,), + "modified_by": (str,), + "name": (str,), + "notes": (str,), + "priority": (int,), + "recommender_id": (str,), + "settings": (CostRecommendationCustomRuleSettings,), + } + + attribute_map = { + "cloud_provider": "cloud_provider", + "created_at": "created_at", + "created_by": "created_by", + "enabled": "enabled", + "filters": "filters", + "modified_at": "modified_at", + "modified_by": "modified_by", + "name": "name", + "notes": "notes", + "priority": "priority", + "recommender_id": "recommender_id", + "settings": "settings", + } + + def __init__( + self_, + cloud_provider: str, + created_at: datetime, + created_by: str, + enabled: bool, + filters: List[CostRecommendationCustomRuleFilter], + modified_at: datetime, + modified_by: str, + name: str, + notes: str, + priority: int, + recommender_id: str, + settings: CostRecommendationCustomRuleSettings, + **kwargs, + ): + """ + Attributes of a custom recommendation rule. + + :param cloud_provider: The cloud provider of the recommender, such as ``aws`` , ``azure`` , or ``gcp``. + :type cloud_provider: str + + :param created_at: When the rule was created. + :type created_at: datetime + + :param created_by: The UUID of the user who created the rule. + :type created_by: str + + :param enabled: Whether the rule is applied when recommendations are generated. + :type enabled: bool + + :param filters: Tag filters that select the resources the rule applies to. An empty list selects every resource. + :type filters: [CostRecommendationCustomRuleFilter] + + :param modified_at: When the rule was last modified. + :type modified_at: datetime + + :param modified_by: The UUID of the user who last modified the rule. + :type modified_by: str + + :param name: The name of the rule. + :type name: str + + :param notes: Free-form notes, such as the reason for the customization. + :type notes: str + + :param priority: The order in which the rules of a recommender are evaluated, lowest first. It is assigned when the rule is created. + :type priority: int + + :param recommender_id: The recommender the rule customizes. + :type recommender_id: str + + :param settings: Setting overrides, keyed by setting name. Settings left out keep the recommender default. The accepted + settings and their ranges depend on the recommender. + :type settings: CostRecommendationCustomRuleSettings + """ + super().__init__(kwargs) + + self_.cloud_provider = cloud_provider + self_.created_at = created_at + self_.created_by = created_by + self_.enabled = enabled + self_.filters = filters + self_.modified_at = modified_at + self_.modified_by = modified_by + self_.name = name + self_.notes = notes + self_.priority = priority + self_.recommender_id = recommender_id + self_.settings = settings diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_attributes.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_attributes.py new file mode 100644 index 0000000000..c18ae84cdd --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_attributes.py @@ -0,0 +1,100 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import CostRecommendationCustomRuleFilter + from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import ( + CostRecommendationCustomRuleSettings, + ) + + +class CostRecommendationCustomRuleCreateAttributes(ModelNormal): + validations = { + "name": { + "min_length": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import ( + CostRecommendationCustomRuleFilter, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import ( + CostRecommendationCustomRuleSettings, + ) + + return { + "enabled": (bool,), + "filters": ([CostRecommendationCustomRuleFilter],), + "name": (str,), + "notes": (str,), + "recommender_id": (str,), + "settings": (CostRecommendationCustomRuleSettings,), + } + + attribute_map = { + "enabled": "enabled", + "filters": "filters", + "name": "name", + "notes": "notes", + "recommender_id": "recommender_id", + "settings": "settings", + } + + def __init__( + self_, + name: str, + recommender_id: str, + enabled: Union[bool, UnsetType] = unset, + filters: Union[List[CostRecommendationCustomRuleFilter], UnsetType] = unset, + notes: Union[str, UnsetType] = unset, + settings: Union[CostRecommendationCustomRuleSettings, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a new custom recommendation rule. + + :param enabled: Whether the rule is applied when recommendations are generated. Defaults to ``true``. + :type enabled: bool, optional + + :param filters: Tag filters that select the resources the rule applies to. An empty list selects every resource. + :type filters: [CostRecommendationCustomRuleFilter], optional + + :param name: The name of the rule. + :type name: str + + :param notes: Free-form notes, such as the reason for the customization. + :type notes: str, optional + + :param recommender_id: The recommender to customize. It must be a recommender that supports custom rules. + :type recommender_id: str + + :param settings: Setting overrides, keyed by setting name. Settings left out keep the recommender default. The accepted + settings and their ranges depend on the recommender. + :type settings: CostRecommendationCustomRuleSettings, optional + """ + if enabled is not unset: + kwargs["enabled"] = enabled + if filters is not unset: + kwargs["filters"] = filters + if notes is not unset: + kwargs["notes"] = notes + if settings is not unset: + kwargs["settings"] = settings + super().__init__(kwargs) + + self_.name = name + self_.recommender_id = recommender_id diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_data.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_data.py new file mode 100644 index 0000000000..4852c7265d --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_data.py @@ -0,0 +1,57 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_attributes import ( + CostRecommendationCustomRuleCreateAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType + + +class CostRecommendationCustomRuleCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_attributes import ( + CostRecommendationCustomRuleCreateAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType + + return { + "attributes": (CostRecommendationCustomRuleCreateAttributes,), + "type": (CostRecommendationCustomRuleType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + attributes: CostRecommendationCustomRuleCreateAttributes, + type: CostRecommendationCustomRuleType, + **kwargs, + ): + """ + A new custom recommendation rule. + + :param attributes: Attributes of a new custom recommendation rule. + :type attributes: CostRecommendationCustomRuleCreateAttributes + + :param type: Custom recommendation rule resource type. + :type type: CostRecommendationCustomRuleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_request.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_request.py new file mode 100644 index 0000000000..0b799b1bdf --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_create_request.py @@ -0,0 +1,44 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_data import ( + CostRecommendationCustomRuleCreateData, + ) + + +class CostRecommendationCustomRuleCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_data import ( + CostRecommendationCustomRuleCreateData, + ) + + return { + "data": (CostRecommendationCustomRuleCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CostRecommendationCustomRuleCreateData, **kwargs): + """ + Request to create a custom recommendation rule. + + :param data: A new custom recommendation rule. + :type data: CostRecommendationCustomRuleCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_data.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_data.py new file mode 100644 index 0000000000..6da5195bde --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_data.py @@ -0,0 +1,64 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_attributes import ( + CostRecommendationCustomRuleAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType + + +class CostRecommendationCustomRuleData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_attributes import ( + CostRecommendationCustomRuleAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType + + return { + "attributes": (CostRecommendationCustomRuleAttributes,), + "id": (str,), + "type": (CostRecommendationCustomRuleType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: CostRecommendationCustomRuleAttributes, + id: str, + type: CostRecommendationCustomRuleType, + **kwargs, + ): + """ + A custom recommendation rule. + + :param attributes: Attributes of a custom recommendation rule. + :type attributes: CostRecommendationCustomRuleAttributes + + :param id: The ID of the custom rule. + :type id: str + + :param type: Custom recommendation rule resource type. + :type type: CostRecommendationCustomRuleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_filter.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_filter.py new file mode 100644 index 0000000000..473dadf576 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_filter.py @@ -0,0 +1,67 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter_type import ( + CostRecommendationCustomRuleFilterType, + ) + + +class CostRecommendationCustomRuleFilter(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter_type import ( + CostRecommendationCustomRuleFilterType, + ) + + return { + "filter_type": (CostRecommendationCustomRuleFilterType,), + "tag": (str,), + "values": ([str],), + } + + attribute_map = { + "filter_type": "filter_type", + "tag": "tag", + "values": "values", + } + + def __init__( + self_, + filter_type: CostRecommendationCustomRuleFilterType, + tag: str, + values: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + A tag filter. A rule applies to a resource only when every filter of the rule matches. + + :param filter_type: How the filter compares the tag. ``is`` , ``is_not`` , ``contains`` , ``does_not_contain`` , ``like`` (glob), and ``not_like`` + compare the tag values with ``values``. ``all`` matches resources that have the tag and ``untagged`` matches resources + that do not, so both ignore ``values``. + :type filter_type: CostRecommendationCustomRuleFilterType + + :param tag: The tag key the filter compares. + :type tag: str + + :param values: Tag values the filter compares. Required unless ``filter_type`` is ``all`` or ``untagged``. + :type values: [str], optional + """ + if values is not unset: + kwargs["values"] = values + super().__init__(kwargs) + + self_.filter_type = filter_type + self_.tag = tag diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_filter_type.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_filter_type.py new file mode 100644 index 0000000000..5b58cf48c9 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_filter_type.py @@ -0,0 +1,58 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CostRecommendationCustomRuleFilterType(ModelSimple): + """ + How the filter compares the tag. `is`, `is_not`, `contains`, `does_not_contain`, `like` (glob), and `not_like` + compare the tag values with `values`. `all` matches resources that have the tag and `untagged` matches resources + that do not, so both ignore `values`. + + :param value: Must be one of ["is", "is_not", "contains", "does_not_contain", "like", "not_like", "all", "untagged"]. + :type value: str + """ + + allowed_values = { + "is", + "is_not", + "contains", + "does_not_contain", + "like", + "not_like", + "all", + "untagged", + } + IS: ClassVar["CostRecommendationCustomRuleFilterType"] + IS_NOT: ClassVar["CostRecommendationCustomRuleFilterType"] + CONTAINS: ClassVar["CostRecommendationCustomRuleFilterType"] + DOES_NOT_CONTAIN: ClassVar["CostRecommendationCustomRuleFilterType"] + LIKE: ClassVar["CostRecommendationCustomRuleFilterType"] + NOT_LIKE: ClassVar["CostRecommendationCustomRuleFilterType"] + ALL: ClassVar["CostRecommendationCustomRuleFilterType"] + UNTAGGED: ClassVar["CostRecommendationCustomRuleFilterType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostRecommendationCustomRuleFilterType.IS = CostRecommendationCustomRuleFilterType("is") +CostRecommendationCustomRuleFilterType.IS_NOT = CostRecommendationCustomRuleFilterType("is_not") +CostRecommendationCustomRuleFilterType.CONTAINS = CostRecommendationCustomRuleFilterType("contains") +CostRecommendationCustomRuleFilterType.DOES_NOT_CONTAIN = CostRecommendationCustomRuleFilterType("does_not_contain") +CostRecommendationCustomRuleFilterType.LIKE = CostRecommendationCustomRuleFilterType("like") +CostRecommendationCustomRuleFilterType.NOT_LIKE = CostRecommendationCustomRuleFilterType("not_like") +CostRecommendationCustomRuleFilterType.ALL = CostRecommendationCustomRuleFilterType("all") +CostRecommendationCustomRuleFilterType.UNTAGGED = CostRecommendationCustomRuleFilterType("untagged") diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_response.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_response.py new file mode 100644 index 0000000000..9294c1ad02 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_response.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_data import CostRecommendationCustomRuleData + + +class CostRecommendationCustomRuleResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_data import CostRecommendationCustomRuleData + + return { + "data": (CostRecommendationCustomRuleData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CostRecommendationCustomRuleData, **kwargs): + """ + A custom recommendation rule. + + :param data: A custom recommendation rule. + :type data: CostRecommendationCustomRuleData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_settings.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_settings.py new file mode 100644 index 0000000000..64a42b6704 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_settings.py @@ -0,0 +1,23 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class CostRecommendationCustomRuleSettings(ModelNormal): + @cached_property + def additional_properties_type(_): + return (float,) + + def __init__(self_, **kwargs): + """ + Setting overrides, keyed by setting name. Settings left out keep the recommender default. The accepted + settings and their ranges depend on the recommender. + """ + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_type.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_type.py new file mode 100644 index 0000000000..d9a8eaef5c --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_type.py @@ -0,0 +1,35 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CostRecommendationCustomRuleType(ModelSimple): + """ + Custom recommendation rule resource type. + + :param value: If omitted defaults to "custom_rules". Must be one of ["custom_rules"]. + :type value: str + """ + + allowed_values = { + "custom_rules", + } + CUSTOM_RULES: ClassVar["CostRecommendationCustomRuleType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostRecommendationCustomRuleType.CUSTOM_RULES = CostRecommendationCustomRuleType("custom_rules") diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_attributes.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_attributes.py new file mode 100644 index 0000000000..9c2319a5c9 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_attributes.py @@ -0,0 +1,94 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import CostRecommendationCustomRuleFilter + from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import ( + CostRecommendationCustomRuleSettings, + ) + + +class CostRecommendationCustomRuleUpdateAttributes(ModelNormal): + validations = { + "name": { + "min_length": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import ( + CostRecommendationCustomRuleFilter, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import ( + CostRecommendationCustomRuleSettings, + ) + + return { + "enabled": (bool,), + "filters": ([CostRecommendationCustomRuleFilter],), + "name": (str,), + "notes": (str,), + "settings": (CostRecommendationCustomRuleSettings,), + } + + attribute_map = { + "enabled": "enabled", + "filters": "filters", + "name": "name", + "notes": "notes", + "settings": "settings", + } + + def __init__( + self_, + enabled: Union[bool, UnsetType] = unset, + filters: Union[List[CostRecommendationCustomRuleFilter], UnsetType] = unset, + name: Union[str, UnsetType] = unset, + notes: Union[str, UnsetType] = unset, + settings: Union[CostRecommendationCustomRuleSettings, UnsetType] = unset, + **kwargs, + ): + """ + Attributes to change. Attributes left out keep their value. ``filters`` and ``settings`` replace the stored list + and map when sent. + + :param enabled: Whether the rule is applied when recommendations are generated. + :type enabled: bool, optional + + :param filters: Tag filters that select the resources the rule applies to. An empty list selects every resource. + :type filters: [CostRecommendationCustomRuleFilter], optional + + :param name: The name of the rule. + :type name: str, optional + + :param notes: Free-form notes, such as the reason for the customization. + :type notes: str, optional + + :param settings: Setting overrides, keyed by setting name. Settings left out keep the recommender default. The accepted + settings and their ranges depend on the recommender. + :type settings: CostRecommendationCustomRuleSettings, optional + """ + if enabled is not unset: + kwargs["enabled"] = enabled + if filters is not unset: + kwargs["filters"] = filters + if name is not unset: + kwargs["name"] = name + if notes is not unset: + kwargs["notes"] = notes + if settings is not unset: + kwargs["settings"] = settings + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_data.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_data.py new file mode 100644 index 0000000000..b92bbfdf35 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_data.py @@ -0,0 +1,65 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_attributes import ( + CostRecommendationCustomRuleUpdateAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType + + +class CostRecommendationCustomRuleUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_attributes import ( + CostRecommendationCustomRuleUpdateAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType + + return { + "attributes": (CostRecommendationCustomRuleUpdateAttributes,), + "id": (str,), + "type": (CostRecommendationCustomRuleType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: CostRecommendationCustomRuleUpdateAttributes, + id: str, + type: CostRecommendationCustomRuleType, + **kwargs, + ): + """ + Changes to a custom recommendation rule. + + :param attributes: Attributes to change. Attributes left out keep their value. ``filters`` and ``settings`` replace the stored list + and map when sent. + :type attributes: CostRecommendationCustomRuleUpdateAttributes + + :param id: The ID of the custom rule. It must match the ID in the path. + :type id: str + + :param type: Custom recommendation rule resource type. + :type type: CostRecommendationCustomRuleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_request.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_request.py new file mode 100644 index 0000000000..761ea3c441 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rule_update_request.py @@ -0,0 +1,44 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_data import ( + CostRecommendationCustomRuleUpdateData, + ) + + +class CostRecommendationCustomRuleUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_data import ( + CostRecommendationCustomRuleUpdateData, + ) + + return { + "data": (CostRecommendationCustomRuleUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CostRecommendationCustomRuleUpdateData, **kwargs): + """ + Request to update a custom recommendation rule. + + :param data: Changes to a custom recommendation rule. + :type data: CostRecommendationCustomRuleUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_recommendation_custom_rules_response.py b/src/datadog_api_client/v2/model/cost_recommendation_custom_rules_response.py new file mode 100644 index 0000000000..4e237d2955 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_custom_rules_response.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_custom_rule_data import CostRecommendationCustomRuleData + + +class CostRecommendationCustomRulesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_custom_rule_data import CostRecommendationCustomRuleData + + return { + "data": ([CostRecommendationCustomRuleData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[CostRecommendationCustomRuleData], **kwargs): + """ + The custom recommendation rules of the organization. + + :param data: The custom rules, ordered by recommender and then by priority. + :type data: [CostRecommendationCustomRuleData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_attributes.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_attributes.py new file mode 100644 index 0000000000..7d4c97bef3 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_attributes.py @@ -0,0 +1,233 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, + ) + + +class CostRecommendationNotificationRuleAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, + ) + + return { + "channel_id": (str,), + "created_at": (datetime,), + "created_by": (str,), + "destination_type": (CostRecommendationNotificationRuleDestinationType,), + "enabled": (bool,), + "frequency": (CostRecommendationNotificationRuleFrequency,), + "interval_execution_date": (str, none_type), + "interval_execution_time": (str, none_type), + "mention_targets": ([str],), + "message_customization": (CostRecommendationNotificationRuleMessageCustomization,), + "modified_at": (datetime,), + "modified_by": (str,), + "name": (str,), + "org_id": (int,), + "scope_query": (str,), + "teams_channel_id": (str,), + "teams_channel_name": (str,), + "teams_team_id": (str,), + "teams_team_name": (str,), + "teams_tenant_id": (str,), + "teams_tenant_name": (str,), + "timezone": (str,), + "weekly_execution_day": (str, none_type), + "weekly_execution_time": (str, none_type), + "workspace_id": (str,), + } + + attribute_map = { + "channel_id": "channel_id", + "created_at": "created_at", + "created_by": "created_by", + "destination_type": "destination_type", + "enabled": "enabled", + "frequency": "frequency", + "interval_execution_date": "interval_execution_date", + "interval_execution_time": "interval_execution_time", + "mention_targets": "mention_targets", + "message_customization": "message_customization", + "modified_at": "modified_at", + "modified_by": "modified_by", + "name": "name", + "org_id": "org_id", + "scope_query": "scope_query", + "teams_channel_id": "teams_channel_id", + "teams_channel_name": "teams_channel_name", + "teams_team_id": "teams_team_id", + "teams_team_name": "teams_team_name", + "teams_tenant_id": "teams_tenant_id", + "teams_tenant_name": "teams_tenant_name", + "timezone": "timezone", + "weekly_execution_day": "weekly_execution_day", + "weekly_execution_time": "weekly_execution_time", + "workspace_id": "workspace_id", + } + + def __init__( + self_, + channel_id: str, + created_at: datetime, + created_by: str, + destination_type: CostRecommendationNotificationRuleDestinationType, + enabled: bool, + frequency: CostRecommendationNotificationRuleFrequency, + interval_execution_date: Union[str, none_type], + interval_execution_time: Union[str, none_type], + mention_targets: List[str], + message_customization: CostRecommendationNotificationRuleMessageCustomization, + modified_at: datetime, + modified_by: str, + name: str, + org_id: int, + scope_query: str, + teams_channel_id: str, + teams_channel_name: str, + teams_team_id: str, + teams_team_name: str, + teams_tenant_id: str, + teams_tenant_name: str, + timezone: str, + weekly_execution_day: Union[str, none_type], + weekly_execution_time: Union[str, none_type], + workspace_id: str, + **kwargs, + ): + """ + Attributes of a recommendation notification rule. + + :param channel_id: The Slack channel ID. Empty for ``teams`` rules. + :type channel_id: str + + :param created_at: When the rule was created. + :type created_at: datetime + + :param created_by: The UUID of the user who created the rule. + :type created_by: str + + :param destination_type: Where the digest is sent. ``slack`` requires ``workspace_id`` and ``channel_id`` ; ``teams`` requires the + ``teams_*`` attributes. Defaults to ``slack``. + :type destination_type: CostRecommendationNotificationRuleDestinationType + + :param enabled: Whether the digest is sent. + :type enabled: bool + + :param frequency: How often the digest is sent. ``weekly`` and ``biweekly`` use ``weekly_execution_day`` and ``weekly_execution_time`` ; + ``every_30`` and ``every_90`` (days) use ``interval_execution_date`` and ``interval_execution_time``. + :type frequency: CostRecommendationNotificationRuleFrequency + + :param interval_execution_date: The first date ( ``YYYY-MM-DD`` ) of an ``every_30`` or ``every_90`` schedule. + :type interval_execution_date: str, none_type + + :param interval_execution_time: The time of day ( ``HH:MM`` , in ``timezone`` ) of an ``every_30`` or ``every_90`` schedule. + :type interval_execution_time: str, none_type + + :param mention_targets: Slack member IDs to mention in the digest. Only valid for ``slack`` rules. + :type mention_targets: [str] + + :param message_customization: Which sections the digest shows. Sent as a whole: sections left out of a request use their defaults, which + show everything. + :type message_customization: CostRecommendationNotificationRuleMessageCustomization + + :param modified_at: When the rule was last modified. + :type modified_at: datetime + + :param modified_by: The UUID of the user who last modified the rule. + :type modified_by: str + + :param name: The name of the rule, unique within the organization. + :type name: str + + :param org_id: The ID of the organization that owns the rule. + :type org_id: int + + :param scope_query: The recommendation search query that selects what the digest includes. Empty selects every recommendation. + :type scope_query: str + + :param teams_channel_id: The Microsoft Teams channel ID. Empty for ``slack`` rules. + :type teams_channel_id: str + + :param teams_channel_name: The Microsoft Teams channel name. Empty for ``slack`` rules. + :type teams_channel_name: str + + :param teams_team_id: The Microsoft Teams team ID. Empty for ``slack`` rules. + :type teams_team_id: str + + :param teams_team_name: The Microsoft Teams team name. Empty for ``slack`` rules. + :type teams_team_name: str + + :param teams_tenant_id: The Microsoft Teams tenant ID. Empty for ``slack`` rules. + :type teams_tenant_id: str + + :param teams_tenant_name: The Microsoft Teams tenant name. Empty for ``slack`` rules. + :type teams_tenant_name: str + + :param timezone: The IANA time zone of the schedule. + :type timezone: str + + :param weekly_execution_day: The day of the week of a ``weekly`` or ``biweekly`` schedule, such as ``monday``. + :type weekly_execution_day: str, none_type + + :param weekly_execution_time: The time of day ( ``HH:MM`` , in ``timezone`` ) of a ``weekly`` or ``biweekly`` schedule. + :type weekly_execution_time: str, none_type + + :param workspace_id: The Slack workspace ID. Empty for ``teams`` rules. + :type workspace_id: str + """ + super().__init__(kwargs) + + self_.channel_id = channel_id + self_.created_at = created_at + self_.created_by = created_by + self_.destination_type = destination_type + self_.enabled = enabled + self_.frequency = frequency + self_.interval_execution_date = interval_execution_date + self_.interval_execution_time = interval_execution_time + self_.mention_targets = mention_targets + self_.message_customization = message_customization + self_.modified_at = modified_at + self_.modified_by = modified_by + self_.name = name + self_.org_id = org_id + self_.scope_query = scope_query + self_.teams_channel_id = teams_channel_id + self_.teams_channel_name = teams_channel_name + self_.teams_team_id = teams_team_id + self_.teams_team_name = teams_team_name + self_.teams_tenant_id = teams_tenant_id + self_.teams_tenant_name = teams_tenant_name + self_.timezone = timezone + self_.weekly_execution_day = weekly_execution_day + self_.weekly_execution_time = weekly_execution_time + self_.workspace_id = workspace_id diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_attributes.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_attributes.py new file mode 100644 index 0000000000..93a1cc38b4 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_attributes.py @@ -0,0 +1,216 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, + ) + + +class CostRecommendationNotificationRuleCreateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, + ) + + return { + "channel_id": (str,), + "destination_type": (CostRecommendationNotificationRuleDestinationType,), + "enabled": (bool,), + "frequency": (CostRecommendationNotificationRuleFrequency,), + "interval_execution_date": (str,), + "interval_execution_time": (str,), + "mention_targets": ([str],), + "message_customization": (CostRecommendationNotificationRuleMessageCustomization,), + "name": (str,), + "scope_query": (str,), + "teams_channel_id": (str,), + "teams_channel_name": (str,), + "teams_team_id": (str,), + "teams_team_name": (str,), + "teams_tenant_id": (str,), + "teams_tenant_name": (str,), + "timezone": (str,), + "weekly_execution_day": (str,), + "weekly_execution_time": (str,), + "workspace_id": (str,), + } + + attribute_map = { + "channel_id": "channel_id", + "destination_type": "destination_type", + "enabled": "enabled", + "frequency": "frequency", + "interval_execution_date": "interval_execution_date", + "interval_execution_time": "interval_execution_time", + "mention_targets": "mention_targets", + "message_customization": "message_customization", + "name": "name", + "scope_query": "scope_query", + "teams_channel_id": "teams_channel_id", + "teams_channel_name": "teams_channel_name", + "teams_team_id": "teams_team_id", + "teams_team_name": "teams_team_name", + "teams_tenant_id": "teams_tenant_id", + "teams_tenant_name": "teams_tenant_name", + "timezone": "timezone", + "weekly_execution_day": "weekly_execution_day", + "weekly_execution_time": "weekly_execution_time", + "workspace_id": "workspace_id", + } + + def __init__( + self_, + frequency: CostRecommendationNotificationRuleFrequency, + name: str, + timezone: str, + channel_id: Union[str, UnsetType] = unset, + destination_type: Union[CostRecommendationNotificationRuleDestinationType, UnsetType] = unset, + enabled: Union[bool, UnsetType] = unset, + interval_execution_date: Union[str, UnsetType] = unset, + interval_execution_time: Union[str, UnsetType] = unset, + mention_targets: Union[List[str], UnsetType] = unset, + message_customization: Union[CostRecommendationNotificationRuleMessageCustomization, UnsetType] = unset, + scope_query: Union[str, UnsetType] = unset, + teams_channel_id: Union[str, UnsetType] = unset, + teams_channel_name: Union[str, UnsetType] = unset, + teams_team_id: Union[str, UnsetType] = unset, + teams_team_name: Union[str, UnsetType] = unset, + teams_tenant_id: Union[str, UnsetType] = unset, + teams_tenant_name: Union[str, UnsetType] = unset, + weekly_execution_day: Union[str, UnsetType] = unset, + weekly_execution_time: Union[str, UnsetType] = unset, + workspace_id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a new recommendation notification rule. Schedule attributes depend on ``frequency`` and target + attributes depend on ``destination_type``. + + :param channel_id: The Slack channel ID, starting with ``C`` or ``G``. Required for ``slack`` rules. + :type channel_id: str, optional + + :param destination_type: Where the digest is sent. ``slack`` requires ``workspace_id`` and ``channel_id`` ; ``teams`` requires the + ``teams_*`` attributes. Defaults to ``slack``. + :type destination_type: CostRecommendationNotificationRuleDestinationType, optional + + :param enabled: Whether the digest is sent. Defaults to ``true``. + :type enabled: bool, optional + + :param frequency: How often the digest is sent. ``weekly`` and ``biweekly`` use ``weekly_execution_day`` and ``weekly_execution_time`` ; + ``every_30`` and ``every_90`` (days) use ``interval_execution_date`` and ``interval_execution_time``. + :type frequency: CostRecommendationNotificationRuleFrequency + + :param interval_execution_date: The first date ( ``YYYY-MM-DD`` ) of an ``every_30`` or ``every_90`` schedule. + :type interval_execution_date: str, optional + + :param interval_execution_time: The time of day ( ``HH:MM`` , in ``timezone`` ) of an ``every_30`` or ``every_90`` schedule. + :type interval_execution_time: str, optional + + :param mention_targets: Slack member IDs to mention in the digest. Only valid for ``slack`` rules. + :type mention_targets: [str], optional + + :param message_customization: Which sections the digest shows. Sent as a whole: sections left out of a request use their defaults, which + show everything. + :type message_customization: CostRecommendationNotificationRuleMessageCustomization, optional + + :param name: The name of the rule, unique within the organization. + :type name: str + + :param scope_query: The recommendation search query that selects what the digest includes. Empty selects every recommendation. + :type scope_query: str, optional + + :param teams_channel_id: The Microsoft Teams channel ID. Required for ``teams`` rules. + :type teams_channel_id: str, optional + + :param teams_channel_name: The Microsoft Teams channel name. Required for ``teams`` rules. + :type teams_channel_name: str, optional + + :param teams_team_id: The Microsoft Teams team ID. Required for ``teams`` rules. + :type teams_team_id: str, optional + + :param teams_team_name: The Microsoft Teams team name. Required for ``teams`` rules. + :type teams_team_name: str, optional + + :param teams_tenant_id: The Microsoft Teams tenant ID. Required for ``teams`` rules. + :type teams_tenant_id: str, optional + + :param teams_tenant_name: The Microsoft Teams tenant name. Required for ``teams`` rules. + :type teams_tenant_name: str, optional + + :param timezone: The IANA time zone of the schedule. + :type timezone: str + + :param weekly_execution_day: The day of the week of a ``weekly`` or ``biweekly`` schedule, such as ``monday``. + :type weekly_execution_day: str, optional + + :param weekly_execution_time: The time of day ( ``HH:MM`` , in ``timezone`` ) of a ``weekly`` or ``biweekly`` schedule. + :type weekly_execution_time: str, optional + + :param workspace_id: The Slack workspace ID, starting with ``T``. Required for ``slack`` rules. + :type workspace_id: str, optional + """ + if channel_id is not unset: + kwargs["channel_id"] = channel_id + if destination_type is not unset: + kwargs["destination_type"] = destination_type + if enabled is not unset: + kwargs["enabled"] = enabled + if interval_execution_date is not unset: + kwargs["interval_execution_date"] = interval_execution_date + if interval_execution_time is not unset: + kwargs["interval_execution_time"] = interval_execution_time + if mention_targets is not unset: + kwargs["mention_targets"] = mention_targets + if message_customization is not unset: + kwargs["message_customization"] = message_customization + if scope_query is not unset: + kwargs["scope_query"] = scope_query + if teams_channel_id is not unset: + kwargs["teams_channel_id"] = teams_channel_id + if teams_channel_name is not unset: + kwargs["teams_channel_name"] = teams_channel_name + if teams_team_id is not unset: + kwargs["teams_team_id"] = teams_team_id + if teams_team_name is not unset: + kwargs["teams_team_name"] = teams_team_name + if teams_tenant_id is not unset: + kwargs["teams_tenant_id"] = teams_tenant_id + if teams_tenant_name is not unset: + kwargs["teams_tenant_name"] = teams_tenant_name + if weekly_execution_day is not unset: + kwargs["weekly_execution_day"] = weekly_execution_day + if weekly_execution_time is not unset: + kwargs["weekly_execution_time"] = weekly_execution_time + if workspace_id is not unset: + kwargs["workspace_id"] = workspace_id + super().__init__(kwargs) + + self_.frequency = frequency + self_.name = name + self_.timezone = timezone diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_data.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_data.py new file mode 100644 index 0000000000..68db6e5d60 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_data.py @@ -0,0 +1,62 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_attributes import ( + CostRecommendationNotificationRuleCreateAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, + ) + + +class CostRecommendationNotificationRuleCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_attributes import ( + CostRecommendationNotificationRuleCreateAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, + ) + + return { + "attributes": (CostRecommendationNotificationRuleCreateAttributes,), + "type": (CostRecommendationNotificationRuleType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + attributes: CostRecommendationNotificationRuleCreateAttributes, + type: CostRecommendationNotificationRuleType, + **kwargs, + ): + """ + A new recommendation notification rule. + + :param attributes: Attributes of a new recommendation notification rule. Schedule attributes depend on ``frequency`` and target + attributes depend on ``destination_type``. + :type attributes: CostRecommendationNotificationRuleCreateAttributes + + :param type: Recommendation notification rule resource type. + :type type: CostRecommendationNotificationRuleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_request.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_request.py new file mode 100644 index 0000000000..b1473279e7 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_create_request.py @@ -0,0 +1,44 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_data import ( + CostRecommendationNotificationRuleCreateData, + ) + + +class CostRecommendationNotificationRuleCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_data import ( + CostRecommendationNotificationRuleCreateData, + ) + + return { + "data": (CostRecommendationNotificationRuleCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CostRecommendationNotificationRuleCreateData, **kwargs): + """ + Request to create a recommendation notification rule. + + :param data: A new recommendation notification rule. + :type data: CostRecommendationNotificationRuleCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_data.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_data.py new file mode 100644 index 0000000000..f31912f448 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_data.py @@ -0,0 +1,68 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_attributes import ( + CostRecommendationNotificationRuleAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, + ) + + +class CostRecommendationNotificationRuleData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_attributes import ( + CostRecommendationNotificationRuleAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, + ) + + return { + "attributes": (CostRecommendationNotificationRuleAttributes,), + "id": (str,), + "type": (CostRecommendationNotificationRuleType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: CostRecommendationNotificationRuleAttributes, + id: str, + type: CostRecommendationNotificationRuleType, + **kwargs, + ): + """ + A recommendation notification rule. + + :param attributes: Attributes of a recommendation notification rule. + :type attributes: CostRecommendationNotificationRuleAttributes + + :param id: The ID of the notification rule. + :type id: str + + :param type: Recommendation notification rule resource type. + :type type: CostRecommendationNotificationRuleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_destination_type.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_destination_type.py new file mode 100644 index 0000000000..96322c7425 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_destination_type.py @@ -0,0 +1,39 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CostRecommendationNotificationRuleDestinationType(ModelSimple): + """ + Where the digest is sent. `slack` requires `workspace_id` and `channel_id`; `teams` requires the + `teams_*` attributes. Defaults to `slack`. + + :param value: Must be one of ["slack", "teams"]. + :type value: str + """ + + allowed_values = { + "slack", + "teams", + } + SLACK: ClassVar["CostRecommendationNotificationRuleDestinationType"] + TEAMS: ClassVar["CostRecommendationNotificationRuleDestinationType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostRecommendationNotificationRuleDestinationType.SLACK = CostRecommendationNotificationRuleDestinationType("slack") +CostRecommendationNotificationRuleDestinationType.TEAMS = CostRecommendationNotificationRuleDestinationType("teams") diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_frequency.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_frequency.py new file mode 100644 index 0000000000..36527dc34c --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_frequency.py @@ -0,0 +1,45 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CostRecommendationNotificationRuleFrequency(ModelSimple): + """ + How often the digest is sent. `weekly` and `biweekly` use `weekly_execution_day` and `weekly_execution_time`; + `every_30` and `every_90` (days) use `interval_execution_date` and `interval_execution_time`. + + :param value: Must be one of ["weekly", "biweekly", "every_30", "every_90"]. + :type value: str + """ + + allowed_values = { + "weekly", + "biweekly", + "every_30", + "every_90", + } + WEEKLY: ClassVar["CostRecommendationNotificationRuleFrequency"] + BIWEEKLY: ClassVar["CostRecommendationNotificationRuleFrequency"] + EVERY_30: ClassVar["CostRecommendationNotificationRuleFrequency"] + EVERY_90: ClassVar["CostRecommendationNotificationRuleFrequency"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostRecommendationNotificationRuleFrequency.WEEKLY = CostRecommendationNotificationRuleFrequency("weekly") +CostRecommendationNotificationRuleFrequency.BIWEEKLY = CostRecommendationNotificationRuleFrequency("biweekly") +CostRecommendationNotificationRuleFrequency.EVERY_30 = CostRecommendationNotificationRuleFrequency("every_30") +CostRecommendationNotificationRuleFrequency.EVERY_90 = CostRecommendationNotificationRuleFrequency("every_90") diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_action.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_action.py new file mode 100644 index 0000000000..52c94051de --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_action.py @@ -0,0 +1,43 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CostRecommendationNotificationRuleMessageAction(ModelNormal): + @cached_property + def openapi_types(_): + return { + "bulk": (bool,), + "per_rec": (bool,), + } + + attribute_map = { + "bulk": "bulk", + "per_rec": "per_rec", + } + + def __init__(self_, bulk: Union[bool, UnsetType] = unset, per_rec: Union[bool, UnsetType] = unset, **kwargs): + """ + Where a message action appears. + + :param bulk: Whether the action appears once for the whole digest. + :type bulk: bool, optional + + :param per_rec: Whether the action appears on each recommendation. + :type per_rec: bool, optional + """ + if bulk is not unset: + kwargs["bulk"] = bulk + if per_rec is not unset: + kwargs["per_rec"] = per_rec + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_actions.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_actions.py new file mode 100644 index 0000000000..b728c7385c --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_actions.py @@ -0,0 +1,48 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_action import ( + CostRecommendationNotificationRuleMessageAction, + ) + + +class CostRecommendationNotificationRuleMessageActions(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_action import ( + CostRecommendationNotificationRuleMessageAction, + ) + + return { + "view_in_ccm": (CostRecommendationNotificationRuleMessageAction,), + } + + attribute_map = { + "view_in_ccm": "view_in_ccm", + } + + def __init__( + self_, view_in_ccm: Union[CostRecommendationNotificationRuleMessageAction, UnsetType] = unset, **kwargs + ): + """ + Links the digest shows. ``view_in_ccm`` is the link to review the recommendations in Cloud Cost Management. + + :param view_in_ccm: Where a message action appears. + :type view_in_ccm: CostRecommendationNotificationRuleMessageAction, optional + """ + if view_in_ccm is not unset: + kwargs["view_in_ccm"] = view_in_ccm + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization.py new file mode 100644 index 0000000000..9335766934 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization.py @@ -0,0 +1,101 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_actions import ( + CostRecommendationNotificationRuleMessageActions, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_header import ( + CostRecommendationNotificationRuleMessageCustomizationHeader, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_mode import ( + CostRecommendationNotificationRuleMessageCustomizationMode, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_per_rec import ( + CostRecommendationNotificationRuleMessageCustomizationPerRec, + ) + + +class CostRecommendationNotificationRuleMessageCustomization(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_actions import ( + CostRecommendationNotificationRuleMessageActions, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_header import ( + CostRecommendationNotificationRuleMessageCustomizationHeader, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_mode import ( + CostRecommendationNotificationRuleMessageCustomizationMode, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_per_rec import ( + CostRecommendationNotificationRuleMessageCustomizationPerRec, + ) + + return { + "actions": (CostRecommendationNotificationRuleMessageActions,), + "header": (CostRecommendationNotificationRuleMessageCustomizationHeader,), + "include_tags": ([str],), + "mode": (CostRecommendationNotificationRuleMessageCustomizationMode,), + "per_rec": (CostRecommendationNotificationRuleMessageCustomizationPerRec,), + } + + attribute_map = { + "actions": "actions", + "header": "header", + "include_tags": "include_tags", + "mode": "mode", + "per_rec": "per_rec", + } + + def __init__( + self_, + actions: Union[CostRecommendationNotificationRuleMessageActions, UnsetType] = unset, + header: Union[CostRecommendationNotificationRuleMessageCustomizationHeader, UnsetType] = unset, + include_tags: Union[List[str], UnsetType] = unset, + mode: Union[CostRecommendationNotificationRuleMessageCustomizationMode, UnsetType] = unset, + per_rec: Union[CostRecommendationNotificationRuleMessageCustomizationPerRec, UnsetType] = unset, + **kwargs, + ): + """ + Which sections the digest shows. Sent as a whole: sections left out of a request use their defaults, which + show everything. + + :param actions: Links the digest shows. ``view_in_ccm`` is the link to review the recommendations in Cloud Cost Management. + :type actions: CostRecommendationNotificationRuleMessageActions, optional + + :param header: What the digest header shows. + :type header: CostRecommendationNotificationRuleMessageCustomizationHeader, optional + + :param include_tags: Tag keys whose values are shown on each recommendation in the digest. + :type include_tags: [str], optional + + :param mode: How the message is customized. + :type mode: CostRecommendationNotificationRuleMessageCustomizationMode, optional + + :param per_rec: What each recommendation in the digest shows. + :type per_rec: CostRecommendationNotificationRuleMessageCustomizationPerRec, optional + """ + if actions is not unset: + kwargs["actions"] = actions + if header is not unset: + kwargs["header"] = header + if include_tags is not unset: + kwargs["include_tags"] = include_tags + if mode is not unset: + kwargs["mode"] = mode + if per_rec is not unset: + kwargs["per_rec"] = per_rec + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_header.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_header.py new file mode 100644 index 0000000000..9e4b596932 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_header.py @@ -0,0 +1,63 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CostRecommendationNotificationRuleMessageCustomizationHeader(ModelNormal): + validations = { + "custom_text": { + "max_length": 500, + }, + } + + @cached_property + def openapi_types(_): + return { + "custom_text": (str,), + "notification_name": (bool,), + "total_savings": (bool,), + } + + attribute_map = { + "custom_text": "custom_text", + "notification_name": "notification_name", + "total_savings": "total_savings", + } + + def __init__( + self_, + custom_text: Union[str, UnsetType] = unset, + notification_name: Union[bool, UnsetType] = unset, + total_savings: Union[bool, UnsetType] = unset, + **kwargs, + ): + """ + What the digest header shows. + + :param custom_text: Text shown in the header, up to 500 characters. It can use the ``{{ total_savings }}`` , ``{{ rec_count }}`` , + and ``{{ digest_date }}`` variables. + :type custom_text: str, optional + + :param notification_name: Whether the header shows the rule name. + :type notification_name: bool, optional + + :param total_savings: Whether the header shows the total potential savings. + :type total_savings: bool, optional + """ + if custom_text is not unset: + kwargs["custom_text"] = custom_text + if notification_name is not unset: + kwargs["notification_name"] = notification_name + if total_savings is not unset: + kwargs["total_savings"] = total_savings + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_mode.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_mode.py new file mode 100644 index 0000000000..f00cf654d6 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_mode.py @@ -0,0 +1,37 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CostRecommendationNotificationRuleMessageCustomizationMode(ModelSimple): + """ + How the message is customized. + + :param value: If omitted defaults to "structured". Must be one of ["structured"]. + :type value: str + """ + + allowed_values = { + "structured", + } + STRUCTURED: ClassVar["CostRecommendationNotificationRuleMessageCustomizationMode"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostRecommendationNotificationRuleMessageCustomizationMode.STRUCTURED = ( + CostRecommendationNotificationRuleMessageCustomizationMode("structured") +) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_per_rec.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_per_rec.py new file mode 100644 index 0000000000..f69e34a2d8 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_message_customization_per_rec.py @@ -0,0 +1,56 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CostRecommendationNotificationRuleMessageCustomizationPerRec(ModelNormal): + @cached_property + def openapi_types(_): + return { + "effort": (bool,), + "risk": (bool,), + "why": (bool,), + } + + attribute_map = { + "effort": "effort", + "risk": "risk", + "why": "why", + } + + def __init__( + self_, + effort: Union[bool, UnsetType] = unset, + risk: Union[bool, UnsetType] = unset, + why: Union[bool, UnsetType] = unset, + **kwargs, + ): + """ + What each recommendation in the digest shows. + + :param effort: Whether each recommendation shows its effort. + :type effort: bool, optional + + :param risk: Whether each recommendation shows its risk. + :type risk: bool, optional + + :param why: Whether each recommendation shows why it was made. + :type why: bool, optional + """ + if effort is not unset: + kwargs["effort"] = effort + if risk is not unset: + kwargs["risk"] = risk + if why is not unset: + kwargs["why"] = why + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_response.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_response.py new file mode 100644 index 0000000000..96ff3fae75 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_response.py @@ -0,0 +1,44 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_data import ( + CostRecommendationNotificationRuleData, + ) + + +class CostRecommendationNotificationRuleResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_data import ( + CostRecommendationNotificationRuleData, + ) + + return { + "data": (CostRecommendationNotificationRuleData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CostRecommendationNotificationRuleData, **kwargs): + """ + A recommendation notification rule. + + :param data: A recommendation notification rule. + :type data: CostRecommendationNotificationRuleData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_type.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_type.py new file mode 100644 index 0000000000..93f1f34c06 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_type.py @@ -0,0 +1,35 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CostRecommendationNotificationRuleType(ModelSimple): + """ + Recommendation notification rule resource type. + + :param value: If omitted defaults to "notification_rules". Must be one of ["notification_rules"]. + :type value: str + """ + + allowed_values = { + "notification_rules", + } + NOTIFICATION_RULES: ClassVar["CostRecommendationNotificationRuleType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CostRecommendationNotificationRuleType.NOTIFICATION_RULES = CostRecommendationNotificationRuleType("notification_rules") diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_attributes.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_attributes.py new file mode 100644 index 0000000000..1c2e075857 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_attributes.py @@ -0,0 +1,218 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, + ) + + +class CostRecommendationNotificationRuleUpdateAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, + ) + + return { + "channel_id": (str,), + "destination_type": (CostRecommendationNotificationRuleDestinationType,), + "enabled": (bool,), + "frequency": (CostRecommendationNotificationRuleFrequency,), + "interval_execution_date": (str,), + "interval_execution_time": (str,), + "mention_targets": ([str],), + "message_customization": (CostRecommendationNotificationRuleMessageCustomization,), + "name": (str,), + "scope_query": (str,), + "teams_channel_id": (str,), + "teams_channel_name": (str,), + "teams_team_id": (str,), + "teams_team_name": (str,), + "teams_tenant_id": (str,), + "teams_tenant_name": (str,), + "timezone": (str,), + "weekly_execution_day": (str,), + "weekly_execution_time": (str,), + "workspace_id": (str,), + } + + attribute_map = { + "channel_id": "channel_id", + "destination_type": "destination_type", + "enabled": "enabled", + "frequency": "frequency", + "interval_execution_date": "interval_execution_date", + "interval_execution_time": "interval_execution_time", + "mention_targets": "mention_targets", + "message_customization": "message_customization", + "name": "name", + "scope_query": "scope_query", + "teams_channel_id": "teams_channel_id", + "teams_channel_name": "teams_channel_name", + "teams_team_id": "teams_team_id", + "teams_team_name": "teams_team_name", + "teams_tenant_id": "teams_tenant_id", + "teams_tenant_name": "teams_tenant_name", + "timezone": "timezone", + "weekly_execution_day": "weekly_execution_day", + "weekly_execution_time": "weekly_execution_time", + "workspace_id": "workspace_id", + } + + def __init__( + self_, + channel_id: Union[str, UnsetType] = unset, + destination_type: Union[CostRecommendationNotificationRuleDestinationType, UnsetType] = unset, + enabled: Union[bool, UnsetType] = unset, + frequency: Union[CostRecommendationNotificationRuleFrequency, UnsetType] = unset, + interval_execution_date: Union[str, UnsetType] = unset, + interval_execution_time: Union[str, UnsetType] = unset, + mention_targets: Union[List[str], UnsetType] = unset, + message_customization: Union[CostRecommendationNotificationRuleMessageCustomization, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + scope_query: Union[str, UnsetType] = unset, + teams_channel_id: Union[str, UnsetType] = unset, + teams_channel_name: Union[str, UnsetType] = unset, + teams_team_id: Union[str, UnsetType] = unset, + teams_team_name: Union[str, UnsetType] = unset, + teams_tenant_id: Union[str, UnsetType] = unset, + teams_tenant_name: Union[str, UnsetType] = unset, + timezone: Union[str, UnsetType] = unset, + weekly_execution_day: Union[str, UnsetType] = unset, + weekly_execution_time: Union[str, UnsetType] = unset, + workspace_id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes to change. Attributes left out keep their value; ``mention_targets`` and ``message_customization`` + replace the stored value when sent. + + :param channel_id: The Slack channel ID, starting with ``C`` or ``G``. + :type channel_id: str, optional + + :param destination_type: Where the digest is sent. ``slack`` requires ``workspace_id`` and ``channel_id`` ; ``teams`` requires the + ``teams_*`` attributes. Defaults to ``slack``. + :type destination_type: CostRecommendationNotificationRuleDestinationType, optional + + :param enabled: Whether the digest is sent. + :type enabled: bool, optional + + :param frequency: How often the digest is sent. ``weekly`` and ``biweekly`` use ``weekly_execution_day`` and ``weekly_execution_time`` ; + ``every_30`` and ``every_90`` (days) use ``interval_execution_date`` and ``interval_execution_time``. + :type frequency: CostRecommendationNotificationRuleFrequency, optional + + :param interval_execution_date: The first date ( ``YYYY-MM-DD`` ) of an ``every_30`` or ``every_90`` schedule. + :type interval_execution_date: str, optional + + :param interval_execution_time: The time of day ( ``HH:MM`` , in ``timezone`` ) of an ``every_30`` or ``every_90`` schedule. + :type interval_execution_time: str, optional + + :param mention_targets: Slack member IDs to mention in the digest. Only valid for ``slack`` rules. + :type mention_targets: [str], optional + + :param message_customization: Which sections the digest shows. Sent as a whole: sections left out of a request use their defaults, which + show everything. + :type message_customization: CostRecommendationNotificationRuleMessageCustomization, optional + + :param name: The name of the rule, unique within the organization. + :type name: str, optional + + :param scope_query: The recommendation search query that selects what the digest includes. Empty selects every recommendation. + :type scope_query: str, optional + + :param teams_channel_id: The Microsoft Teams channel ID. + :type teams_channel_id: str, optional + + :param teams_channel_name: The Microsoft Teams channel name. + :type teams_channel_name: str, optional + + :param teams_team_id: The Microsoft Teams team ID. + :type teams_team_id: str, optional + + :param teams_team_name: The Microsoft Teams team name. + :type teams_team_name: str, optional + + :param teams_tenant_id: The Microsoft Teams tenant ID. + :type teams_tenant_id: str, optional + + :param teams_tenant_name: The Microsoft Teams tenant name. + :type teams_tenant_name: str, optional + + :param timezone: The IANA time zone of the schedule. + :type timezone: str, optional + + :param weekly_execution_day: The day of the week of a ``weekly`` or ``biweekly`` schedule, such as ``monday``. + :type weekly_execution_day: str, optional + + :param weekly_execution_time: The time of day ( ``HH:MM`` , in ``timezone`` ) of a ``weekly`` or ``biweekly`` schedule. + :type weekly_execution_time: str, optional + + :param workspace_id: The Slack workspace ID, starting with ``T``. + :type workspace_id: str, optional + """ + if channel_id is not unset: + kwargs["channel_id"] = channel_id + if destination_type is not unset: + kwargs["destination_type"] = destination_type + if enabled is not unset: + kwargs["enabled"] = enabled + if frequency is not unset: + kwargs["frequency"] = frequency + if interval_execution_date is not unset: + kwargs["interval_execution_date"] = interval_execution_date + if interval_execution_time is not unset: + kwargs["interval_execution_time"] = interval_execution_time + if mention_targets is not unset: + kwargs["mention_targets"] = mention_targets + if message_customization is not unset: + kwargs["message_customization"] = message_customization + if name is not unset: + kwargs["name"] = name + if scope_query is not unset: + kwargs["scope_query"] = scope_query + if teams_channel_id is not unset: + kwargs["teams_channel_id"] = teams_channel_id + if teams_channel_name is not unset: + kwargs["teams_channel_name"] = teams_channel_name + if teams_team_id is not unset: + kwargs["teams_team_id"] = teams_team_id + if teams_team_name is not unset: + kwargs["teams_team_name"] = teams_team_name + if teams_tenant_id is not unset: + kwargs["teams_tenant_id"] = teams_tenant_id + if teams_tenant_name is not unset: + kwargs["teams_tenant_name"] = teams_tenant_name + if timezone is not unset: + kwargs["timezone"] = timezone + if weekly_execution_day is not unset: + kwargs["weekly_execution_day"] = weekly_execution_day + if weekly_execution_time is not unset: + kwargs["weekly_execution_time"] = weekly_execution_time + if workspace_id is not unset: + kwargs["workspace_id"] = workspace_id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_data.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_data.py new file mode 100644 index 0000000000..b0eac20126 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_data.py @@ -0,0 +1,69 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_attributes import ( + CostRecommendationNotificationRuleUpdateAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, + ) + + +class CostRecommendationNotificationRuleUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_attributes import ( + CostRecommendationNotificationRuleUpdateAttributes, + ) + from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, + ) + + return { + "attributes": (CostRecommendationNotificationRuleUpdateAttributes,), + "id": (str,), + "type": (CostRecommendationNotificationRuleType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: CostRecommendationNotificationRuleUpdateAttributes, + id: str, + type: CostRecommendationNotificationRuleType, + **kwargs, + ): + """ + Changes to a recommendation notification rule. + + :param attributes: Attributes to change. Attributes left out keep their value; ``mention_targets`` and ``message_customization`` + replace the stored value when sent. + :type attributes: CostRecommendationNotificationRuleUpdateAttributes + + :param id: The ID of the notification rule. It must match the ID in the path. + :type id: str + + :param type: Recommendation notification rule resource type. + :type type: CostRecommendationNotificationRuleType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_request.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_request.py new file mode 100644 index 0000000000..a19ad37198 --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rule_update_request.py @@ -0,0 +1,44 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_data import ( + CostRecommendationNotificationRuleUpdateData, + ) + + +class CostRecommendationNotificationRuleUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_data import ( + CostRecommendationNotificationRuleUpdateData, + ) + + return { + "data": (CostRecommendationNotificationRuleUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CostRecommendationNotificationRuleUpdateData, **kwargs): + """ + Request to update a recommendation notification rule. + + :param data: Changes to a recommendation notification rule. + :type data: CostRecommendationNotificationRuleUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/cost_recommendation_notification_rules_response.py b/src/datadog_api_client/v2/model/cost_recommendation_notification_rules_response.py new file mode 100644 index 0000000000..3b8035239e --- /dev/null +++ b/src/datadog_api_client/v2/model/cost_recommendation_notification_rules_response.py @@ -0,0 +1,44 @@ +# 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. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.cost_recommendation_notification_rule_data import ( + CostRecommendationNotificationRuleData, + ) + + +class CostRecommendationNotificationRulesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.cost_recommendation_notification_rule_data import ( + CostRecommendationNotificationRuleData, + ) + + return { + "data": ([CostRecommendationNotificationRuleData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[CostRecommendationNotificationRuleData], **kwargs): + """ + The recommendation notification rules of the organization. + + :param data: The notification rules. + :type data: [CostRecommendationNotificationRuleData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 8153ee17ab..562a63d242 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2068,12 +2068,99 @@ from datadog_api_client.v2.model.cost_orchestrator_type import CostOrchestratorType from datadog_api_client.v2.model.cost_orchestrators_response import CostOrchestratorsResponse from datadog_api_client.v2.model.cost_recommendation_array import CostRecommendationArray +from datadog_api_client.v2.model.cost_recommendation_custom_rule_attributes import ( + CostRecommendationCustomRuleAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_attributes import ( + CostRecommendationCustomRuleCreateAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_data import ( + CostRecommendationCustomRuleCreateData, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_create_request import ( + CostRecommendationCustomRuleCreateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_data import CostRecommendationCustomRuleData +from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter import CostRecommendationCustomRuleFilter +from datadog_api_client.v2.model.cost_recommendation_custom_rule_filter_type import ( + CostRecommendationCustomRuleFilterType, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_response import CostRecommendationCustomRuleResponse +from datadog_api_client.v2.model.cost_recommendation_custom_rule_settings import CostRecommendationCustomRuleSettings +from datadog_api_client.v2.model.cost_recommendation_custom_rule_type import CostRecommendationCustomRuleType +from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_attributes import ( + CostRecommendationCustomRuleUpdateAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_data import ( + CostRecommendationCustomRuleUpdateData, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rule_update_request import ( + CostRecommendationCustomRuleUpdateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_custom_rules_response import CostRecommendationCustomRulesResponse from datadog_api_client.v2.model.cost_recommendation_data import CostRecommendationData from datadog_api_client.v2.model.cost_recommendation_data_attributes import CostRecommendationDataAttributes from datadog_api_client.v2.model.cost_recommendation_data_attributes_potential_daily_savings import ( CostRecommendationDataAttributesPotentialDailySavings, ) from datadog_api_client.v2.model.cost_recommendation_data_type import CostRecommendationDataType +from datadog_api_client.v2.model.cost_recommendation_notification_rule_attributes import ( + CostRecommendationNotificationRuleAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_attributes import ( + CostRecommendationNotificationRuleCreateAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_data import ( + CostRecommendationNotificationRuleCreateData, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_create_request import ( + CostRecommendationNotificationRuleCreateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_data import ( + CostRecommendationNotificationRuleData, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_destination_type import ( + CostRecommendationNotificationRuleDestinationType, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_frequency import ( + CostRecommendationNotificationRuleFrequency, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_action import ( + CostRecommendationNotificationRuleMessageAction, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_actions import ( + CostRecommendationNotificationRuleMessageActions, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization import ( + CostRecommendationNotificationRuleMessageCustomization, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_header import ( + CostRecommendationNotificationRuleMessageCustomizationHeader, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_mode import ( + CostRecommendationNotificationRuleMessageCustomizationMode, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_message_customization_per_rec import ( + CostRecommendationNotificationRuleMessageCustomizationPerRec, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_response import ( + CostRecommendationNotificationRuleResponse, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_type import ( + CostRecommendationNotificationRuleType, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_attributes import ( + CostRecommendationNotificationRuleUpdateAttributes, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_data import ( + CostRecommendationNotificationRuleUpdateData, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rule_update_request import ( + CostRecommendationNotificationRuleUpdateRequest, +) +from datadog_api_client.v2.model.cost_recommendation_notification_rules_response import ( + CostRecommendationNotificationRulesResponse, +) from datadog_api_client.v2.model.cost_tag import CostTag from datadog_api_client.v2.model.cost_tag_attributes import CostTagAttributes from datadog_api_client.v2.model.cost_tag_description import CostTagDescription @@ -15594,10 +15681,43 @@ "CostOrchestratorType", "CostOrchestratorsResponse", "CostRecommendationArray", + "CostRecommendationCustomRuleAttributes", + "CostRecommendationCustomRuleCreateAttributes", + "CostRecommendationCustomRuleCreateData", + "CostRecommendationCustomRuleCreateRequest", + "CostRecommendationCustomRuleData", + "CostRecommendationCustomRuleFilter", + "CostRecommendationCustomRuleFilterType", + "CostRecommendationCustomRuleResponse", + "CostRecommendationCustomRuleSettings", + "CostRecommendationCustomRuleType", + "CostRecommendationCustomRuleUpdateAttributes", + "CostRecommendationCustomRuleUpdateData", + "CostRecommendationCustomRuleUpdateRequest", + "CostRecommendationCustomRulesResponse", "CostRecommendationData", "CostRecommendationDataAttributes", "CostRecommendationDataAttributesPotentialDailySavings", "CostRecommendationDataType", + "CostRecommendationNotificationRuleAttributes", + "CostRecommendationNotificationRuleCreateAttributes", + "CostRecommendationNotificationRuleCreateData", + "CostRecommendationNotificationRuleCreateRequest", + "CostRecommendationNotificationRuleData", + "CostRecommendationNotificationRuleDestinationType", + "CostRecommendationNotificationRuleFrequency", + "CostRecommendationNotificationRuleMessageAction", + "CostRecommendationNotificationRuleMessageActions", + "CostRecommendationNotificationRuleMessageCustomization", + "CostRecommendationNotificationRuleMessageCustomizationHeader", + "CostRecommendationNotificationRuleMessageCustomizationMode", + "CostRecommendationNotificationRuleMessageCustomizationPerRec", + "CostRecommendationNotificationRuleResponse", + "CostRecommendationNotificationRuleType", + "CostRecommendationNotificationRuleUpdateAttributes", + "CostRecommendationNotificationRuleUpdateData", + "CostRecommendationNotificationRuleUpdateRequest", + "CostRecommendationNotificationRulesResponse", "CostTag", "CostTagAttributes", "CostTagDescription", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index 387a953725..4f0bdf135b 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -1428,13 +1428,6 @@ "scenario": "Create a Cost Monitor returns \"OK\" response", "version": "v1" }, - { - "feature": "Monitors", - "feature_file": "../../v1/features/monitors.feature", - "file": "v1/monitors/create-a-data-jobs-duration-monitor-returns-ok-response.json", - "scenario": "Create a Data Jobs duration monitor returns \"OK\" response", - "version": "v1" - }, { "feature": "Monitors", "feature_file": "../../v1/features/monitors.feature", @@ -1442,13 +1435,6 @@ "scenario": "Create a Data Jobs monitor returns \"OK\" response", "version": "v1" }, - { - "feature": "Monitors", - "feature_file": "../../v1/features/monitors.feature", - "file": "v1/monitors/create-a-data-jobs-monitor-with-the-aastra-query-dialect-returns-ok-response.json", - "scenario": "Create a Data Jobs monitor with the aastra query dialect returns \"OK\" response", - "version": "v1" - }, { "feature": "Monitors", "feature_file": "../../v1/features/monitors.feature", diff --git a/tests/generated-test/test-runner-data/v1/monitors/create-a-data-jobs-duration-monitor-returns-ok-response.json b/tests/generated-test/test-runner-data/v1/monitors/create-a-data-jobs-duration-monitor-returns-ok-response.json deleted file mode 100644 index 97b89686c1..0000000000 --- a/tests/generated-test/test-runner-data/v1/monitors/create-a-data-jobs-duration-monitor-returns-ok-response.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "api": "Monitors", - "expected_status": 200, - "feature": "Monitors", - "id": "v1/Monitors/Create a Data Jobs duration monitor returns \"OK\" response", - "operation_id": "CreateMonitor", - "request": { - "body": { - "schema": { - "format": null, - "ref": "Monitor", - "type": "object" - }, - "source": "inline", - "value": { - "message": "Data jobs duration alert triggered", - "name": "{{ unique }}", - "options": { - "variables": [ - { - "data_source": "data_quality_metrics", - "filter": "search for databricks_job", - "group_by": [ - "name", - "workspace_name", - "entity_id" - ], - "measure": "duration", - "monitor_options": { - "consecutive_runs": 2, - "detection_type": "anomaly" - }, - "name": "run_query", - "run_filter": "env:prod", - "schema_version": "0.0.1" - } - ] - }, - "query": "formula(\"job_duration(run_query)\").detection(anomaly).by(name,workspace_name,entity_id) > 0", - "tags": [ - "test:{{ unique_lower_alnum }}", - "env:ci" - ], - "type": "data-jobs alert" - } - }, - "content_type": "application/json", - "method": "POST", - "pagination": false, - "parameters": [], - "path": "/api/v1/monitor" - }, - "scenario": "Create a Data Jobs duration monitor returns \"OK\" response", - "schema_version": 1, - "version": "v1" -} diff --git a/tests/generated-test/test-runner-data/v1/monitors/create-a-data-jobs-monitor-with-the-aastra-query-dialect-returns-ok-response.json b/tests/generated-test/test-runner-data/v1/monitors/create-a-data-jobs-monitor-with-the-aastra-query-dialect-returns-ok-response.json deleted file mode 100644 index 9f662996b9..0000000000 --- a/tests/generated-test/test-runner-data/v1/monitors/create-a-data-jobs-monitor-with-the-aastra-query-dialect-returns-ok-response.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "api": "Monitors", - "expected_status": 200, - "feature": "Monitors", - "id": "v1/Monitors/Create a Data Jobs monitor with the aastra query dialect returns \"OK\" response", - "operation_id": "CreateMonitor", - "request": { - "body": { - "schema": { - "format": null, - "ref": "Monitor", - "type": "object" - }, - "source": "inline", - "value": { - "message": "Data jobs alert triggered", - "name": "{{ unique }}", - "options": { - "thresholds": { - "critical": 0 - }, - "variables": [ - { - "job_type": "databricks.job", - "jobs_query": "search for databricks_job", - "monitor_options": { - "alert_on_every_failure": true - }, - "name": "run_query", - "query_dialect": "aastra", - "run_filter": "env:prod" - } - ] - }, - "query": "formula(\"failed_runs(run_query)\").by(name,workspace_name,entity_id).last(1d) > 0", - "tags": [ - "test:{{ unique_lower_alnum }}", - "env:ci" - ], - "type": "data-jobs alert" - } - }, - "content_type": "application/json", - "method": "POST", - "pagination": false, - "parameters": [], - "path": "/api/v1/monitor" - }, - "scenario": "Create a Data Jobs monitor with the aastra query dialect returns \"OK\" response", - "schema_version": 1, - "version": "v1" -} diff --git a/tests/generated-test/test-server-data/v1/monitors.json b/tests/generated-test/test-server-data/v1/monitors.json index b1fd4a2ab7..1242fc1f2c 100644 --- a/tests/generated-test/test-server-data/v1/monitors.json +++ b/tests/generated-test/test-server-data/v1/monitors.json @@ -192,90 +192,6 @@ "scenario": "Create a Cost Monitor returns \"OK\" response", "version": "v1" }, - { - "feature": "Monitors", - "frozen_at": "2026-11-06T16:42:00.361Z", - "interactions": [ - { - "request": { - "body": { - "type": "json", - "value": { - "message": "Data jobs duration alert triggered", - "name": "Test-Create_a_Data_Jobs_duration_monitor_returns_OK_response-1793983320", - "options": { - "variables": [ - { - "data_source": "data_quality_metrics", - "filter": "search for databricks_job", - "group_by": [ - "name", - "workspace_name", - "entity_id" - ], - "measure": "duration", - "monitor_options": { - "consecutive_runs": 2, - "detection_type": "anomaly" - }, - "name": "run_query", - "run_filter": "env:prod", - "schema_version": "0.0.1" - } - ] - }, - "query": "formula(\"job_duration(run_query)\").detection(anomaly).by(name,workspace_name,entity_id) > 0", - "tags": [ - "test:testcreateadatajobsdurationmonitorreturnsokresponse1793983320", - "env:ci" - ], - "type": "data-jobs alert" - } - }, - "content_type": "application/json", - "method": "POST", - "path": "/api/v1/monitor", - "query": [] - }, - "response": { - "body": { - "encoding": "text", - "value": "{\"id\":341751249,\"org_id\":321813,\"type\":\"data-jobs alert\",\"name\":\"Test-Create_a_Data_Jobs_duration_monitor_returns_OK_response-1793983320\",\"message\":\"Data jobs duration alert triggered\",\"tags\":[\"test:testcreateadatajobsdurationmonitorreturnsokresponse1793983320\",\"env:ci\"],\"query\":\"formula(\\\"job_duration(run_query)\\\").detection(anomaly).by(name,workspace_name,entity_id) > 0\",\"options\":{\"variables\":[{\"data_source\":\"data_quality_metrics\",\"filter\":\"search for databricks_job\",\"group_by\":[\"name\",\"workspace_name\",\"entity_id\"],\"measure\":\"duration\",\"monitor_options\":{\"consecutive_runs\":2,\"detection_type\":\"anomaly\"},\"name\":\"run_query\",\"run_filter\":\"env:prod\",\"schema_version\":\"0.0.1\"}],\"notify_no_data\":false,\"notify_audit\":false,\"new_host_delay\":300,\"include_tags\":true,\"silenced\":{}},\"multi\":true,\"created_at\":1793983320000,\"created\":\"2026-11-06T16:42:00.590725+00:00\",\"modified\":\"2026-11-06T16:42:00.590725+00:00\",\"deleted\":null,\"priority\":null,\"restricted_roles\":null,\"restriction_policy\":null,\"draft_status\":\"published\",\"assets\":[],\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":\"C\\u00e9dric Van Rompay\",\"handle\":\"cedric.vanrompay@datadoghq.com\",\"email\":\"cedric.vanrompay@datadoghq.com\",\"id\":68397867}}\n" - }, - "headers": { - "content-type": "application/json" - }, - "reason": "OK", - "status": 200 - } - }, - { - "request": { - "body": { - "type": "empty", - "value": null - }, - "content_type": "", - "method": "DELETE", - "path": "/api/v1/monitor/341751249", - "query": [] - }, - "response": { - "body": { - "encoding": "text", - "value": "{\"deleted_monitor_id\":341751249}\n" - }, - "headers": { - "content-type": "application/json" - }, - "reason": "OK", - "status": 200 - } - } - ], - "scenario": "Create a Data Jobs duration monitor returns \"OK\" response", - "version": "v1" - }, { "feature": "Monitors", "frozen_at": "2026-05-14T10:58:54.153Z", @@ -352,86 +268,6 @@ "scenario": "Create a Data Jobs monitor returns \"OK\" response", "version": "v1" }, - { - "feature": "Monitors", - "frozen_at": "2026-11-06T16:42:01.032Z", - "interactions": [ - { - "request": { - "body": { - "type": "json", - "value": { - "message": "Data jobs alert triggered", - "name": "Test-Create_a_Data_Jobs_monitor_with_the_aastra_query_dialect_returns_OK_response-1793983321", - "options": { - "thresholds": { - "critical": 0 - }, - "variables": [ - { - "job_type": "databricks.job", - "jobs_query": "search for databricks_job", - "monitor_options": { - "alert_on_every_failure": true - }, - "name": "run_query", - "query_dialect": "aastra", - "run_filter": "env:prod" - } - ] - }, - "query": "formula(\"failed_runs(run_query)\").by(name,workspace_name,entity_id).last(1d) > 0", - "tags": [ - "test:testcreateadatajobsmonitorwiththeaastraquerydialectreturnsokresponse1793983321", - "env:ci" - ], - "type": "data-jobs alert" - } - }, - "content_type": "application/json", - "method": "POST", - "path": "/api/v1/monitor", - "query": [] - }, - "response": { - "body": { - "encoding": "text", - "value": "{\"id\":341751253,\"org_id\":321813,\"type\":\"data-jobs alert\",\"name\":\"Test-Create_a_Data_Jobs_monitor_with_the_aastra_query_dialect_returns_OK_response-1793983321\",\"message\":\"Data jobs alert triggered\",\"tags\":[\"test:testcreateadatajobsmonitorwiththeaastraquerydialectreturnsokresponse1793983321\",\"env:ci\"],\"query\":\"formula(\\\"failed_runs(run_query)\\\").by(name,workspace_name,entity_id).last(1d) > 0\",\"options\":{\"thresholds\":{\"critical\":0.0},\"variables\":[{\"job_type\":\"databricks.job\",\"jobs_query\":\"search for databricks_job\",\"monitor_options\":{\"alert_on_every_failure\":true},\"name\":\"run_query\",\"query_dialect\":\"aastra\",\"run_filter\":\"env:prod\"}],\"notify_no_data\":false,\"notify_audit\":false,\"new_host_delay\":300,\"include_tags\":true,\"silenced\":{}},\"multi\":true,\"created_at\":1793983321000,\"created\":\"2026-11-06T16:42:01.177378+00:00\",\"modified\":\"2026-11-06T16:42:01.177378+00:00\",\"deleted\":null,\"priority\":null,\"restricted_roles\":null,\"restriction_policy\":null,\"draft_status\":\"published\",\"assets\":[],\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":\"C\\u00e9dric Van Rompay\",\"handle\":\"cedric.vanrompay@datadoghq.com\",\"email\":\"cedric.vanrompay@datadoghq.com\",\"id\":68397867}}\n" - }, - "headers": { - "content-type": "application/json" - }, - "reason": "OK", - "status": 200 - } - }, - { - "request": { - "body": { - "type": "empty", - "value": null - }, - "content_type": "", - "method": "DELETE", - "path": "/api/v1/monitor/341751253", - "query": [] - }, - "response": { - "body": { - "encoding": "text", - "value": "{\"deleted_monitor_id\":341751253}\n" - }, - "headers": { - "content-type": "application/json" - }, - "reason": "OK", - "status": 200 - } - } - ], - "scenario": "Create a Data Jobs monitor with the aastra query dialect returns \"OK\" response", - "version": "v1" - }, { "feature": "Monitors", "frozen_at": "2026-01-12T17:23:49.629Z", diff --git a/tests/v1/features/monitors.feature b/tests/v1/features/monitors.feature index ef8d3d387b..5584472ab2 100644 --- a/tests/v1/features/monitors.feature +++ b/tests/v1/features/monitors.feature @@ -42,18 +42,6 @@ Feature: Monitors When the request is sent Then the response status is 200 OK - @team:ddoghq/monitor-app - Scenario: Create a Data Jobs duration monitor returns "OK" response - Given new "CreateMonitor" request - And body with value {"name": "{{ unique }}", "type": "data-jobs alert", "query": "formula(\"job_duration(run_query)\").detection(anomaly).by(name,workspace_name,entity_id) > 0", "message": "Data jobs duration alert triggered", "tags": ["test:{{ unique_lower_alnum }}", "env:ci"], "options": {"variables": [{"name": "run_query", "data_source": "data_quality_metrics", "schema_version": "0.0.1", "measure": "duration", "filter": "search for databricks_job", "run_filter": "env:prod", "group_by": ["name", "workspace_name", "entity_id"], "monitor_options": {"detection_type": "anomaly", "consecutive_runs": 2}}]}} - When the request is sent - Then the response status is 200 OK - And the response "name" is equal to "{{ unique }}" - And the response "type" is equal to "data-jobs alert" - And the response "options.variables[0].run_filter" is equal to "env:prod" - And the response "options.variables[0].monitor_options.detection_type" is equal to "anomaly" - And the response "options.variables[0].monitor_options.consecutive_runs" is equal to 2 - @team:ddoghq/monitor-app Scenario: Create a Data Jobs monitor returns "OK" response Given new "CreateMonitor" request @@ -63,18 +51,6 @@ Feature: Monitors And the response "name" is equal to "{{ unique }}" And the response "type" is equal to "data-jobs alert" - @team:ddoghq/monitor-app - Scenario: Create a Data Jobs monitor with the aastra query dialect returns "OK" response - Given new "CreateMonitor" request - And body with value {"name": "{{ unique }}", "type": "data-jobs alert", "query": "formula(\"failed_runs(run_query)\").by(name,workspace_name,entity_id).last(1d) > 0", "message": "Data jobs alert triggered", "tags": ["test:{{ unique_lower_alnum }}", "env:ci"], "options": {"thresholds": {"critical": 0}, "variables": [{"name": "run_query", "jobs_query": "search for databricks_job", "job_type": "databricks.job", "query_dialect": "aastra", "run_filter": "env:prod", "monitor_options": {"alert_on_every_failure": true}}]}} - When the request is sent - Then the response status is 200 OK - And the response "name" is equal to "{{ unique }}" - And the response "type" is equal to "data-jobs alert" - And the response "options.variables[0].query_dialect" is equal to "aastra" - And the response "options.variables[0].run_filter" is equal to "env:prod" - And the response "options.variables[0].monitor_options.alert_on_every_failure" is equal to true - @team:ddoghq/monitor-app Scenario: Create a Data Quality monitor returns "OK" response Given new "CreateMonitor" request diff --git a/tests/v2/features/cloud_cost_management.feature b/tests/v2/features/cloud_cost_management.feature index 5f4cbc46c0..7d39336315 100644 --- a/tests/v2/features/cloud_cost_management.feature +++ b/tests/v2/features/cloud_cost_management.feature @@ -58,6 +58,46 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.attributes.account_id" is equal to "123456_A123BC_12AB34" + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Create a cost recommendation custom rule returns "Bad Request" response + Given operation "CreateCostRecommendationCustomRule" enabled + And new "CreateCostRecommendationCustomRule" request + And body with value {"data": {"attributes": {"enabled": true, "filters": [{"filter_type": "is", "tag": "env", "values": ["staging"]}], "name": "Staging instances", "notes": "Staging instances can run with less headroom.", "recommender_id": "aws_ec2_instance_unused", "settings": {"lookback_days": 14, "max_cpu_user_limit": 0.05}}, "type": "custom_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Create a cost recommendation custom rule returns "Created" response + Given operation "CreateCostRecommendationCustomRule" enabled + And new "CreateCostRecommendationCustomRule" request + And body with value {"data": {"attributes": {"enabled": true, "filters": [{"filter_type": "is", "tag": "env", "values": ["staging"]}], "name": "Staging instances", "notes": "Staging instances can run with less headroom.", "recommender_id": "aws_ec2_instance_unused", "settings": {"lookback_days": 14, "max_cpu_user_limit": 0.05}}, "type": "custom_rules"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Create a cost recommendation notification rule returns "Bad Request" response + Given operation "CreateCostRecommendationNotificationRule" enabled + And new "CreateCostRecommendationNotificationRule" request + And body with value {"data": {"attributes": {"channel_id": "C0456ABCD", "destination_type": "slack", "enabled": true, "frequency": "weekly", "interval_execution_date": "2026-11-02", "interval_execution_time": "09:30", "mention_targets": ["U01ABCDE"], "message_customization": {"actions": {"view_in_ccm": {"bulk": true, "per_rec": true}}, "header": {"custom_text": "{{ rec_count }} recommendations to review this week.", "notification_name": true, "total_savings": true}, "include_tags": ["team"], "mode": "structured", "per_rec": {"effort": true, "risk": true, "why": true}}, "name": "Production recommendations", "scope_query": "service:api AND env:prod", "timezone": "America/New_York", "weekly_execution_day": "monday", "weekly_execution_time": "09:30", "workspace_id": "T0123ABCD"}, "type": "notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Create a cost recommendation notification rule returns "Conflict" response + Given operation "CreateCostRecommendationNotificationRule" enabled + And new "CreateCostRecommendationNotificationRule" request + And body with value {"data": {"attributes": {"channel_id": "C0456ABCD", "destination_type": "slack", "enabled": true, "frequency": "weekly", "interval_execution_date": "2026-11-02", "interval_execution_time": "09:30", "mention_targets": ["U01ABCDE"], "message_customization": {"actions": {"view_in_ccm": {"bulk": true, "per_rec": true}}, "header": {"custom_text": "{{ rec_count }} recommendations to review this week.", "notification_name": true, "total_savings": true}, "include_tags": ["team"], "mode": "structured", "per_rec": {"effort": true, "risk": true, "why": true}}, "name": "Production recommendations", "scope_query": "service:api AND env:prod", "timezone": "America/New_York", "weekly_execution_day": "monday", "weekly_execution_time": "09:30", "workspace_id": "T0123ABCD"}, "type": "notification_rules"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Create a cost recommendation notification rule returns "Created" response + Given operation "CreateCostRecommendationNotificationRule" enabled + And new "CreateCostRecommendationNotificationRule" request + And body with value {"data": {"attributes": {"channel_id": "C0456ABCD", "destination_type": "slack", "enabled": true, "frequency": "weekly", "interval_execution_date": "2026-11-02", "interval_execution_time": "09:30", "mention_targets": ["U01ABCDE"], "message_customization": {"actions": {"view_in_ccm": {"bulk": true, "per_rec": true}}, "header": {"custom_text": "{{ rec_count }} recommendations to review this week.", "notification_name": true, "total_savings": true}, "include_tags": ["team"], "mode": "structured", "per_rec": {"effort": true, "risk": true, "why": true}}, "name": "Production recommendations", "scope_query": "service:api AND env:prod", "timezone": "America/New_York", "weekly_execution_day": "monday", "weekly_execution_time": "09:30", "workspace_id": "T0123ABCD"}, "type": "notification_rules"}} + When the request is sent + Then the response status is 201 Created + @generated @skip @team:ddoghq/ccm-roi Scenario: Create a unit cost returns "Bad Request" response Given operation "CreateUnitCost" enabled @@ -269,6 +309,54 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 404 Not Found + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Delete a cost recommendation custom rule returns "Bad Request" response + Given operation "DeleteCostRecommendationCustomRule" enabled + And new "DeleteCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Delete a cost recommendation custom rule returns "No Content" response + Given operation "DeleteCostRecommendationCustomRule" enabled + And new "DeleteCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Delete a cost recommendation custom rule returns "Not Found" response + Given operation "DeleteCostRecommendationCustomRule" enabled + And new "DeleteCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Delete a cost recommendation notification rule returns "Bad Request" response + Given operation "DeleteCostRecommendationNotificationRule" enabled + And new "DeleteCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Delete a cost recommendation notification rule returns "No Content" response + Given operation "DeleteCostRecommendationNotificationRule" enabled + And new "DeleteCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Delete a cost recommendation notification rule returns "Not Found" response + Given operation "DeleteCostRecommendationNotificationRule" enabled + And new "DeleteCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:ddoghq/ccm-roi Scenario: Delete a unit cost returns "Bad Request" response Given operation "DeleteUnitCost" enabled @@ -430,6 +518,54 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Get a cost recommendation custom rule returns "Bad Request" response + Given operation "GetCostRecommendationCustomRule" enabled + And new "GetCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Get a cost recommendation custom rule returns "Not Found" response + Given operation "GetCostRecommendationCustomRule" enabled + And new "GetCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Get a cost recommendation custom rule returns "OK" response + Given operation "GetCostRecommendationCustomRule" enabled + And new "GetCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Get a cost recommendation notification rule returns "Bad Request" response + Given operation "GetCostRecommendationNotificationRule" enabled + And new "GetCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Get a cost recommendation notification rule returns "Not Found" response + Given operation "GetCostRecommendationNotificationRule" enabled + And new "GetCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Get a cost recommendation notification rule returns "OK" response + Given operation "GetCostRecommendationNotificationRule" enabled + And new "GetCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @replay-only @team:ddoghq/cloud-cost-management Scenario: Get a tag pipeline ruleset returns "OK" response Given new "GetTagPipelinesRuleset" request @@ -977,6 +1113,20 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/ccm-optimize + Scenario: List cost recommendation custom rules returns "OK" response + Given operation "ListCostRecommendationCustomRules" enabled + And new "ListCostRecommendationCustomRules" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: List cost recommendation notification rules returns "OK" response + Given operation "ListCostRecommendationNotificationRules" enabled + And new "ListCostRecommendationNotificationRules" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/cloud-cost-management Scenario: List custom allocation rule statuses returns "OK" response Given new "ListCustomAllocationRulesStatus" request @@ -1125,6 +1275,69 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data.attributes.account_id" is equal to "123456_A123BC_12AB34" + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Update a cost recommendation custom rule returns "Bad Request" response + Given operation "UpdateCostRecommendationCustomRule" enabled + And new "UpdateCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": false, "filters": [{"filter_type": "is", "tag": "env", "values": ["staging"]}], "name": "Staging and development instances", "notes": "Staging instances can run with less headroom.", "settings": {"lookback_days": 14, "max_cpu_user_limit": 0.05}}, "id": "8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b", "type": "custom_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Update a cost recommendation custom rule returns "Not Found" response + Given operation "UpdateCostRecommendationCustomRule" enabled + And new "UpdateCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": false, "filters": [{"filter_type": "is", "tag": "env", "values": ["staging"]}], "name": "Staging and development instances", "notes": "Staging instances can run with less headroom.", "settings": {"lookback_days": 14, "max_cpu_user_limit": 0.05}}, "id": "8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b", "type": "custom_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Update a cost recommendation custom rule returns "OK" response + Given operation "UpdateCostRecommendationCustomRule" enabled + And new "UpdateCostRecommendationCustomRule" request + And request contains "custom_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": false, "filters": [{"filter_type": "is", "tag": "env", "values": ["staging"]}], "name": "Staging and development instances", "notes": "Staging instances can run with less headroom.", "settings": {"lookback_days": 14, "max_cpu_user_limit": 0.05}}, "id": "8a1b6f3e-2c4d-4e5f-9a7b-1c2d3e4f5a6b", "type": "custom_rules"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Update a cost recommendation notification rule returns "Bad Request" response + Given operation "UpdateCostRecommendationNotificationRule" enabled + And new "UpdateCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "C0456ABCD", "destination_type": "slack", "enabled": false, "frequency": "weekly", "interval_execution_date": "2026-11-02", "interval_execution_time": "09:30", "mention_targets": ["U01ABCDE"], "message_customization": {"actions": {"view_in_ccm": {"bulk": true, "per_rec": true}}, "header": {"custom_text": "{{ rec_count }} recommendations to review this week.", "notification_name": true, "total_savings": true}, "include_tags": ["team"], "mode": "structured", "per_rec": {"effort": true, "risk": true, "why": true}}, "name": "Production recommendations", "scope_query": "service:api AND env:prod", "timezone": "America/New_York", "weekly_execution_day": "monday", "weekly_execution_time": "09:30", "workspace_id": "T0123ABCD"}, "id": "2c59b248-6a91-4f95-972a-dc236cae9cbb", "type": "notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Update a cost recommendation notification rule returns "Conflict" response + Given operation "UpdateCostRecommendationNotificationRule" enabled + And new "UpdateCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "C0456ABCD", "destination_type": "slack", "enabled": false, "frequency": "weekly", "interval_execution_date": "2026-11-02", "interval_execution_time": "09:30", "mention_targets": ["U01ABCDE"], "message_customization": {"actions": {"view_in_ccm": {"bulk": true, "per_rec": true}}, "header": {"custom_text": "{{ rec_count }} recommendations to review this week.", "notification_name": true, "total_savings": true}, "include_tags": ["team"], "mode": "structured", "per_rec": {"effort": true, "risk": true, "why": true}}, "name": "Production recommendations", "scope_query": "service:api AND env:prod", "timezone": "America/New_York", "weekly_execution_day": "monday", "weekly_execution_time": "09:30", "workspace_id": "T0123ABCD"}, "id": "2c59b248-6a91-4f95-972a-dc236cae9cbb", "type": "notification_rules"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Update a cost recommendation notification rule returns "Not Found" response + Given operation "UpdateCostRecommendationNotificationRule" enabled + And new "UpdateCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "C0456ABCD", "destination_type": "slack", "enabled": false, "frequency": "weekly", "interval_execution_date": "2026-11-02", "interval_execution_time": "09:30", "mention_targets": ["U01ABCDE"], "message_customization": {"actions": {"view_in_ccm": {"bulk": true, "per_rec": true}}, "header": {"custom_text": "{{ rec_count }} recommendations to review this week.", "notification_name": true, "total_savings": true}, "include_tags": ["team"], "mode": "structured", "per_rec": {"effort": true, "risk": true, "why": true}}, "name": "Production recommendations", "scope_query": "service:api AND env:prod", "timezone": "America/New_York", "weekly_execution_day": "monday", "weekly_execution_time": "09:30", "workspace_id": "T0123ABCD"}, "id": "2c59b248-6a91-4f95-972a-dc236cae9cbb", "type": "notification_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/ccm-optimize + Scenario: Update a cost recommendation notification rule returns "OK" response + Given operation "UpdateCostRecommendationNotificationRule" enabled + And new "UpdateCostRecommendationNotificationRule" request + And request contains "notification_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"channel_id": "C0456ABCD", "destination_type": "slack", "enabled": false, "frequency": "weekly", "interval_execution_date": "2026-11-02", "interval_execution_time": "09:30", "mention_targets": ["U01ABCDE"], "message_customization": {"actions": {"view_in_ccm": {"bulk": true, "per_rec": true}}, "header": {"custom_text": "{{ rec_count }} recommendations to review this week.", "notification_name": true, "total_savings": true}, "include_tags": ["team"], "mode": "structured", "per_rec": {"effort": true, "risk": true, "why": true}}, "name": "Production recommendations", "scope_query": "service:api AND env:prod", "timezone": "America/New_York", "weekly_execution_day": "monday", "weekly_execution_time": "09:30", "workspace_id": "T0123ABCD"}, "id": "2c59b248-6a91-4f95-972a-dc236cae9cbb", "type": "notification_rules"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/ccm-roi Scenario: Update a unit cost returns "Bad Request" response Given operation "UpdateUnitCost" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index fb7afa5fc4..b98916014e 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1999,6 +1999,80 @@ "type": "safe" } }, + "ListCostRecommendationCustomRules": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "CreateCostRecommendationCustomRule": { + "tag": "Cloud Cost Management", + "undo": { + "operationId": "DeleteCostRecommendationCustomRule", + "parameters": [ + { + "name": "custom_rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteCostRecommendationCustomRule": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "GetCostRecommendationCustomRule": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "UpdateCostRecommendationCustomRule": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "ListCostRecommendationNotificationRules": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "CreateCostRecommendationNotificationRule": { + "tag": "Cloud Cost Management", + "undo": { + "operationId": "DeleteCostRecommendationNotificationRule", + "parameters": [ + { + "name": "notification_rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteCostRecommendationNotificationRule": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "GetCostRecommendationNotificationRule": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "UpdateCostRecommendationNotificationRule": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, "ListCostTagDescriptions": { "tag": "Cloud Cost Management", "undo": {