-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKongAdminAPIExtensions.cs
845 lines (797 loc) · 37.1 KB
/
KongAdminAPIExtensions.cs
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
// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Kong
{
using Models;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Extension methods for KongAdminAPI.
/// </summary>
public static partial class KongAdminAPIExtensions
{
/// <summary>
/// List all services
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='offset'>
/// An uid of a service as an offset.
/// </param>
public static ServiceList ListServices(this IKongAdminAPI operations, string offset = default(string))
{
return operations.ListServicesAsync(offset).GetAwaiter().GetResult();
}
/// <summary>
/// List all services
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='offset'>
/// An uid of a service as an offset.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<ServiceList> ListServicesAsync(this IKongAdminAPI operations, string offset = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListServicesWithHttpMessagesAsync(offset, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Registrate service to Kong
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='serviceUpsert'>
/// </param>
public static Service AddService(this IKongAdminAPI operations, ServiceUpsert serviceUpsert)
{
return operations.AddServiceAsync(serviceUpsert).GetAwaiter().GetResult();
}
/// <summary>
/// Registrate service to Kong
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='serviceUpsert'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Service> AddServiceAsync(this IKongAdminAPI operations, ServiceUpsert serviceUpsert, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.AddServiceWithHttpMessagesAsync(serviceUpsert, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Delete a service by a name or id
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The unique identifier or the name of the Service to delete.
/// </param>
public static void DeleteService(this IKongAdminAPI operations, string service)
{
operations.DeleteServiceAsync(service).GetAwaiter().GetResult();
}
/// <summary>
/// Delete a service by a name or id
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The unique identifier or the name of the Service to delete.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteServiceAsync(this IKongAdminAPI operations, string service, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeleteServiceWithHttpMessagesAsync(service, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
/// <summary>
/// List Routes associated to a specific Service
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The unique identifier or the name attribute of the Service that's Routes
/// should be listed.
/// </param>
/// <param name='offset'>
/// An uid of a route as an offset.
/// </param>
public static RouteList ListRoutes(this IKongAdminAPI operations, string service, string offset = default(string))
{
return operations.ListRoutesAsync(service, offset).GetAwaiter().GetResult();
}
/// <summary>
/// List Routes associated to a specific Service
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The unique identifier or the name attribute of the Service that's Routes
/// should be listed.
/// </param>
/// <param name='offset'>
/// An uid of a route as an offset.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<RouteList> ListRoutesAsync(this IKongAdminAPI operations, string service, string offset = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListRoutesWithHttpMessagesAsync(service, offset, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Create Route associated to a specific Service
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The unique identifier or the name attribute of the Service that should be
/// associated to the newly-created Route.
/// </param>
/// <param name='routeUpsert'>
/// </param>
public static Route AddRoute(this IKongAdminAPI operations, string service, RouteUpsert routeUpsert)
{
return operations.AddRouteAsync(service, routeUpsert).GetAwaiter().GetResult();
}
/// <summary>
/// Create Route associated to a specific Service
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The unique identifier or the name attribute of the Service that should be
/// associated to the newly-created Route.
/// </param>
/// <param name='routeUpsert'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Route> AddRouteAsync(this IKongAdminAPI operations, string service, RouteUpsert routeUpsert, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.AddRouteWithHttpMessagesAsync(service, routeUpsert, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Delete a Route by a name or id
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='route'>
/// The unique identifier or the name of the Route to delete.
/// </param>
public static void DeleteRoute(this IKongAdminAPI operations, string route)
{
operations.DeleteRouteAsync(route).GetAwaiter().GetResult();
}
/// <summary>
/// Delete a Route by a name or id
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='route'>
/// The unique identifier or the name of the Route to delete.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteRouteAsync(this IKongAdminAPI operations, string route, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeleteRouteWithHttpMessagesAsync(route, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
/// <summary>
/// List Plugins associated to a specific Service
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The unique identifier or the name attribute of the Service that's Plugins
/// should be listed.
/// </param>
/// <param name='offset'>
/// An uid of a plugin as an offset.
/// </param>
public static PluginList ListPlugins(this IKongAdminAPI operations, string service, string offset = default(string))
{
return operations.ListPluginsAsync(service, offset).GetAwaiter().GetResult();
}
/// <summary>
/// List Plugins associated to a specific Service
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The unique identifier or the name attribute of the Service that's Plugins
/// should be listed.
/// </param>
/// <param name='offset'>
/// An uid of a plugin as an offset.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<PluginList> ListPluginsAsync(this IKongAdminAPI operations, string service, string offset = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListPluginsWithHttpMessagesAsync(service, offset, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Enabling the plugin on a Service
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The id or name of the Service that this plugin configuration will target..
/// </param>
/// <param name='pluginUpsert'>
/// </param>
public static Plugin AddPlugin(this IKongAdminAPI operations, string service, PluginUpsert pluginUpsert)
{
return operations.AddPluginAsync(service, pluginUpsert).GetAwaiter().GetResult();
}
/// <summary>
/// Enabling the plugin on a Service
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='service'>
/// The id or name of the Service that this plugin configuration will target..
/// </param>
/// <param name='pluginUpsert'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Plugin> AddPluginAsync(this IKongAdminAPI operations, string service, PluginUpsert pluginUpsert, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.AddPluginWithHttpMessagesAsync(service, pluginUpsert, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Delete a Plugin by an id
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='pluginId'>
/// The unique identifier of the Plugin to delete.
/// </param>
public static void DeletePlugin(this IKongAdminAPI operations, string pluginId)
{
operations.DeletePluginAsync(pluginId).GetAwaiter().GetResult();
}
/// <summary>
/// Delete a Plugin by an id
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='pluginId'>
/// The unique identifier of the Plugin to delete.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeletePluginAsync(this IKongAdminAPI operations, string pluginId, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeletePluginWithHttpMessagesAsync(pluginId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
/// <summary>
/// List all Consumers
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='offset'>
/// An uid of a consumer as an offset.
/// </param>
public static ConsumerList ListConsumers(this IKongAdminAPI operations, string offset = default(string))
{
return operations.ListConsumersAsync(offset).GetAwaiter().GetResult();
}
/// <summary>
/// List all Consumers
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='offset'>
/// An uid of a consumer as an offset.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<ConsumerList> ListConsumersAsync(this IKongAdminAPI operations, string offset = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListConsumersWithHttpMessagesAsync(offset, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Create Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumerUpsert'>
/// </param>
public static Consumer AddConsumer(this IKongAdminAPI operations, ConsumerUpsert consumerUpsert)
{
return operations.AddConsumerAsync(consumerUpsert).GetAwaiter().GetResult();
}
/// <summary>
/// Create Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumerUpsert'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Consumer> AddConsumerAsync(this IKongAdminAPI operations, ConsumerUpsert consumerUpsert, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.AddConsumerWithHttpMessagesAsync(consumerUpsert, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Retrieve a Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The unique identifier or the username of the Consumer to retrieve.
/// </param>
public static Consumer GetConsumer(this IKongAdminAPI operations, string consumer)
{
return operations.GetConsumerAsync(consumer).GetAwaiter().GetResult();
}
/// <summary>
/// Retrieve a Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The unique identifier or the username of the Consumer to retrieve.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Consumer> GetConsumerAsync(this IKongAdminAPI operations, string consumer, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetConsumerWithHttpMessagesAsync(consumer, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Update a Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The unique identifier or the username of the Consumer to update.
/// </param>
/// <param name='consumerUpsert'>
/// </param>
public static Consumer UpdateConsumer(this IKongAdminAPI operations, string consumer, ConsumerUpsert consumerUpsert)
{
return operations.UpdateConsumerAsync(consumer, consumerUpsert).GetAwaiter().GetResult();
}
/// <summary>
/// Update a Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The unique identifier or the username of the Consumer to update.
/// </param>
/// <param name='consumerUpsert'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Consumer> UpdateConsumerAsync(this IKongAdminAPI operations, string consumer, ConsumerUpsert consumerUpsert, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.UpdateConsumerWithHttpMessagesAsync(consumer, consumerUpsert, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Create or update a Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The unique identifier of the new Consumer.
/// </param>
/// <param name='consumerUpsert'>
/// </param>
public static Consumer AddConsumerWithId(this IKongAdminAPI operations, string consumer, ConsumerUpsert consumerUpsert)
{
return operations.AddConsumerWithIdAsync(consumer, consumerUpsert).GetAwaiter().GetResult();
}
/// <summary>
/// Create or update a Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The unique identifier of the new Consumer.
/// </param>
/// <param name='consumerUpsert'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Consumer> AddConsumerWithIdAsync(this IKongAdminAPI operations, string consumer, ConsumerUpsert consumerUpsert, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.AddConsumerWithIdWithHttpMessagesAsync(consumer, consumerUpsert, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Delete a Consumer by username or id
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The unique identifier or the username of the Consumer to delete.
/// </param>
public static void DeleteConsumer(this IKongAdminAPI operations, string consumer)
{
operations.DeleteConsumerAsync(consumer).GetAwaiter().GetResult();
}
/// <summary>
/// Delete a Consumer by username or id
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The unique identifier or the username of the Consumer to delete.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteConsumerAsync(this IKongAdminAPI operations, string consumer, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeleteConsumerWithHttpMessagesAsync(consumer, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
/// <summary>
/// List JWT credentials of Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to list credentials for.
/// </param>
public static CredentialList ListCredentials(this IKongAdminAPI operations, string consumer)
{
return operations.ListCredentialsAsync(consumer).GetAwaiter().GetResult();
}
/// <summary>
/// List JWT credentials of Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to list credentials for.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<CredentialList> ListCredentialsAsync(this IKongAdminAPI operations, string consumer, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListCredentialsWithHttpMessagesAsync(consumer, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Create a JWT credential
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='credentialUpsert'>
/// </param>
public static Credential AddCredential(this IKongAdminAPI operations, string consumer, CredentialUpsert credentialUpsert = default(CredentialUpsert))
{
return operations.AddCredentialAsync(consumer, credentialUpsert).GetAwaiter().GetResult();
}
/// <summary>
/// Create a JWT credential
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='credentialUpsert'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Credential> AddCredentialAsync(this IKongAdminAPI operations, string consumer, CredentialUpsert credentialUpsert = default(CredentialUpsert), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.AddCredentialWithHttpMessagesAsync(consumer, credentialUpsert, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Get a JWT Credential
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='id'>
/// The id or the key of the JWT credential.
/// </param>
public static Credential GetCredential(this IKongAdminAPI operations, string consumer, string id)
{
return operations.GetCredentialAsync(consumer, id).GetAwaiter().GetResult();
}
/// <summary>
/// Get a JWT Credential
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='id'>
/// The id or the key of the JWT credential.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Credential> GetCredentialAsync(this IKongAdminAPI operations, string consumer, string id, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetCredentialWithHttpMessagesAsync(consumer, id, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Delete a JWT Credential
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='id'>
/// The id or the key of the JWT credential.
/// </param>
public static void DeleteCredential(this IKongAdminAPI operations, string consumer, string id)
{
operations.DeleteCredentialAsync(consumer, id).GetAwaiter().GetResult();
}
/// <summary>
/// Delete a JWT Credential
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='id'>
/// The id or the key of the JWT credential.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteCredentialAsync(this IKongAdminAPI operations, string consumer, string id, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeleteCredentialWithHttpMessagesAsync(consumer, id, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
/// <summary>
/// Retrieve all ACLs
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
public static AclList ListAcls(this IKongAdminAPI operations)
{
return operations.ListAclsAsync().GetAwaiter().GetResult();
}
/// <summary>
/// Retrieve all ACLs
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<AclList> ListAclsAsync(this IKongAdminAPI operations, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListAclsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Retrieve all ACLs for the given Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity which ACLs will be
/// listed.
/// </param>
public static AclList ListAclsForConsumer(this IKongAdminAPI operations, string consumer)
{
return operations.ListAclsForConsumerAsync(consumer).GetAwaiter().GetResult();
}
/// <summary>
/// Retrieve all ACLs for the given Consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity which ACLs will be
/// listed.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<AclList> ListAclsForConsumerAsync(this IKongAdminAPI operations, string consumer, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListAclsForConsumerWithHttpMessagesAsync(consumer, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Add ACL to a consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='group'>
/// </param>
public static Acl AddAcl(this IKongAdminAPI operations, string consumer, string group)
{
return operations.AddAclAsync(consumer, group).GetAwaiter().GetResult();
}
/// <summary>
/// Add ACL to a consumer
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='group'>
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Acl> AddAclAsync(this IKongAdminAPI operations, string consumer, string group, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.AddAclWithHttpMessagesAsync(consumer, group, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
/// <summary>
/// Delete an ACL
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='id'>
/// The id of the ACL.
/// </param>
public static void DeleteAcl(this IKongAdminAPI operations, string consumer, string id)
{
operations.DeleteAclAsync(consumer, id).GetAwaiter().GetResult();
}
/// <summary>
/// Delete an ACL
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='consumer'>
/// The id or username property of the Consumer entity to associate the
/// credentials to.
/// </param>
/// <param name='id'>
/// The id of the ACL.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task DeleteAclAsync(this IKongAdminAPI operations, string consumer, string id, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.DeleteAclWithHttpMessagesAsync(consumer, id, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
}
}