Repository navigation
feat(azure/savingsplans): implement Savings Plan recommendations from benefitRecommendations - #373
Merged
Merged
Conversation
… from benefitRecommendations Replaces the empty stub with Shared-scope recommendations at subscription scope (Cost Management benefitRecommendations, api-version 2024-08-01). Honours params.Term and params.LookbackPeriod, follows nextLink to the ARM host only, and fails loud on unknown values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
…, address review Send Last7Days when no lookback is given (never rely on the API default), use recommendations.DaysPerMonth for the monthly scale, reuse ParseTermYears, drop the redundant loop guard (page cap covers it, now tested), test the https check, and fix the misspell lint finding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Independent review (claude-opus-5-5) of 1ccf620: APPROVE Re-review after my block of 05ff804 (lint failure). Review only. Source of truth: Benefit Recommendations - List, api-version 2024-08-01 (learn.microsoft.com/rest/api/cost-management/benefit-recommendations/list?view=rest-cost-management-2024-08-01).
Claims verified at this head:
Evidence (local, fresh clone, macOS):
Non-blocking:
Known and out of scope: Advisor SP duplicates (handled in #378), the purchase path's |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #371
Implements
savingsplans.Client.GetRecommendationswith Cost Management Benefit Recommendations - List, api-version 2024-08-01 (subscription scope,properties/scope eq 'Shared'). Design and mapping are in #371. Honoursparams.Termandparams.LookbackPeriod; no new params.Mapping: hourly =
commitmentAmount;RecurringMonthlyCost= hourly x 730;CommitmentCost0; PaymentOptionmonthly; savings and on-demand cost scaled fromtotalHoursto 730 h; term P1Y/P3Y. Unknown kind/sku/scope/term/granularity/currency, or a missing number, returns an error;nextLinkis followed only on https management.azure.com.Evidence (fixture-based; live probe
az reston the test subscription returned HTTP 200{"value": []}):TestGetRecommendations_MapsRow,_EmptyTermRequestsBoth,_Paginationfail with"[]" should have N item(s), but has 0;_RejectsForeignNextLinkand_SelfReferentialNextLinkfail withAn error is expected but got nil.go test ./services/savingsplans/ ./ok;GOWORK=off go build ./...ok; pre-commit hooks (vet, gocyclo, gosec) pass. golangci-lint panics in this environment (tool crash, not a finding).Not in this PR: the one-line guard flag in
providers/azure/recommendations.go(owned by azure-advisor-consumption). It is a separate local commit (lines ~188-192 and ~230-237), to be sequenced after their PR.Deferred:
PlanTypeis "Compute" (matchesGetValidResourceTypes), but PurchaseCommitment sends it assku.name, where the API expectsCompute_Savings_Plan. Advisor's SavingsPlan rows may duplicate these.🤖 Generated with Claude Code
Summary by CodeRabbit