get_credentials_ce.go 757 B

1234567891011121314151617181920212223242526272829303132
  1. // +build !ee
  2. package credentials
  3. import (
  4. "fmt"
  5. "net/http"
  6. "github.com/porter-dev/porter/api/server/shared/apierrors"
  7. "github.com/porter-dev/porter/provisioner/server/config"
  8. "github.com/porter-dev/porter/api/types"
  9. )
  10. type GetCredentialsHandler struct {
  11. config *config.Config
  12. }
  13. func NewCredentialsGetHandler(
  14. config *config.Config,
  15. ) http.Handler {
  16. return &GetCredentialsHandler{config}
  17. }
  18. func (u *GetCredentialsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
  19. apierrors.HandleAPIError(u.config.Logger, u.config.Alerter, w, r, apierrors.NewErrPassThroughToClient(
  20. fmt.Errorf("get_credentials not available in community edition"),
  21. http.StatusBadRequest,
  22. ), true, apierrors.ErrorOpts{
  23. Code: types.ErrCodeUnavailable,
  24. })
  25. }