Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataworkaround: add workaround for datafactory 27816 #4668

Merged
merged 2 commits into from
Feb 13, 2025
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,51 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package dataworkarounds

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

var _ workaround = workaroundDataFactory27816{}

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

func (workaroundDataFactory27816) IsApplicable(serviceName string, apiVersion sdkModels.APIVersion) bool {
return serviceName == "DataFactory" && apiVersion.APIVersion == "2018-06-01"
}

func (workaroundDataFactory27816) Name() string {
return "DataFactory / 27816"
}

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

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

field, ok := model.Fields["Headers"]
if !ok {
return nil, fmt.Errorf("couldn't find Field `Headers`")
}

if field.ObjectDefinition.NestedItem != nil {
field.ObjectDefinition.NestedItem.Type = sdkModels.RawObjectSDKObjectDefinitionType
}

model.Fields["Headers"] = field
resource.Models["WebActivityTypeProperties"] = model
input.Resources["Pipelines"] = resource

return &input, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var workarounds = []workaround{
workaroundContainerRegistry32154{},
workaroundContainerService21394{},
workaroundDataFactory23013{},
workaroundDataFactory27816{},
workaroundDataMigration31001{},
workaroundDigitalTwins25120{},
workaroundHDInsight26838{},
Expand Down
Loading