diff --git a/tools/importer-rest-api-specs/components/parser/dataworkarounds/workaround_automation_25435.go b/tools/importer-rest-api-specs/components/parser/dataworkarounds/workaround_automation_25435.go new file mode 100644 index 00000000000..0a3cc1e13d5 --- /dev/null +++ b/tools/importer-rest-api-specs/components/parser/dataworkarounds/workaround_automation_25435.go @@ -0,0 +1,39 @@ +package dataworkarounds + +import ( + "fmt" + + "github.com/hashicorp/pandora/tools/importer-rest-api-specs/models" +) + +var _ workaround = workaroundAutomation25435{} + +// workaround for https://github.com/Azure/azure-rest-api-specs/pull/25435 +// this is a workaround for the fact that the `CreateOrUpdate` operation for `Python3Package` is not marked as `LongRunning` +type workaroundAutomation25435 struct { +} + +func (workaroundAutomation25435) IsApplicable(apiDefinition *models.AzureApiDefinition) bool { + return apiDefinition.ServiceName == "Automation" && apiDefinition.ApiVersion == "2022-08-08" +} + +func (workaroundAutomation25435) Name() string { + return "Automation / 25434" +} + +func (workaroundAutomation25435) Process(apiDefinition models.AzureApiDefinition) (*models.AzureApiDefinition, error) { + resource, ok := apiDefinition.Resources["Python3Package"] + if !ok { + return nil, fmt.Errorf("expected a Resource named `Python3Package`") + } + operation, ok := resource.Operations["CreateOrUpdate"] + if !ok { + return nil, fmt.Errorf("expected an Operation named `CreateOrUpdate` for `Python3Package`") + } + + operation.LongRunning = true + resource.Operations["CreateOrUpdate"] = operation + apiDefinition.Resources["Python3Package"] = resource + + return &apiDefinition, nil +} diff --git a/tools/importer-rest-api-specs/components/parser/dataworkarounds/workarounds.go b/tools/importer-rest-api-specs/components/parser/dataworkarounds/workarounds.go index 7bd7f792719..44b9475663b 100644 --- a/tools/importer-rest-api-specs/components/parser/dataworkarounds/workarounds.go +++ b/tools/importer-rest-api-specs/components/parser/dataworkarounds/workarounds.go @@ -11,6 +11,7 @@ var workarounds = []workaround{ workaroundAuthorization25080{}, workaroundDigitalTwins25120{}, workaroundAutomation25108{}, + workaroundAutomation25435{}, workaroundBatch21291{}, workaroundContainerService21394{}, workaroundDataFactory23013{},