2020-11-13 13:40:00 +00:00
|
|
|
package session
|
|
|
|
|
|
|
|
import (
|
2023-03-07 10:38:56 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
|
|
|
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
|
2020-11-13 13:40:00 +00:00
|
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *ObjectSessionContext) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(c)
|
2020-11-13 13:40:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ObjectSessionContext) UnmarshalJSON(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.UnmarshalJSON(c, data, new(session.ObjectSessionContext))
|
2020-11-13 13:40:00 +00:00
|
|
|
}
|
2020-11-13 13:43:54 +00:00
|
|
|
|
|
|
|
func (l *TokenLifetime) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(l)
|
2020-11-13 13:43:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *TokenLifetime) UnmarshalJSON(data []byte) error {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.UnmarshalJSON(l, data, new(session.SessionToken_Body_TokenLifetime))
|
2020-11-13 13:43:54 +00:00
|
|
|
}
|
2020-11-13 13:49:46 +00:00
|
|
|
|
2022-02-25 07:36:46 +00:00
|
|
|
func (t *TokenBody) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(t)
|
2020-11-13 13:49:46 +00:00
|
|
|
}
|
|
|
|
|
2022-02-25 07:36:46 +00:00
|
|
|
func (t *TokenBody) UnmarshalJSON(data []byte) error {
|
2020-11-13 13:49:46 +00:00
|
|
|
msg := new(session.SessionToken_Body)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return t.FromGRPCMessage(msg)
|
2020-11-13 13:49:46 +00:00
|
|
|
}
|
2020-11-13 13:53:42 +00:00
|
|
|
|
2022-02-25 07:36:46 +00:00
|
|
|
func (t *Token) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(t)
|
2020-11-13 13:53:42 +00:00
|
|
|
}
|
|
|
|
|
2022-02-25 07:36:46 +00:00
|
|
|
func (t *Token) UnmarshalJSON(data []byte) error {
|
2020-11-13 13:53:42 +00:00
|
|
|
msg := new(session.SessionToken)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return t.FromGRPCMessage(msg)
|
2020-11-13 13:53:42 +00:00
|
|
|
}
|
2020-11-13 13:58:08 +00:00
|
|
|
|
|
|
|
func (x *XHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(x)
|
2020-11-13 13:58:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (x *XHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.XHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return x.FromGRPCMessage(msg)
|
2020-11-13 13:58:08 +00:00
|
|
|
}
|
2020-11-13 14:02:30 +00:00
|
|
|
|
|
|
|
func (r *RequestMetaHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(r)
|
2020-11-13 14:02:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *RequestMetaHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.RequestMetaHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return r.FromGRPCMessage(msg)
|
2020-11-13 14:02:30 +00:00
|
|
|
}
|
2020-11-13 14:07:49 +00:00
|
|
|
|
|
|
|
func (r *RequestVerificationHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(r)
|
2020-11-13 14:07:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *RequestVerificationHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.RequestVerificationHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return r.FromGRPCMessage(msg)
|
2020-11-13 14:07:49 +00:00
|
|
|
}
|
2020-11-13 14:11:09 +00:00
|
|
|
|
|
|
|
func (r *ResponseMetaHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(r)
|
2020-11-13 14:11:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *ResponseMetaHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.ResponseMetaHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return r.FromGRPCMessage(msg)
|
2020-11-13 14:11:09 +00:00
|
|
|
}
|
2020-11-13 14:14:43 +00:00
|
|
|
|
|
|
|
func (r *ResponseVerificationHeader) MarshalJSON() ([]byte, error) {
|
2021-03-12 12:57:23 +00:00
|
|
|
return message.MarshalJSON(r)
|
2020-11-13 14:14:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (r *ResponseVerificationHeader) UnmarshalJSON(data []byte) error {
|
|
|
|
msg := new(session.ResponseVerificationHeader)
|
|
|
|
|
|
|
|
if err := protojson.Unmarshal(data, msg); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
return r.FromGRPCMessage(msg)
|
2020-11-13 14:14:43 +00:00
|
|
|
}
|
2021-05-24 14:46:39 +00:00
|
|
|
|
|
|
|
func (x *ContainerSessionContext) MarshalJSON() ([]byte, error) {
|
|
|
|
return message.MarshalJSON(x)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *ContainerSessionContext) UnmarshalJSON(data []byte) error {
|
|
|
|
return message.UnmarshalJSON(x, data, new(session.ContainerSessionContext))
|
|
|
|
}
|