зеркало из https://github.com/Azure/ARO-RP.git
add a bool to disable these api endpoints from replying right now
This commit is contained in:
Родитель
2d076a8242
Коммит
b2b82743fb
|
@ -19,6 +19,11 @@ func (f *frontend) deleteClusterManagerConfiguration(w http.ResponseWriter, r *h
|
|||
ctx := r.Context()
|
||||
log := ctx.Value(middleware.ContextKeyLog).(*logrus.Entry)
|
||||
|
||||
if DISABLEOCMAPI {
|
||||
reply(log, w, nil, []byte("forbidden."), api.NewCloudError(http.StatusForbidden, api.CloudErrorCodeForbidden, "", "forbidden."))
|
||||
return
|
||||
}
|
||||
|
||||
err := f._deleteClusterManagerConfiguration(ctx, log, r)
|
||||
switch {
|
||||
case cosmosdb.IsErrorStatusCode(err, http.StatusNotFound):
|
||||
|
|
|
@ -21,6 +21,11 @@ func (f *frontend) getClusterManagerConfiguration(w http.ResponseWriter, r *http
|
|||
log := ctx.Value(middleware.ContextKeyLog).(*logrus.Entry)
|
||||
vars := mux.Vars(r)
|
||||
|
||||
if DISABLEOCMAPI {
|
||||
reply(log, w, nil, []byte("forbidden."), api.NewCloudError(http.StatusForbidden, api.CloudErrorCodeForbidden, "", "forbidden."))
|
||||
return
|
||||
}
|
||||
|
||||
b, err := f._getClusterManagerConfiguration(ctx, log, r, f.apis[vars["api-version"]].ClusterManagerConfigurationConverter())
|
||||
reply(log, w, nil, b, err)
|
||||
}
|
||||
|
|
|
@ -22,9 +22,14 @@ func (f *frontend) putOrPatchClusterManagerConfiguration(w http.ResponseWriter,
|
|||
ctx := r.Context()
|
||||
log := ctx.Value(middleware.ContextKeyLog).(*logrus.Entry)
|
||||
vars := mux.Vars(r)
|
||||
|
||||
var header http.Header
|
||||
var b []byte
|
||||
|
||||
if DISABLEOCMAPI {
|
||||
reply(log, w, nil, []byte("forbidden."), api.NewCloudError(http.StatusForbidden, api.CloudErrorCodeForbidden, "", "forbidden."))
|
||||
return
|
||||
}
|
||||
|
||||
err := cosmosdb.RetryOnPreconditionFailed(func() error {
|
||||
var err error
|
||||
b, err = f._putOrPatchClusterManagerConfiguration(ctx, log, r, &header, f.apis[vars["api-version"]].ClusterManagerConfigurationConverter())
|
||||
|
|
|
@ -32,6 +32,8 @@ import (
|
|||
"github.com/Azure/ARO-RP/pkg/util/recover"
|
||||
)
|
||||
|
||||
const DISABLEOCMAPI = true
|
||||
|
||||
type statusCodeError int
|
||||
|
||||
func (err statusCodeError) Error() string {
|
||||
|
|
Загрузка…
Ссылка в новой задаче