baggage.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. // Code generated by Thrift Compiler (0.14.1). DO NOT EDIT.
  2. package baggage
  3. import(
  4. "bytes"
  5. "context"
  6. "fmt"
  7. "time"
  8. "github.com/uber/jaeger-client-go/thrift"
  9. )
  10. // (needed to ensure safety because of naive import list construction.)
  11. var _ = thrift.ZERO
  12. var _ = fmt.Printf
  13. var _ = context.Background
  14. var _ = time.Now
  15. var _ = bytes.Equal
  16. // Attributes:
  17. // - BaggageKey
  18. // - MaxValueLength
  19. type BaggageRestriction struct {
  20. BaggageKey string `thrift:"baggageKey,1,required" db:"baggageKey" json:"baggageKey"`
  21. MaxValueLength int32 `thrift:"maxValueLength,2,required" db:"maxValueLength" json:"maxValueLength"`
  22. }
  23. func NewBaggageRestriction() *BaggageRestriction {
  24. return &BaggageRestriction{}
  25. }
  26. func (p *BaggageRestriction) GetBaggageKey() string {
  27. return p.BaggageKey
  28. }
  29. func (p *BaggageRestriction) GetMaxValueLength() int32 {
  30. return p.MaxValueLength
  31. }
  32. func (p *BaggageRestriction) Read(ctx context.Context, iprot thrift.TProtocol) error {
  33. if _, err := iprot.ReadStructBegin(ctx); err != nil {
  34. return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
  35. }
  36. var issetBaggageKey bool = false;
  37. var issetMaxValueLength bool = false;
  38. for {
  39. _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
  40. if err != nil {
  41. return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
  42. }
  43. if fieldTypeId == thrift.STOP { break; }
  44. switch fieldId {
  45. case 1:
  46. if fieldTypeId == thrift.STRING {
  47. if err := p.ReadField1(ctx, iprot); err != nil {
  48. return err
  49. }
  50. issetBaggageKey = true
  51. } else {
  52. if err := iprot.Skip(ctx, fieldTypeId); err != nil {
  53. return err
  54. }
  55. }
  56. case 2:
  57. if fieldTypeId == thrift.I32 {
  58. if err := p.ReadField2(ctx, iprot); err != nil {
  59. return err
  60. }
  61. issetMaxValueLength = true
  62. } else {
  63. if err := iprot.Skip(ctx, fieldTypeId); err != nil {
  64. return err
  65. }
  66. }
  67. default:
  68. if err := iprot.Skip(ctx, fieldTypeId); err != nil {
  69. return err
  70. }
  71. }
  72. if err := iprot.ReadFieldEnd(ctx); err != nil {
  73. return err
  74. }
  75. }
  76. if err := iprot.ReadStructEnd(ctx); err != nil {
  77. return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
  78. }
  79. if !issetBaggageKey{
  80. return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field BaggageKey is not set"));
  81. }
  82. if !issetMaxValueLength{
  83. return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MaxValueLength is not set"));
  84. }
  85. return nil
  86. }
  87. func (p *BaggageRestriction) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
  88. if v, err := iprot.ReadString(ctx); err != nil {
  89. return thrift.PrependError("error reading field 1: ", err)
  90. } else {
  91. p.BaggageKey = v
  92. }
  93. return nil
  94. }
  95. func (p *BaggageRestriction) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
  96. if v, err := iprot.ReadI32(ctx); err != nil {
  97. return thrift.PrependError("error reading field 2: ", err)
  98. } else {
  99. p.MaxValueLength = v
  100. }
  101. return nil
  102. }
  103. func (p *BaggageRestriction) Write(ctx context.Context, oprot thrift.TProtocol) error {
  104. if err := oprot.WriteStructBegin(ctx, "BaggageRestriction"); err != nil {
  105. return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  106. if p != nil {
  107. if err := p.writeField1(ctx, oprot); err != nil { return err }
  108. if err := p.writeField2(ctx, oprot); err != nil { return err }
  109. }
  110. if err := oprot.WriteFieldStop(ctx); err != nil {
  111. return thrift.PrependError("write field stop error: ", err) }
  112. if err := oprot.WriteStructEnd(ctx); err != nil {
  113. return thrift.PrependError("write struct stop error: ", err) }
  114. return nil
  115. }
  116. func (p *BaggageRestriction) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
  117. if err := oprot.WriteFieldBegin(ctx, "baggageKey", thrift.STRING, 1); err != nil {
  118. return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:baggageKey: ", p), err) }
  119. if err := oprot.WriteString(ctx, string(p.BaggageKey)); err != nil {
  120. return thrift.PrependError(fmt.Sprintf("%T.baggageKey (1) field write error: ", p), err) }
  121. if err := oprot.WriteFieldEnd(ctx); err != nil {
  122. return thrift.PrependError(fmt.Sprintf("%T write field end error 1:baggageKey: ", p), err) }
  123. return err
  124. }
  125. func (p *BaggageRestriction) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
  126. if err := oprot.WriteFieldBegin(ctx, "maxValueLength", thrift.I32, 2); err != nil {
  127. return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:maxValueLength: ", p), err) }
  128. if err := oprot.WriteI32(ctx, int32(p.MaxValueLength)); err != nil {
  129. return thrift.PrependError(fmt.Sprintf("%T.maxValueLength (2) field write error: ", p), err) }
  130. if err := oprot.WriteFieldEnd(ctx); err != nil {
  131. return thrift.PrependError(fmt.Sprintf("%T write field end error 2:maxValueLength: ", p), err) }
  132. return err
  133. }
  134. func (p *BaggageRestriction) Equals(other *BaggageRestriction) bool {
  135. if p == other {
  136. return true
  137. } else if p == nil || other == nil {
  138. return false
  139. }
  140. if p.BaggageKey != other.BaggageKey { return false }
  141. if p.MaxValueLength != other.MaxValueLength { return false }
  142. return true
  143. }
  144. func (p *BaggageRestriction) String() string {
  145. if p == nil {
  146. return "<nil>"
  147. }
  148. return fmt.Sprintf("BaggageRestriction(%+v)", *p)
  149. }
  150. type BaggageRestrictionManager interface {
  151. // getBaggageRestrictions retrieves the baggage restrictions for a specific service.
  152. // Usually, baggageRestrictions apply to all services however there may be situations
  153. // where a baggageKey might only be allowed to be set by a specific service.
  154. //
  155. // Parameters:
  156. // - ServiceName
  157. GetBaggageRestrictions(ctx context.Context, serviceName string) (_r []*BaggageRestriction, _err error)
  158. }
  159. type BaggageRestrictionManagerClient struct {
  160. c thrift.TClient
  161. meta thrift.ResponseMeta
  162. }
  163. func NewBaggageRestrictionManagerClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *BaggageRestrictionManagerClient {
  164. return &BaggageRestrictionManagerClient{
  165. c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
  166. }
  167. }
  168. func NewBaggageRestrictionManagerClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *BaggageRestrictionManagerClient {
  169. return &BaggageRestrictionManagerClient{
  170. c: thrift.NewTStandardClient(iprot, oprot),
  171. }
  172. }
  173. func NewBaggageRestrictionManagerClient(c thrift.TClient) *BaggageRestrictionManagerClient {
  174. return &BaggageRestrictionManagerClient{
  175. c: c,
  176. }
  177. }
  178. func (p *BaggageRestrictionManagerClient) Client_() thrift.TClient {
  179. return p.c
  180. }
  181. func (p *BaggageRestrictionManagerClient) LastResponseMeta_() thrift.ResponseMeta {
  182. return p.meta
  183. }
  184. func (p *BaggageRestrictionManagerClient) SetLastResponseMeta_(meta thrift.ResponseMeta) {
  185. p.meta = meta
  186. }
  187. // getBaggageRestrictions retrieves the baggage restrictions for a specific service.
  188. // Usually, baggageRestrictions apply to all services however there may be situations
  189. // where a baggageKey might only be allowed to be set by a specific service.
  190. //
  191. // Parameters:
  192. // - ServiceName
  193. func (p *BaggageRestrictionManagerClient) GetBaggageRestrictions(ctx context.Context, serviceName string) (_r []*BaggageRestriction, _err error) {
  194. var _args0 BaggageRestrictionManagerGetBaggageRestrictionsArgs
  195. _args0.ServiceName = serviceName
  196. var _result2 BaggageRestrictionManagerGetBaggageRestrictionsResult
  197. var _meta1 thrift.ResponseMeta
  198. _meta1, _err = p.Client_().Call(ctx, "getBaggageRestrictions", &_args0, &_result2)
  199. p.SetLastResponseMeta_(_meta1)
  200. if _err != nil {
  201. return
  202. }
  203. return _result2.GetSuccess(), nil
  204. }
  205. type BaggageRestrictionManagerProcessor struct {
  206. processorMap map[string]thrift.TProcessorFunction
  207. handler BaggageRestrictionManager
  208. }
  209. func (p *BaggageRestrictionManagerProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
  210. p.processorMap[key] = processor
  211. }
  212. func (p *BaggageRestrictionManagerProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
  213. processor, ok = p.processorMap[key]
  214. return processor, ok
  215. }
  216. func (p *BaggageRestrictionManagerProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
  217. return p.processorMap
  218. }
  219. func NewBaggageRestrictionManagerProcessor(handler BaggageRestrictionManager) *BaggageRestrictionManagerProcessor {
  220. self3 := &BaggageRestrictionManagerProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
  221. self3.processorMap["getBaggageRestrictions"] = &baggageRestrictionManagerProcessorGetBaggageRestrictions{handler:handler}
  222. return self3
  223. }
  224. func (p *BaggageRestrictionManagerProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  225. name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
  226. if err2 != nil { return false, thrift.WrapTException(err2) }
  227. if processor, ok := p.GetProcessorFunction(name); ok {
  228. return processor.Process(ctx, seqId, iprot, oprot)
  229. }
  230. iprot.Skip(ctx, thrift.STRUCT)
  231. iprot.ReadMessageEnd(ctx)
  232. x4 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
  233. oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
  234. x4.Write(ctx, oprot)
  235. oprot.WriteMessageEnd(ctx)
  236. oprot.Flush(ctx)
  237. return false, x4
  238. }
  239. type baggageRestrictionManagerProcessorGetBaggageRestrictions struct {
  240. handler BaggageRestrictionManager
  241. }
  242. func (p *baggageRestrictionManagerProcessorGetBaggageRestrictions) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
  243. args := BaggageRestrictionManagerGetBaggageRestrictionsArgs{}
  244. var err2 error
  245. if err2 = args.Read(ctx, iprot); err2 != nil {
  246. iprot.ReadMessageEnd(ctx)
  247. x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
  248. oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.EXCEPTION, seqId)
  249. x.Write(ctx, oprot)
  250. oprot.WriteMessageEnd(ctx)
  251. oprot.Flush(ctx)
  252. return false, thrift.WrapTException(err2)
  253. }
  254. iprot.ReadMessageEnd(ctx)
  255. tickerCancel := func() {}
  256. // Start a goroutine to do server side connectivity check.
  257. if thrift.ServerConnectivityCheckInterval > 0 {
  258. var cancel context.CancelFunc
  259. ctx, cancel = context.WithCancel(ctx)
  260. defer cancel()
  261. var tickerCtx context.Context
  262. tickerCtx, tickerCancel = context.WithCancel(context.Background())
  263. defer tickerCancel()
  264. go func(ctx context.Context, cancel context.CancelFunc) {
  265. ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
  266. defer ticker.Stop()
  267. for {
  268. select {
  269. case <-ctx.Done():
  270. return
  271. case <-ticker.C:
  272. if !iprot.Transport().IsOpen() {
  273. cancel()
  274. return
  275. }
  276. }
  277. }
  278. }(tickerCtx, cancel)
  279. }
  280. result := BaggageRestrictionManagerGetBaggageRestrictionsResult{}
  281. var retval []*BaggageRestriction
  282. if retval, err2 = p.handler.GetBaggageRestrictions(ctx, args.ServiceName); err2 != nil {
  283. tickerCancel()
  284. if err2 == thrift.ErrAbandonRequest {
  285. return false, thrift.WrapTException(err2)
  286. }
  287. x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getBaggageRestrictions: " + err2.Error())
  288. oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.EXCEPTION, seqId)
  289. x.Write(ctx, oprot)
  290. oprot.WriteMessageEnd(ctx)
  291. oprot.Flush(ctx)
  292. return true, thrift.WrapTException(err2)
  293. } else {
  294. result.Success = retval
  295. }
  296. tickerCancel()
  297. if err2 = oprot.WriteMessageBegin(ctx, "getBaggageRestrictions", thrift.REPLY, seqId); err2 != nil {
  298. err = thrift.WrapTException(err2)
  299. }
  300. if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
  301. err = thrift.WrapTException(err2)
  302. }
  303. if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
  304. err = thrift.WrapTException(err2)
  305. }
  306. if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
  307. err = thrift.WrapTException(err2)
  308. }
  309. if err != nil {
  310. return
  311. }
  312. return true, err
  313. }
  314. // HELPER FUNCTIONS AND STRUCTURES
  315. // Attributes:
  316. // - ServiceName
  317. type BaggageRestrictionManagerGetBaggageRestrictionsArgs struct {
  318. ServiceName string `thrift:"serviceName,1" db:"serviceName" json:"serviceName"`
  319. }
  320. func NewBaggageRestrictionManagerGetBaggageRestrictionsArgs() *BaggageRestrictionManagerGetBaggageRestrictionsArgs {
  321. return &BaggageRestrictionManagerGetBaggageRestrictionsArgs{}
  322. }
  323. func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) GetServiceName() string {
  324. return p.ServiceName
  325. }
  326. func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
  327. if _, err := iprot.ReadStructBegin(ctx); err != nil {
  328. return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
  329. }
  330. for {
  331. _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
  332. if err != nil {
  333. return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
  334. }
  335. if fieldTypeId == thrift.STOP { break; }
  336. switch fieldId {
  337. case 1:
  338. if fieldTypeId == thrift.STRING {
  339. if err := p.ReadField1(ctx, iprot); err != nil {
  340. return err
  341. }
  342. } else {
  343. if err := iprot.Skip(ctx, fieldTypeId); err != nil {
  344. return err
  345. }
  346. }
  347. default:
  348. if err := iprot.Skip(ctx, fieldTypeId); err != nil {
  349. return err
  350. }
  351. }
  352. if err := iprot.ReadFieldEnd(ctx); err != nil {
  353. return err
  354. }
  355. }
  356. if err := iprot.ReadStructEnd(ctx); err != nil {
  357. return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
  358. }
  359. return nil
  360. }
  361. func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
  362. if v, err := iprot.ReadString(ctx); err != nil {
  363. return thrift.PrependError("error reading field 1: ", err)
  364. } else {
  365. p.ServiceName = v
  366. }
  367. return nil
  368. }
  369. func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
  370. if err := oprot.WriteStructBegin(ctx, "getBaggageRestrictions_args"); err != nil {
  371. return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  372. if p != nil {
  373. if err := p.writeField1(ctx, oprot); err != nil { return err }
  374. }
  375. if err := oprot.WriteFieldStop(ctx); err != nil {
  376. return thrift.PrependError("write field stop error: ", err) }
  377. if err := oprot.WriteStructEnd(ctx); err != nil {
  378. return thrift.PrependError("write struct stop error: ", err) }
  379. return nil
  380. }
  381. func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
  382. if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil {
  383. return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) }
  384. if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil {
  385. return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) }
  386. if err := oprot.WriteFieldEnd(ctx); err != nil {
  387. return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) }
  388. return err
  389. }
  390. func (p *BaggageRestrictionManagerGetBaggageRestrictionsArgs) String() string {
  391. if p == nil {
  392. return "<nil>"
  393. }
  394. return fmt.Sprintf("BaggageRestrictionManagerGetBaggageRestrictionsArgs(%+v)", *p)
  395. }
  396. // Attributes:
  397. // - Success
  398. type BaggageRestrictionManagerGetBaggageRestrictionsResult struct {
  399. Success []*BaggageRestriction `thrift:"success,0" db:"success" json:"success,omitempty"`
  400. }
  401. func NewBaggageRestrictionManagerGetBaggageRestrictionsResult() *BaggageRestrictionManagerGetBaggageRestrictionsResult {
  402. return &BaggageRestrictionManagerGetBaggageRestrictionsResult{}
  403. }
  404. var BaggageRestrictionManagerGetBaggageRestrictionsResult_Success_DEFAULT []*BaggageRestriction
  405. func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) GetSuccess() []*BaggageRestriction {
  406. return p.Success
  407. }
  408. func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) IsSetSuccess() bool {
  409. return p.Success != nil
  410. }
  411. func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
  412. if _, err := iprot.ReadStructBegin(ctx); err != nil {
  413. return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
  414. }
  415. for {
  416. _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
  417. if err != nil {
  418. return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
  419. }
  420. if fieldTypeId == thrift.STOP { break; }
  421. switch fieldId {
  422. case 0:
  423. if fieldTypeId == thrift.LIST {
  424. if err := p.ReadField0(ctx, iprot); err != nil {
  425. return err
  426. }
  427. } else {
  428. if err := iprot.Skip(ctx, fieldTypeId); err != nil {
  429. return err
  430. }
  431. }
  432. default:
  433. if err := iprot.Skip(ctx, fieldTypeId); err != nil {
  434. return err
  435. }
  436. }
  437. if err := iprot.ReadFieldEnd(ctx); err != nil {
  438. return err
  439. }
  440. }
  441. if err := iprot.ReadStructEnd(ctx); err != nil {
  442. return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
  443. }
  444. return nil
  445. }
  446. func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
  447. _, size, err := iprot.ReadListBegin(ctx)
  448. if err != nil {
  449. return thrift.PrependError("error reading list begin: ", err)
  450. }
  451. tSlice := make([]*BaggageRestriction, 0, size)
  452. p.Success = tSlice
  453. for i := 0; i < size; i ++ {
  454. _elem5 := &BaggageRestriction{}
  455. if err := _elem5.Read(ctx, iprot); err != nil {
  456. return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err)
  457. }
  458. p.Success = append(p.Success, _elem5)
  459. }
  460. if err := iprot.ReadListEnd(ctx); err != nil {
  461. return thrift.PrependError("error reading list end: ", err)
  462. }
  463. return nil
  464. }
  465. func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
  466. if err := oprot.WriteStructBegin(ctx, "getBaggageRestrictions_result"); err != nil {
  467. return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
  468. if p != nil {
  469. if err := p.writeField0(ctx, oprot); err != nil { return err }
  470. }
  471. if err := oprot.WriteFieldStop(ctx); err != nil {
  472. return thrift.PrependError("write field stop error: ", err) }
  473. if err := oprot.WriteStructEnd(ctx); err != nil {
  474. return thrift.PrependError("write struct stop error: ", err) }
  475. return nil
  476. }
  477. func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
  478. if p.IsSetSuccess() {
  479. if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil {
  480. return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) }
  481. if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil {
  482. return thrift.PrependError("error writing list begin: ", err)
  483. }
  484. for _, v := range p.Success {
  485. if err := v.Write(ctx, oprot); err != nil {
  486. return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
  487. }
  488. }
  489. if err := oprot.WriteListEnd(ctx); err != nil {
  490. return thrift.PrependError("error writing list end: ", err)
  491. }
  492. if err := oprot.WriteFieldEnd(ctx); err != nil {
  493. return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
  494. }
  495. return err
  496. }
  497. func (p *BaggageRestrictionManagerGetBaggageRestrictionsResult) String() string {
  498. if p == nil {
  499. return "<nil>"
  500. }
  501. return fmt.Sprintf("BaggageRestrictionManagerGetBaggageRestrictionsResult(%+v)", *p)
  502. }