get_credentials_ce.go 772 B

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