-
Notifications
You must be signed in to change notification settings - Fork 36
/
EbClient.cpp
1418 lines (1251 loc) · 45.4 KB
/
EbClient.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <tencentcloud/eb/v20210416/EbClient.h>
#include <tencentcloud/core/Executor.h>
#include <tencentcloud/core/Runnable.h>
using namespace TencentCloud;
using namespace TencentCloud::Eb::V20210416;
using namespace TencentCloud::Eb::V20210416::Model;
using namespace std;
namespace
{
const string VERSION = "2021-04-16";
const string ENDPOINT = "eb.tencentcloudapi.com";
}
EbClient::EbClient(const Credential &credential, const string ®ion) :
EbClient(credential, region, ClientProfile())
{
}
EbClient::EbClient(const Credential &credential, const string ®ion, const ClientProfile &profile) :
AbstractClient(ENDPOINT, VERSION, credential, region, profile)
{
}
EbClient::CheckRuleOutcome EbClient::CheckRule(const CheckRuleRequest &request)
{
auto outcome = MakeRequest(request, "CheckRule");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CheckRuleResponse rsp = CheckRuleResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CheckRuleOutcome(rsp);
else
return CheckRuleOutcome(o.GetError());
}
else
{
return CheckRuleOutcome(outcome.GetError());
}
}
void EbClient::CheckRuleAsync(const CheckRuleRequest& request, const CheckRuleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CheckRule(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::CheckRuleOutcomeCallable EbClient::CheckRuleCallable(const CheckRuleRequest &request)
{
auto task = std::make_shared<std::packaged_task<CheckRuleOutcome()>>(
[this, request]()
{
return this->CheckRule(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::CheckTransformationOutcome EbClient::CheckTransformation(const CheckTransformationRequest &request)
{
auto outcome = MakeRequest(request, "CheckTransformation");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CheckTransformationResponse rsp = CheckTransformationResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CheckTransformationOutcome(rsp);
else
return CheckTransformationOutcome(o.GetError());
}
else
{
return CheckTransformationOutcome(outcome.GetError());
}
}
void EbClient::CheckTransformationAsync(const CheckTransformationRequest& request, const CheckTransformationAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CheckTransformation(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::CheckTransformationOutcomeCallable EbClient::CheckTransformationCallable(const CheckTransformationRequest &request)
{
auto task = std::make_shared<std::packaged_task<CheckTransformationOutcome()>>(
[this, request]()
{
return this->CheckTransformation(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::CreateConnectionOutcome EbClient::CreateConnection(const CreateConnectionRequest &request)
{
auto outcome = MakeRequest(request, "CreateConnection");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateConnectionResponse rsp = CreateConnectionResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateConnectionOutcome(rsp);
else
return CreateConnectionOutcome(o.GetError());
}
else
{
return CreateConnectionOutcome(outcome.GetError());
}
}
void EbClient::CreateConnectionAsync(const CreateConnectionRequest& request, const CreateConnectionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateConnection(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::CreateConnectionOutcomeCallable EbClient::CreateConnectionCallable(const CreateConnectionRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateConnectionOutcome()>>(
[this, request]()
{
return this->CreateConnection(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::CreateEventBusOutcome EbClient::CreateEventBus(const CreateEventBusRequest &request)
{
auto outcome = MakeRequest(request, "CreateEventBus");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateEventBusResponse rsp = CreateEventBusResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateEventBusOutcome(rsp);
else
return CreateEventBusOutcome(o.GetError());
}
else
{
return CreateEventBusOutcome(outcome.GetError());
}
}
void EbClient::CreateEventBusAsync(const CreateEventBusRequest& request, const CreateEventBusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateEventBus(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::CreateEventBusOutcomeCallable EbClient::CreateEventBusCallable(const CreateEventBusRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateEventBusOutcome()>>(
[this, request]()
{
return this->CreateEventBus(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::CreateRuleOutcome EbClient::CreateRule(const CreateRuleRequest &request)
{
auto outcome = MakeRequest(request, "CreateRule");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateRuleResponse rsp = CreateRuleResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateRuleOutcome(rsp);
else
return CreateRuleOutcome(o.GetError());
}
else
{
return CreateRuleOutcome(outcome.GetError());
}
}
void EbClient::CreateRuleAsync(const CreateRuleRequest& request, const CreateRuleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateRule(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::CreateRuleOutcomeCallable EbClient::CreateRuleCallable(const CreateRuleRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateRuleOutcome()>>(
[this, request]()
{
return this->CreateRule(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::CreateTargetOutcome EbClient::CreateTarget(const CreateTargetRequest &request)
{
auto outcome = MakeRequest(request, "CreateTarget");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateTargetResponse rsp = CreateTargetResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateTargetOutcome(rsp);
else
return CreateTargetOutcome(o.GetError());
}
else
{
return CreateTargetOutcome(outcome.GetError());
}
}
void EbClient::CreateTargetAsync(const CreateTargetRequest& request, const CreateTargetAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateTarget(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::CreateTargetOutcomeCallable EbClient::CreateTargetCallable(const CreateTargetRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateTargetOutcome()>>(
[this, request]()
{
return this->CreateTarget(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::CreateTransformationOutcome EbClient::CreateTransformation(const CreateTransformationRequest &request)
{
auto outcome = MakeRequest(request, "CreateTransformation");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateTransformationResponse rsp = CreateTransformationResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateTransformationOutcome(rsp);
else
return CreateTransformationOutcome(o.GetError());
}
else
{
return CreateTransformationOutcome(outcome.GetError());
}
}
void EbClient::CreateTransformationAsync(const CreateTransformationRequest& request, const CreateTransformationAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateTransformation(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::CreateTransformationOutcomeCallable EbClient::CreateTransformationCallable(const CreateTransformationRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateTransformationOutcome()>>(
[this, request]()
{
return this->CreateTransformation(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::DeleteConnectionOutcome EbClient::DeleteConnection(const DeleteConnectionRequest &request)
{
auto outcome = MakeRequest(request, "DeleteConnection");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteConnectionResponse rsp = DeleteConnectionResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteConnectionOutcome(rsp);
else
return DeleteConnectionOutcome(o.GetError());
}
else
{
return DeleteConnectionOutcome(outcome.GetError());
}
}
void EbClient::DeleteConnectionAsync(const DeleteConnectionRequest& request, const DeleteConnectionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteConnection(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::DeleteConnectionOutcomeCallable EbClient::DeleteConnectionCallable(const DeleteConnectionRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteConnectionOutcome()>>(
[this, request]()
{
return this->DeleteConnection(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::DeleteEventBusOutcome EbClient::DeleteEventBus(const DeleteEventBusRequest &request)
{
auto outcome = MakeRequest(request, "DeleteEventBus");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteEventBusResponse rsp = DeleteEventBusResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteEventBusOutcome(rsp);
else
return DeleteEventBusOutcome(o.GetError());
}
else
{
return DeleteEventBusOutcome(outcome.GetError());
}
}
void EbClient::DeleteEventBusAsync(const DeleteEventBusRequest& request, const DeleteEventBusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteEventBus(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::DeleteEventBusOutcomeCallable EbClient::DeleteEventBusCallable(const DeleteEventBusRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteEventBusOutcome()>>(
[this, request]()
{
return this->DeleteEventBus(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::DeleteRuleOutcome EbClient::DeleteRule(const DeleteRuleRequest &request)
{
auto outcome = MakeRequest(request, "DeleteRule");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteRuleResponse rsp = DeleteRuleResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteRuleOutcome(rsp);
else
return DeleteRuleOutcome(o.GetError());
}
else
{
return DeleteRuleOutcome(outcome.GetError());
}
}
void EbClient::DeleteRuleAsync(const DeleteRuleRequest& request, const DeleteRuleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteRule(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::DeleteRuleOutcomeCallable EbClient::DeleteRuleCallable(const DeleteRuleRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteRuleOutcome()>>(
[this, request]()
{
return this->DeleteRule(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::DeleteTargetOutcome EbClient::DeleteTarget(const DeleteTargetRequest &request)
{
auto outcome = MakeRequest(request, "DeleteTarget");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteTargetResponse rsp = DeleteTargetResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteTargetOutcome(rsp);
else
return DeleteTargetOutcome(o.GetError());
}
else
{
return DeleteTargetOutcome(outcome.GetError());
}
}
void EbClient::DeleteTargetAsync(const DeleteTargetRequest& request, const DeleteTargetAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteTarget(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::DeleteTargetOutcomeCallable EbClient::DeleteTargetCallable(const DeleteTargetRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteTargetOutcome()>>(
[this, request]()
{
return this->DeleteTarget(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::DeleteTransformationOutcome EbClient::DeleteTransformation(const DeleteTransformationRequest &request)
{
auto outcome = MakeRequest(request, "DeleteTransformation");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteTransformationResponse rsp = DeleteTransformationResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteTransformationOutcome(rsp);
else
return DeleteTransformationOutcome(o.GetError());
}
else
{
return DeleteTransformationOutcome(outcome.GetError());
}
}
void EbClient::DeleteTransformationAsync(const DeleteTransformationRequest& request, const DeleteTransformationAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteTransformation(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::DeleteTransformationOutcomeCallable EbClient::DeleteTransformationCallable(const DeleteTransformationRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteTransformationOutcome()>>(
[this, request]()
{
return this->DeleteTransformation(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::DescribeLogTagValueOutcome EbClient::DescribeLogTagValue(const DescribeLogTagValueRequest &request)
{
auto outcome = MakeRequest(request, "DescribeLogTagValue");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeLogTagValueResponse rsp = DescribeLogTagValueResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeLogTagValueOutcome(rsp);
else
return DescribeLogTagValueOutcome(o.GetError());
}
else
{
return DescribeLogTagValueOutcome(outcome.GetError());
}
}
void EbClient::DescribeLogTagValueAsync(const DescribeLogTagValueRequest& request, const DescribeLogTagValueAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeLogTagValue(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::DescribeLogTagValueOutcomeCallable EbClient::DescribeLogTagValueCallable(const DescribeLogTagValueRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeLogTagValueOutcome()>>(
[this, request]()
{
return this->DescribeLogTagValue(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::GetEventBusOutcome EbClient::GetEventBus(const GetEventBusRequest &request)
{
auto outcome = MakeRequest(request, "GetEventBus");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetEventBusResponse rsp = GetEventBusResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetEventBusOutcome(rsp);
else
return GetEventBusOutcome(o.GetError());
}
else
{
return GetEventBusOutcome(outcome.GetError());
}
}
void EbClient::GetEventBusAsync(const GetEventBusRequest& request, const GetEventBusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->GetEventBus(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::GetEventBusOutcomeCallable EbClient::GetEventBusCallable(const GetEventBusRequest &request)
{
auto task = std::make_shared<std::packaged_task<GetEventBusOutcome()>>(
[this, request]()
{
return this->GetEventBus(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::GetPlatformEventTemplateOutcome EbClient::GetPlatformEventTemplate(const GetPlatformEventTemplateRequest &request)
{
auto outcome = MakeRequest(request, "GetPlatformEventTemplate");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetPlatformEventTemplateResponse rsp = GetPlatformEventTemplateResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetPlatformEventTemplateOutcome(rsp);
else
return GetPlatformEventTemplateOutcome(o.GetError());
}
else
{
return GetPlatformEventTemplateOutcome(outcome.GetError());
}
}
void EbClient::GetPlatformEventTemplateAsync(const GetPlatformEventTemplateRequest& request, const GetPlatformEventTemplateAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->GetPlatformEventTemplate(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::GetPlatformEventTemplateOutcomeCallable EbClient::GetPlatformEventTemplateCallable(const GetPlatformEventTemplateRequest &request)
{
auto task = std::make_shared<std::packaged_task<GetPlatformEventTemplateOutcome()>>(
[this, request]()
{
return this->GetPlatformEventTemplate(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::GetRuleOutcome EbClient::GetRule(const GetRuleRequest &request)
{
auto outcome = MakeRequest(request, "GetRule");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetRuleResponse rsp = GetRuleResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetRuleOutcome(rsp);
else
return GetRuleOutcome(o.GetError());
}
else
{
return GetRuleOutcome(outcome.GetError());
}
}
void EbClient::GetRuleAsync(const GetRuleRequest& request, const GetRuleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->GetRule(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::GetRuleOutcomeCallable EbClient::GetRuleCallable(const GetRuleRequest &request)
{
auto task = std::make_shared<std::packaged_task<GetRuleOutcome()>>(
[this, request]()
{
return this->GetRule(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::GetTransformationOutcome EbClient::GetTransformation(const GetTransformationRequest &request)
{
auto outcome = MakeRequest(request, "GetTransformation");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetTransformationResponse rsp = GetTransformationResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetTransformationOutcome(rsp);
else
return GetTransformationOutcome(o.GetError());
}
else
{
return GetTransformationOutcome(outcome.GetError());
}
}
void EbClient::GetTransformationAsync(const GetTransformationRequest& request, const GetTransformationAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->GetTransformation(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::GetTransformationOutcomeCallable EbClient::GetTransformationCallable(const GetTransformationRequest &request)
{
auto task = std::make_shared<std::packaged_task<GetTransformationOutcome()>>(
[this, request]()
{
return this->GetTransformation(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::ListConnectionsOutcome EbClient::ListConnections(const ListConnectionsRequest &request)
{
auto outcome = MakeRequest(request, "ListConnections");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListConnectionsResponse rsp = ListConnectionsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListConnectionsOutcome(rsp);
else
return ListConnectionsOutcome(o.GetError());
}
else
{
return ListConnectionsOutcome(outcome.GetError());
}
}
void EbClient::ListConnectionsAsync(const ListConnectionsRequest& request, const ListConnectionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ListConnections(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::ListConnectionsOutcomeCallable EbClient::ListConnectionsCallable(const ListConnectionsRequest &request)
{
auto task = std::make_shared<std::packaged_task<ListConnectionsOutcome()>>(
[this, request]()
{
return this->ListConnections(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::ListEventBusesOutcome EbClient::ListEventBuses(const ListEventBusesRequest &request)
{
auto outcome = MakeRequest(request, "ListEventBuses");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListEventBusesResponse rsp = ListEventBusesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListEventBusesOutcome(rsp);
else
return ListEventBusesOutcome(o.GetError());
}
else
{
return ListEventBusesOutcome(outcome.GetError());
}
}
void EbClient::ListEventBusesAsync(const ListEventBusesRequest& request, const ListEventBusesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ListEventBuses(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::ListEventBusesOutcomeCallable EbClient::ListEventBusesCallable(const ListEventBusesRequest &request)
{
auto task = std::make_shared<std::packaged_task<ListEventBusesOutcome()>>(
[this, request]()
{
return this->ListEventBuses(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::ListPlatformEventNamesOutcome EbClient::ListPlatformEventNames(const ListPlatformEventNamesRequest &request)
{
auto outcome = MakeRequest(request, "ListPlatformEventNames");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListPlatformEventNamesResponse rsp = ListPlatformEventNamesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListPlatformEventNamesOutcome(rsp);
else
return ListPlatformEventNamesOutcome(o.GetError());
}
else
{
return ListPlatformEventNamesOutcome(outcome.GetError());
}
}
void EbClient::ListPlatformEventNamesAsync(const ListPlatformEventNamesRequest& request, const ListPlatformEventNamesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ListPlatformEventNames(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::ListPlatformEventNamesOutcomeCallable EbClient::ListPlatformEventNamesCallable(const ListPlatformEventNamesRequest &request)
{
auto task = std::make_shared<std::packaged_task<ListPlatformEventNamesOutcome()>>(
[this, request]()
{
return this->ListPlatformEventNames(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::ListPlatformEventPatternsOutcome EbClient::ListPlatformEventPatterns(const ListPlatformEventPatternsRequest &request)
{
auto outcome = MakeRequest(request, "ListPlatformEventPatterns");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListPlatformEventPatternsResponse rsp = ListPlatformEventPatternsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListPlatformEventPatternsOutcome(rsp);
else
return ListPlatformEventPatternsOutcome(o.GetError());
}
else
{
return ListPlatformEventPatternsOutcome(outcome.GetError());
}
}
void EbClient::ListPlatformEventPatternsAsync(const ListPlatformEventPatternsRequest& request, const ListPlatformEventPatternsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ListPlatformEventPatterns(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::ListPlatformEventPatternsOutcomeCallable EbClient::ListPlatformEventPatternsCallable(const ListPlatformEventPatternsRequest &request)
{
auto task = std::make_shared<std::packaged_task<ListPlatformEventPatternsOutcome()>>(
[this, request]()
{
return this->ListPlatformEventPatterns(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::ListPlatformProductsOutcome EbClient::ListPlatformProducts(const ListPlatformProductsRequest &request)
{
auto outcome = MakeRequest(request, "ListPlatformProducts");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListPlatformProductsResponse rsp = ListPlatformProductsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListPlatformProductsOutcome(rsp);
else
return ListPlatformProductsOutcome(o.GetError());
}
else
{
return ListPlatformProductsOutcome(outcome.GetError());
}
}
void EbClient::ListPlatformProductsAsync(const ListPlatformProductsRequest& request, const ListPlatformProductsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ListPlatformProducts(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
EbClient::ListPlatformProductsOutcomeCallable EbClient::ListPlatformProductsCallable(const ListPlatformProductsRequest &request)
{
auto task = std::make_shared<std::packaged_task<ListPlatformProductsOutcome()>>(
[this, request]()
{
return this->ListPlatformProducts(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
EbClient::ListRulesOutcome EbClient::ListRules(const ListRulesRequest &request)
{
auto outcome = MakeRequest(request, "ListRules");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListRulesResponse rsp = ListRulesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListRulesOutcome(rsp);
else