mirror of
https://github.com/paralus/paralus.git
synced 2026-05-06 16:36:46 +00:00
* restructure rcloud-base as a single base controller * updated master.rest * moved sentry from internal to pkg as it is used by relay * removing unused rpc and it's dependencies * Fix usermgmt tests * Don't redefine variables in rest file Co-authored-by: Abin Simon <abin.simon@rafay.co>
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package gateway
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
"github.com/segmentio/encoding/json"
|
|
)
|
|
|
|
const (
|
|
jsonContentType string = "application/json"
|
|
)
|
|
|
|
// rafayJSON is the rafay object to json marshaller
|
|
type rafayJSON struct {
|
|
}
|
|
|
|
// NewRafayJSON returns new grpc gateway rafay json marshaller
|
|
func NewRafayJSON() runtime.Marshaler {
|
|
return &rafayJSON{}
|
|
}
|
|
|
|
// Marshal marshals "v" into byte sequence.
|
|
func (m *rafayJSON) Marshal(v interface{}) ([]byte, error) {
|
|
|
|
return json.Marshal(v)
|
|
}
|
|
|
|
// Unmarshal unmarshals "data" into "v".
|
|
// "v" must be a pointer value.
|
|
func (m *rafayJSON) Unmarshal(b []byte, v interface{}) error {
|
|
return json.Unmarshal(b, v)
|
|
}
|
|
|
|
// NewDecoder returns a Decoder which reads byte sequence from "r".
|
|
func (m *rafayJSON) NewDecoder(r io.Reader) runtime.Decoder {
|
|
return json.NewDecoder(r)
|
|
}
|
|
|
|
// NewEncoder returns an Encoder which writes bytes sequence into "w".
|
|
func (m *rafayJSON) NewEncoder(w io.Writer) runtime.Encoder {
|
|
return json.NewEncoder(w)
|
|
|
|
}
|
|
|
|
// ContentType returns the Content-Type which this marshaler is responsible for.
|
|
func (m *rafayJSON) ContentType(v interface{}) string {
|
|
return jsonContentType
|
|
}
|