Skip to content
Open
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,47 @@
package dataworkarounds

import (
"fmt"

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

var _ workaround = workaroundResources29885{}

// workaroundResources29885 converts the `PrivateEndpointConnections` property from a string to an interface - this can be removed once
// https://github.com/Azure/azure-rest-api-specs/issues/29885 has been fixed
type workaroundResources29885 struct{}

func (workaroundResources29885) IsApplicable(serviceName string, apiVersion sdkModels.APIVersion) bool {
return serviceName == "Resources" && apiVersion.APIVersion == "2020-05-01"
}

func (workaroundResources29885) Name() string {
return "Resources / 29885"
}

func (workaroundResources29885) Process(input sdkModels.APIVersion) (*sdkModels.APIVersion, error) {
resource, ok := input.Resources["ResourceManagementPrivateLink"]
if !ok {
return nil, fmt.Errorf("expected a Resource named `ResourceManagementPrivateLink` but didn't get one")
}

model, ok := resource.Models["ResourceManagementPrivateLinkEndpointConnections"]
if !ok {
return nil, fmt.Errorf("couldn't find Model `ResourceManagementPrivateLinkEndpointConnections`")
}

field, ok := model.Fields["PrivateEndpointConnections"]
if !ok {
return nil, fmt.Errorf("couldn't find the field `PrivateEndpointConnections` in model `ResourceManagementPrivateLinkEndpointConnections`")
}
if field.ObjectDefinition.NestedItem != nil {
field.ObjectDefinition.NestedItem.Type = sdkModels.RawObjectSDKObjectDefinitionType
}

model.Fields["PrivateEndpointConnections"] = field
resource.Models["ResourceManagementPrivateLinkEndpointConnections"] = model
input.Resources["ResourceManagementPrivateLink"] = resource

return &input, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var workarounds = []workaround{
workaroundOperationalinsights27524{},
workaroundRecoveryServicesSiteRecovery26680{},
workaroundRedis22407{},
workaroundResources29885{},
workaroundSql33215{},
workaroundStorageCache32537{},
workaroundStreamAnalytics27577{},
Expand Down
Loading