Adds exported APIVersion constants to API packages

This commit is contained in:
Mikalai Radchuk 2020-02-06 12:23:35 +00:00
Родитель 726c1b0784
Коммит a5cf880ca2
3 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -7,13 +7,16 @@ import (
"github.com/Azure/ARO-RP/pkg/api"
)
// APIVersion contains a version string as it will be used by clients
const APIVersion = "admin"
const (
resourceProviderNamespace = "Microsoft.RedHatOpenShift"
resourceType = "openShiftClusters"
)
func init() {
api.APIs["admin"] = &api.Version{
api.APIs[APIVersion] = &api.Version{
OpenShiftClusterConverter: func() api.OpenShiftClusterConverter {
return &openShiftClusterConverter{}
},

Просмотреть файл

@ -7,13 +7,16 @@ import (
"github.com/Azure/ARO-RP/pkg/api"
)
// APIVersion contains a version string as it will be used by clients
const APIVersion = "2019-12-31-preview"
const (
resourceProviderNamespace = "Microsoft.RedHatOpenShift"
resourceType = "openShiftClusters"
)
func init() {
api.APIs["2019-12-31-preview"] = &api.Version{
api.APIs[APIVersion] = &api.Version{
OpenShiftClusterConverter: func() api.OpenShiftClusterConverter {
return &openShiftClusterConverter{}
},

Просмотреть файл

@ -17,6 +17,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/Azure/ARO-RP/pkg/api"
"github.com/Azure/ARO-RP/pkg/api/admin"
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
"github.com/Azure/ARO-RP/pkg/frontend/middleware"
)
@ -142,7 +143,7 @@ func (f *frontend) _putOrPatchOpenShiftCluster(ctx context.Context, r *http.Requ
} else {
// TODO: Get rid of the special case
vars := mux.Vars(r)
if vars["api-version"] == "admin" {
if vars["api-version"] == admin.APIVersion {
doc.OpenShiftCluster.Properties.ProvisioningState = api.ProvisioningStateAdminUpdating
} else {
doc.OpenShiftCluster.Properties.ProvisioningState = api.ProvisioningStateUpdating