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

automation:add new workaround for automation python3package lro #2967

Merged
merged 2 commits into from
Aug 23, 2023
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,39 @@
package dataworkarounds

import (
"fmt"

"github.com/hashicorp/pandora/tools/importer-rest-api-specs/models"
)

var _ workaround = workaroundAutomation25435{}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a link to the issue here as well as a brief summary on the issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added.

// 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
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var workarounds = []workaround{
workaroundAuthorization25080{},
workaroundDigitalTwins25120{},
workaroundAutomation25108{},
workaroundAutomation25435{},
workaroundBatch21291{},
workaroundContainerService21394{},
workaroundDataFactory23013{},
Expand Down