opentelemetry-collector/pdata/internal/generated_wrapper_exportpro...

147 lines
4.1 KiB
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
// Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
// To regenerate this file run "make genpdata".
package internal
import (
"fmt"
"sync"
otlpcollectorprofiles "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/profiles/v1development"
"go.opentelemetry.io/collector/pdata/internal/json"
"go.opentelemetry.io/collector/pdata/internal/proto"
)
var (
protoPoolExportProfilesServiceResponse = sync.Pool{
New: func() any {
return &otlpcollectorprofiles.ExportProfilesServiceResponse{}
},
}
)
func NewOrigExportProfilesServiceResponse() *otlpcollectorprofiles.ExportProfilesServiceResponse {
if !UseProtoPooling.IsEnabled() {
return &otlpcollectorprofiles.ExportProfilesServiceResponse{}
}
return protoPoolExportProfilesServiceResponse.Get().(*otlpcollectorprofiles.ExportProfilesServiceResponse)
}
func DeleteOrigExportProfilesServiceResponse(orig *otlpcollectorprofiles.ExportProfilesServiceResponse, nullable bool) {
if orig == nil {
return
}
if !UseProtoPooling.IsEnabled() {
orig.Reset()
return
}
DeleteOrigExportProfilesPartialSuccess(&orig.PartialSuccess, false)
orig.Reset()
if nullable {
protoPoolExportProfilesServiceResponse.Put(orig)
}
}
func CopyOrigExportProfilesServiceResponse(dest, src *otlpcollectorprofiles.ExportProfilesServiceResponse) {
// If copying to same object, just return.
if src == dest {
return
}
CopyOrigExportProfilesPartialSuccess(&dest.PartialSuccess, &src.PartialSuccess)
}
func GenTestOrigExportProfilesServiceResponse() *otlpcollectorprofiles.ExportProfilesServiceResponse {
orig := NewOrigExportProfilesServiceResponse()
orig.PartialSuccess = *GenTestOrigExportProfilesPartialSuccess()
return orig
}
// MarshalJSONOrig marshals all properties from the current struct to the destination stream.
func MarshalJSONOrigExportProfilesServiceResponse(orig *otlpcollectorprofiles.ExportProfilesServiceResponse, dest *json.Stream) {
dest.WriteObjectStart()
dest.WriteObjectField("partialSuccess")
MarshalJSONOrigExportProfilesPartialSuccess(&orig.PartialSuccess, dest)
dest.WriteObjectEnd()
}
// UnmarshalJSONOrigExportResponse unmarshals all properties from the current struct from the source iterator.
func UnmarshalJSONOrigExportProfilesServiceResponse(orig *otlpcollectorprofiles.ExportProfilesServiceResponse, iter *json.Iterator) {
for f := iter.ReadObject(); f != ""; f = iter.ReadObject() {
switch f {
case "partialSuccess", "partial_success":
UnmarshalJSONOrigExportProfilesPartialSuccess(&orig.PartialSuccess, iter)
default:
iter.Skip()
}
}
}
func SizeProtoOrigExportProfilesServiceResponse(orig *otlpcollectorprofiles.ExportProfilesServiceResponse) int {
var n int
var l int
_ = l
l = SizeProtoOrigExportProfilesPartialSuccess(&orig.PartialSuccess)
n += 1 + proto.Sov(uint64(l)) + l
return n
}
func MarshalProtoOrigExportProfilesServiceResponse(orig *otlpcollectorprofiles.ExportProfilesServiceResponse, buf []byte) int {
pos := len(buf)
var l int
_ = l
l = MarshalProtoOrigExportProfilesPartialSuccess(&orig.PartialSuccess, buf[:pos])
pos -= l
pos = proto.EncodeVarint(buf, pos, uint64(l))
pos--
buf[pos] = 0xa
return len(buf) - pos
}
func UnmarshalProtoOrigExportProfilesServiceResponse(orig *otlpcollectorprofiles.ExportProfilesServiceResponse, buf []byte) error {
var err error
var fieldNum int32
var wireType proto.WireType
l := len(buf)
pos := 0
for pos < l {
// If in a group parsing, move to the next tag.
fieldNum, wireType, pos, err = proto.ConsumeTag(buf, pos)
if err != nil {
return err
}
switch fieldNum {
case 1:
if wireType != proto.WireTypeLen {
return fmt.Errorf("proto: wrong wireType = %d for field PartialSuccess", wireType)
}
var length int
length, pos, err = proto.ConsumeLen(buf, pos)
if err != nil {
return err
}
startPos := pos - length
err = UnmarshalProtoOrigExportProfilesPartialSuccess(&orig.PartialSuccess, buf[startPos:pos])
if err != nil {
return err
}
default:
pos, err = proto.ConsumeUnknown(buf, pos, wireType)
if err != nil {
return err
}
}
}
return nil
}