Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package dataworkarounds

import (
"errors"
"fmt"

sdkModels "github.com/hashicorp/pandora/tools/data-api-sdk/v1/models"
)

var _ workaround = workaroundManagedDevopsPools40905{}

// workaroundManagedDevopsPools40905 works around the wrong identity type.
// Swagger PR: https://github.com/Azure/azure-rest-api-specs/pull/40905
type workaroundManagedDevopsPools40905 struct{}

func (workaroundManagedDevopsPools40905) IsApplicable(serviceName string, apiVersion sdkModels.APIVersion) bool {
return serviceName == "DevOpsInfrastructure" && (apiVersion.APIVersion == "2025-01-21" || apiVersion.APIVersion == "2025-09-20")
}

func (workaroundManagedDevopsPools40905) Name() string {
return "ManagedDevopsPools / 40905"
}

func (workaroundManagedDevopsPools40905) Process(input sdkModels.APIVersion) (*sdkModels.APIVersion, error) {
resource, ok := input.Resources["Pools"]
if !ok {
return nil, errors.New("expected a resource named `Pools` but didn't get one")
}

models := []string{
"Pool",
"PoolUpdate",
}

for _, modelName := range models {
model, ok := resource.Models[modelName]
if !ok {
return nil, fmt.Errorf("couldn't find model `%s`", modelName)
}

identityField, ok := model.Fields["Identity"]
if !ok {
return nil, fmt.Errorf("couldn't find the field `Identity` within model `%s`", modelName)
}

identityField.ObjectDefinition.Type = sdkModels.UserAssignedIdentityMapSDKObjectDefinitionType
identityField.ObjectDefinition.ReferenceName = nil

model.Fields["Identity"] = identityField
resource.Models[modelName] = model
}

input.Resources["Pools"] = resource

return &input, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var workarounds = []workaround{
workaroundLoadTest20961{},
workaroundMachineLearning25142{},
workaroundMachineLearning40149{},
workaroundManagedDevopsPools40905{},
workaroundMongoCluster38810{},
workaroundNetwork29303{},
workaroundNetwork38407{},
Expand Down
Loading