// Code generated by protoc-gen-go-frostfs. DO NOT EDIT. package session import ( json "encoding/json" fmt "fmt" grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool" proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding" easyproto "github.com/VictoriaMetrics/easyproto" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" strconv "strconv" ) type CreateRequest_Body struct { OwnerId *grpc.OwnerID `json:"ownerId"` Expiration uint64 `json:"expiration"` } var ( _ encoding.ProtoMarshaler = (*CreateRequest_Body)(nil) _ encoding.ProtoUnmarshaler = (*CreateRequest_Body)(nil) _ json.Marshaler = (*CreateRequest_Body)(nil) _ json.Unmarshaler = (*CreateRequest_Body)(nil) ) // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *CreateRequest_Body) StableSize() (size int) { if x == nil { return 0 } size += proto.NestedStructureSize(1, x.OwnerId) size += proto.UInt64Size(2, x.Expiration) return size } // MarshalProtobuf implements the encoding.ProtoMarshaler interface. func (x *CreateRequest_Body) MarshalProtobuf(dst []byte) []byte { m := pool.MarshalerPool.Get() defer pool.MarshalerPool.Put(m) x.EmitProtobuf(m.MessageMarshaler()) dst = m.Marshal(dst) return dst } func (x *CreateRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } if x.OwnerId != nil { x.OwnerId.EmitProtobuf(mm.AppendMessage(1)) } if x.Expiration != 0 { mm.AppendUint64(2, x.Expiration) } } // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. func (x *CreateRequest_Body) UnmarshalProtobuf(src []byte) (err error) { var fc easyproto.FieldContext for len(src) > 0 { src, err = fc.NextField(src) if err != nil { return fmt.Errorf("cannot read next field in %s", "CreateRequest_Body") } switch fc.FieldNum { case 1: // OwnerId data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "OwnerId") } x.OwnerId = new(grpc.OwnerID) if err := x.OwnerId.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } case 2: // Expiration data, ok := fc.Uint64() if !ok { return fmt.Errorf("cannot unmarshal field %s", "Expiration") } x.Expiration = data } } return nil } func (x *CreateRequest_Body) GetOwnerId() *grpc.OwnerID { if x != nil { return x.OwnerId } return nil } func (x *CreateRequest_Body) SetOwnerId(v *grpc.OwnerID) { x.OwnerId = v } func (x *CreateRequest_Body) GetExpiration() uint64 { if x != nil { return x.Expiration } return 0 } func (x *CreateRequest_Body) SetExpiration(v uint64) { x.Expiration = v } // MarshalJSON implements the json.Marshaler interface. func (x *CreateRequest_Body) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} x.MarshalEasyJSON(&w) return w.Buffer.BuildBytes(), w.Error } func (x *CreateRequest_Body) MarshalEasyJSON(out *jwriter.Writer) { if x == nil { out.RawString("null") return } first := true out.RawByte('{') { if x.OwnerId != nil { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"ownerId\":" out.RawString(prefix) x.OwnerId.MarshalEasyJSON(out) } } { if x.Expiration != 0 { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"expiration\":" out.RawString(prefix) out.RawByte('"') out.Buffer.Buf = strconv.AppendUint(out.Buffer.Buf, x.Expiration, 10) out.RawByte('"') } } out.RawByte('}') } // UnmarshalJSON implements the json.Unmarshaler interface. func (x *CreateRequest_Body) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} x.UnmarshalEasyJSON(&r) return r.Error() } func (x *CreateRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "ownerId": { var f *grpc.OwnerID f = new(grpc.OwnerID) f.UnmarshalEasyJSON(in) x.OwnerId = f } case "expiration": { var f uint64 r := in.JsonNumber() n := r.String() v, err := strconv.ParseUint(n, 10, 64) if err != nil { in.AddError(err) return } pv := uint64(v) f = pv x.Expiration = f } } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } type CreateRequest struct { Body *CreateRequest_Body `json:"body"` MetaHeader *RequestMetaHeader `json:"metaHeader"` VerifyHeader *RequestVerificationHeader `json:"verifyHeader"` } var ( _ encoding.ProtoMarshaler = (*CreateRequest)(nil) _ encoding.ProtoUnmarshaler = (*CreateRequest)(nil) _ json.Marshaler = (*CreateRequest)(nil) _ json.Unmarshaler = (*CreateRequest)(nil) ) // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *CreateRequest) StableSize() (size int) { if x == nil { return 0 } size += proto.NestedStructureSize(1, x.Body) size += proto.NestedStructureSize(2, x.MetaHeader) size += proto.NestedStructureSize(3, x.VerifyHeader) return size } // ReadSignedData fills buf with signed data of x. // If buffer length is less than x.SignedDataSize(), new buffer is allocated. // // Returns any error encountered which did not allow writing the data completely. // Otherwise, returns the buffer in which the data is written. // // Structures with the same field values have the same signed data. func (x *CreateRequest) SignedDataSize() int { return x.GetBody().StableSize() } // SignedDataSize returns size of the request signed data in bytes. // // Structures with the same field values have the same signed data size. func (x *CreateRequest) ReadSignedData(buf []byte) ([]byte, error) { return x.GetBody().MarshalProtobuf(buf), nil } // MarshalProtobuf implements the encoding.ProtoMarshaler interface. func (x *CreateRequest) MarshalProtobuf(dst []byte) []byte { m := pool.MarshalerPool.Get() defer pool.MarshalerPool.Put(m) x.EmitProtobuf(m.MessageMarshaler()) dst = m.Marshal(dst) return dst } func (x *CreateRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. func (x *CreateRequest) UnmarshalProtobuf(src []byte) (err error) { var fc easyproto.FieldContext for len(src) > 0 { src, err = fc.NextField(src) if err != nil { return fmt.Errorf("cannot read next field in %s", "CreateRequest") } switch fc.FieldNum { case 1: // Body data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "Body") } x.Body = new(CreateRequest_Body) if err := x.Body.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } case 2: // MetaHeader data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "MetaHeader") } x.MetaHeader = new(RequestMetaHeader) if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } case 3: // VerifyHeader data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader") } x.VerifyHeader = new(RequestVerificationHeader) if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } } } return nil } func (x *CreateRequest) GetBody() *CreateRequest_Body { if x != nil { return x.Body } return nil } func (x *CreateRequest) SetBody(v *CreateRequest_Body) { x.Body = v } func (x *CreateRequest) GetMetaHeader() *RequestMetaHeader { if x != nil { return x.MetaHeader } return nil } func (x *CreateRequest) SetMetaHeader(v *RequestMetaHeader) { x.MetaHeader = v } func (x *CreateRequest) GetVerifyHeader() *RequestVerificationHeader { if x != nil { return x.VerifyHeader } return nil } func (x *CreateRequest) SetVerifyHeader(v *RequestVerificationHeader) { x.VerifyHeader = v } // MarshalJSON implements the json.Marshaler interface. func (x *CreateRequest) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} x.MarshalEasyJSON(&w) return w.Buffer.BuildBytes(), w.Error } func (x *CreateRequest) MarshalEasyJSON(out *jwriter.Writer) { if x == nil { out.RawString("null") return } first := true out.RawByte('{') { if x.Body != nil { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"body\":" out.RawString(prefix) x.Body.MarshalEasyJSON(out) } } { if x.MetaHeader != nil { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"metaHeader\":" out.RawString(prefix) x.MetaHeader.MarshalEasyJSON(out) } } { if x.VerifyHeader != nil { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"verifyHeader\":" out.RawString(prefix) x.VerifyHeader.MarshalEasyJSON(out) } } out.RawByte('}') } // UnmarshalJSON implements the json.Unmarshaler interface. func (x *CreateRequest) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} x.UnmarshalEasyJSON(&r) return r.Error() } func (x *CreateRequest) UnmarshalEasyJSON(in *jlexer.Lexer) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "body": { var f *CreateRequest_Body f = new(CreateRequest_Body) f.UnmarshalEasyJSON(in) x.Body = f } case "metaHeader": { var f *RequestMetaHeader f = new(RequestMetaHeader) f.UnmarshalEasyJSON(in) x.MetaHeader = f } case "verifyHeader": { var f *RequestVerificationHeader f = new(RequestVerificationHeader) f.UnmarshalEasyJSON(in) x.VerifyHeader = f } } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } type CreateResponse_Body struct { Id []byte `json:"id"` SessionKey []byte `json:"sessionKey"` } var ( _ encoding.ProtoMarshaler = (*CreateResponse_Body)(nil) _ encoding.ProtoUnmarshaler = (*CreateResponse_Body)(nil) _ json.Marshaler = (*CreateResponse_Body)(nil) _ json.Unmarshaler = (*CreateResponse_Body)(nil) ) // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *CreateResponse_Body) StableSize() (size int) { if x == nil { return 0 } size += proto.BytesSize(1, x.Id) size += proto.BytesSize(2, x.SessionKey) return size } // MarshalProtobuf implements the encoding.ProtoMarshaler interface. func (x *CreateResponse_Body) MarshalProtobuf(dst []byte) []byte { m := pool.MarshalerPool.Get() defer pool.MarshalerPool.Put(m) x.EmitProtobuf(m.MessageMarshaler()) dst = m.Marshal(dst) return dst } func (x *CreateResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } if len(x.Id) != 0 { mm.AppendBytes(1, x.Id) } if len(x.SessionKey) != 0 { mm.AppendBytes(2, x.SessionKey) } } // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. func (x *CreateResponse_Body) UnmarshalProtobuf(src []byte) (err error) { var fc easyproto.FieldContext for len(src) > 0 { src, err = fc.NextField(src) if err != nil { return fmt.Errorf("cannot read next field in %s", "CreateResponse_Body") } switch fc.FieldNum { case 1: // Id data, ok := fc.Bytes() if !ok { return fmt.Errorf("cannot unmarshal field %s", "Id") } x.Id = data case 2: // SessionKey data, ok := fc.Bytes() if !ok { return fmt.Errorf("cannot unmarshal field %s", "SessionKey") } x.SessionKey = data } } return nil } func (x *CreateResponse_Body) GetId() []byte { if x != nil { return x.Id } return nil } func (x *CreateResponse_Body) SetId(v []byte) { x.Id = v } func (x *CreateResponse_Body) GetSessionKey() []byte { if x != nil { return x.SessionKey } return nil } func (x *CreateResponse_Body) SetSessionKey(v []byte) { x.SessionKey = v } // MarshalJSON implements the json.Marshaler interface. func (x *CreateResponse_Body) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} x.MarshalEasyJSON(&w) return w.Buffer.BuildBytes(), w.Error } func (x *CreateResponse_Body) MarshalEasyJSON(out *jwriter.Writer) { if x == nil { out.RawString("null") return } first := true out.RawByte('{') { if len(x.Id) != 0 { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"id\":" out.RawString(prefix) out.Base64Bytes(x.Id) } } { if len(x.SessionKey) != 0 { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"sessionKey\":" out.RawString(prefix) out.Base64Bytes(x.SessionKey) } } out.RawByte('}') } // UnmarshalJSON implements the json.Unmarshaler interface. func (x *CreateResponse_Body) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} x.UnmarshalEasyJSON(&r) return r.Error() } func (x *CreateResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "id": { var f []byte f = in.Bytes() x.Id = f } case "sessionKey": { var f []byte f = in.Bytes() x.SessionKey = f } } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } type CreateResponse struct { Body *CreateResponse_Body `json:"body"` MetaHeader *ResponseMetaHeader `json:"metaHeader"` VerifyHeader *ResponseVerificationHeader `json:"verifyHeader"` } var ( _ encoding.ProtoMarshaler = (*CreateResponse)(nil) _ encoding.ProtoUnmarshaler = (*CreateResponse)(nil) _ json.Marshaler = (*CreateResponse)(nil) _ json.Unmarshaler = (*CreateResponse)(nil) ) // StableSize returns the size of x in protobuf format. // // Structures with the same field values have the same binary size. func (x *CreateResponse) StableSize() (size int) { if x == nil { return 0 } size += proto.NestedStructureSize(1, x.Body) size += proto.NestedStructureSize(2, x.MetaHeader) size += proto.NestedStructureSize(3, x.VerifyHeader) return size } // ReadSignedData fills buf with signed data of x. // If buffer length is less than x.SignedDataSize(), new buffer is allocated. // // Returns any error encountered which did not allow writing the data completely. // Otherwise, returns the buffer in which the data is written. // // Structures with the same field values have the same signed data. func (x *CreateResponse) SignedDataSize() int { return x.GetBody().StableSize() } // SignedDataSize returns size of the request signed data in bytes. // // Structures with the same field values have the same signed data size. func (x *CreateResponse) ReadSignedData(buf []byte) ([]byte, error) { return x.GetBody().MarshalProtobuf(buf), nil } // MarshalProtobuf implements the encoding.ProtoMarshaler interface. func (x *CreateResponse) MarshalProtobuf(dst []byte) []byte { m := pool.MarshalerPool.Get() defer pool.MarshalerPool.Put(m) x.EmitProtobuf(m.MessageMarshaler()) dst = m.Marshal(dst) return dst } func (x *CreateResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) { if x == nil { return } if x.Body != nil { x.Body.EmitProtobuf(mm.AppendMessage(1)) } if x.MetaHeader != nil { x.MetaHeader.EmitProtobuf(mm.AppendMessage(2)) } if x.VerifyHeader != nil { x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3)) } } // UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface. func (x *CreateResponse) UnmarshalProtobuf(src []byte) (err error) { var fc easyproto.FieldContext for len(src) > 0 { src, err = fc.NextField(src) if err != nil { return fmt.Errorf("cannot read next field in %s", "CreateResponse") } switch fc.FieldNum { case 1: // Body data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "Body") } x.Body = new(CreateResponse_Body) if err := x.Body.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } case 2: // MetaHeader data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "MetaHeader") } x.MetaHeader = new(ResponseMetaHeader) if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } case 3: // VerifyHeader data, ok := fc.MessageData() if !ok { return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader") } x.VerifyHeader = new(ResponseVerificationHeader) if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil { return fmt.Errorf("unmarshal: %w", err) } } } return nil } func (x *CreateResponse) GetBody() *CreateResponse_Body { if x != nil { return x.Body } return nil } func (x *CreateResponse) SetBody(v *CreateResponse_Body) { x.Body = v } func (x *CreateResponse) GetMetaHeader() *ResponseMetaHeader { if x != nil { return x.MetaHeader } return nil } func (x *CreateResponse) SetMetaHeader(v *ResponseMetaHeader) { x.MetaHeader = v } func (x *CreateResponse) GetVerifyHeader() *ResponseVerificationHeader { if x != nil { return x.VerifyHeader } return nil } func (x *CreateResponse) SetVerifyHeader(v *ResponseVerificationHeader) { x.VerifyHeader = v } // MarshalJSON implements the json.Marshaler interface. func (x *CreateResponse) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} x.MarshalEasyJSON(&w) return w.Buffer.BuildBytes(), w.Error } func (x *CreateResponse) MarshalEasyJSON(out *jwriter.Writer) { if x == nil { out.RawString("null") return } first := true out.RawByte('{') { if x.Body != nil { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"body\":" out.RawString(prefix) x.Body.MarshalEasyJSON(out) } } { if x.MetaHeader != nil { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"metaHeader\":" out.RawString(prefix) x.MetaHeader.MarshalEasyJSON(out) } } { if x.VerifyHeader != nil { if !first { out.RawByte(',') } else { first = false } const prefix string = "\"verifyHeader\":" out.RawString(prefix) x.VerifyHeader.MarshalEasyJSON(out) } } out.RawByte('}') } // UnmarshalJSON implements the json.Unmarshaler interface. func (x *CreateResponse) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} x.UnmarshalEasyJSON(&r) return r.Error() } func (x *CreateResponse) UnmarshalEasyJSON(in *jlexer.Lexer) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "body": { var f *CreateResponse_Body f = new(CreateResponse_Body) f.UnmarshalEasyJSON(in) x.Body = f } case "metaHeader": { var f *ResponseMetaHeader f = new(ResponseMetaHeader) f.UnmarshalEasyJSON(in) x.MetaHeader = f } case "verifyHeader": { var f *ResponseVerificationHeader f = new(ResponseVerificationHeader) f.UnmarshalEasyJSON(in) x.VerifyHeader = f } } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } }