Skip to content

fix(providers/azure): use SDK enum constant for appliedScopeType in purchase bodies #14

Description

@cristim

Context

During adversarial review of PR LeanerCloud/cloud-commitments-cli#1208, all Azure service clients were found to use `"Shared"` as a raw string literal for the `appliedScopeType` field in reservation purchase request bodies.

The Azure SDK defines a typed enum for this:

```go
armreservations.AppliedScopeTypeShared // = "Shared"
armreservations.AppliedScopeTypeSingle // = "Single"
```

Files affected

All service clients that build a purchase request body:

  • `providers/azure/services/cache/client.go`
  • `providers/azure/services/compute/client.go`
  • `providers/azure/services/cosmosdb/client.go`
  • `providers/azure/services/database/client.go`
  • `providers/azure/services/managedredis/client.go`
  • `providers/azure/services/search/client.go`
  • `providers/azure/services/synapse/client.go`

Fix

Replace `"appliedScopeType": "Shared"` with `"appliedScopeType": string(armreservations.AppliedScopeTypeShared)` in each client's `PurchaseCommitment` method (7 occurrences, one per service).

Note

This is a code-quality / forward-safety improvement only. The current literal `"Shared"` is the correct value and matches the SDK constant; there is no live bug here. The risk is that a typo in a future edit would not be caught at compile time.

This is a follow-up to PR LeanerCloud/cloud-commitments-cli#1208 which fixed the higher-priority `reservedResourceType` enum correctness bugs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions