-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workaround for machine learning registry status code
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...rter-rest-api-specs/components/parser/dataworkarounds/workaround_machinelearning_25142.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package dataworkarounds | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
|
||
"github.com/hashicorp/pandora/tools/importer-rest-api-specs/models" | ||
) | ||
|
||
var _ workaround = workaroundMachineLearning25142{} | ||
|
||
// workaroundMachineLearning25142 works around the missed 202 status code. | ||
// Swagger PR: https://github.com/Azure/azure-rest-api-specs/pull/25142 | ||
type workaroundMachineLearning25142 struct { | ||
} | ||
|
||
func (workaroundMachineLearning25142) IsApplicable(apiDefinition *models.AzureApiDefinition) bool { | ||
serviceMatches := apiDefinition.ServiceName == "MachineLearningServices" | ||
apiVersionMatches := apiDefinition.ApiVersion == "2023-04-01" | ||
return serviceMatches && apiVersionMatches | ||
} | ||
|
||
func (workaroundMachineLearning25142) Name() string { | ||
return "MachineLearningServices / 25142" | ||
} | ||
|
||
func (workaroundMachineLearning25142) Process(apiDefinition models.AzureApiDefinition) (*models.AzureApiDefinition, error) { | ||
resource, ok := apiDefinition.Resources["RegistryManagement"] | ||
if !ok { | ||
return nil, fmt.Errorf("couldn't find API Resource MachineLearningServices") | ||
} | ||
|
||
operation, ok := resource.Operations["RegistriesCreateOrUpdate"] | ||
if !ok { | ||
return nil, fmt.Errorf("couldn't find Operation RegistriesCreateOrUpdate") | ||
} | ||
|
||
operation.ExpectedStatusCodes = append(operation.ExpectedStatusCodes, http.StatusAccepted) | ||
resource.Operations["RegistriesCreateOrUpdate"] = operation | ||
|
||
apiDefinition.Resources["RegistryManagement"] = resource | ||
return &apiDefinition, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters