forked from oracle/oci-dotnet-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IdentityClient.cs
5304 lines (4932 loc) · 327 KB
/
IdentityClient.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
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) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/
// NOTE: Code generated by OracleSDKGenerator.
// DO NOT EDIT this file manually.
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Oci.Common;
using Oci.Common.Auth;
using Oci.Common.Retry;
using Oci.IdentityService.Requests;
using Oci.IdentityService.Responses;
namespace Oci.IdentityService
{
/// <summary>Service client instance for Identity.</summary>
public class IdentityClient : RegionalClientBase
{
private readonly RetryConfiguration retryConfiguration;
private const string basePathWithoutHost = "/20160918";
public IdentityPaginators Paginators { get; }
public IdentityWaiters Waiters { get; }
/// <summary>
/// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint.
/// A client configuration can also be provided optionally to adjust REST client behaviors.
/// </summary>
/// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param>
/// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param>
/// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param>
public IdentityClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
: base(authenticationDetailsProvider, clientConfiguration)
{
service = new Service
{
ServiceName = "IDENTITY",
ServiceEndpointPrefix = "identity"
};
ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration();
if (authenticationDetailsProvider is IRegionProvider)
{
// Use region from Authentication details provider.
SetRegion(((IRegionProvider)authenticationDetailsProvider).Region);
}
if (endpoint != null)
{
logger.Info($"Using endpoint specified \"{endpoint}\".");
SetEndpoint(endpoint);
}
this.retryConfiguration = clientConfigurationToUse.RetryConfiguration;
Paginators = new IdentityPaginators(this);
Waiters = new IdentityWaiters(this);
}
/// <summary>
/// Activates the specified MFA TOTP device for the user. Activation requires manual interaction with the Console.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/ActivateMfaTotpDevice.cs.html">here</a> to see an example of how to use ActivateMfaTotpDevice API.</example>
public async Task<ActivateMfaTotpDeviceResponse> ActivateMfaTotpDevice(ActivateMfaTotpDeviceRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called activateMfaTotpDevice");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/users/{userId}/mfaTotpDevices/{mfaTotpDeviceId}/actions/activate".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<ActivateMfaTotpDeviceResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"ActivateMfaTotpDevice failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Adds the specified user to the specified group and returns a `UserGroupMembership` object with its own OCID.
/// <br/>
/// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the
/// object, first make sure its `lifecycleState` has changed to ACTIVE.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/AddUserToGroup.cs.html">here</a> to see an example of how to use AddUserToGroup API.</example>
public async Task<AddUserToGroupResponse> AddUserToGroup(AddUserToGroupRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called addUserToGroup");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/userGroupMemberships/".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<AddUserToGroupResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"AddUserToGroup failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Assembles tag defaults in the specified compartment and any parent compartments to determine
/// the tags to apply. Tag defaults from parent compartments do not override tag defaults
/// referencing the same tag in a compartment lower down the hierarchy. This set of tag defaults
/// includes all tag defaults from the current compartment back to the root compartment.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/AssembleEffectiveTagSet.cs.html">here</a> to see an example of how to use AssembleEffectiveTagSet API.</example>
public async Task<AssembleEffectiveTagSetResponse> AssembleEffectiveTagSet(AssembleEffectiveTagSetRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called assembleEffectiveTagSet");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/tagDefaults/actions/assembleEffectiveTagSet".Trim('/')));
HttpMethod method = new HttpMethod("GET");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<AssembleEffectiveTagSetResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"AssembleEffectiveTagSet failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Deletes multiple resources in the compartment. All resources must be in the same compartment. You must have the appropriate
/// permissions to delete the resources in the request. This API can only be invoked from the tenancy's
/// [home region](https://docs.cloud.oracle.com/Content/Identity/Tasks/managingregions.htm#Home). This operation creates a
/// {@link WorkRequest}. Use the {@link #getWorkRequest(GetWorkRequestRequest) getWorkRequest}
/// API to monitor the status of the bulk action.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/BulkDeleteResources.cs.html">here</a> to see an example of how to use BulkDeleteResources API.</example>
public async Task<BulkDeleteResourcesResponse> BulkDeleteResources(BulkDeleteResourcesRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called bulkDeleteResources");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/compartments/{compartmentId}/actions/bulkDeleteResources".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<BulkDeleteResourcesResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"BulkDeleteResources failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Deletes the specified tag key definitions. This operation triggers a process that removes the
/// tags from all resources in your tenancy. The tag key definitions must be within the same tag namespace.
/// <br/>
/// The following actions happen immediately:
/// \u00A0
/// * If the tag is a cost-tracking tag, the tag no longer counts against your
/// 10 cost-tracking tags limit, even if you do not disable the tag before running this operation.
/// * If the tag is used with dynamic groups, the rules that contain the tag are no longer
/// evaluated against the tag.
/// <br/>
/// After you start this operation, the state of the tag changes to DELETING, and tag removal
/// from resources begins. This process can take up to 48 hours depending on the number of resources that
/// are tagged and the regions in which those resources reside.
/// <br/>
/// When all tags have been removed, the state changes to DELETED. You cannot restore a deleted tag. After the tag state
/// changes to DELETED, you can use the same tag name again.
/// <br/>
/// After you start this operation, you cannot start either the {@link #deleteTag(DeleteTagRequest) deleteTag} or the {@link #cascadeDeleteTagNamespace(CascadeDeleteTagNamespaceRequest) cascadeDeleteTagNamespace} operation until this process completes.
/// <br/>
/// In order to delete tags, you must first retire the tags. Use {@link #updateTag(UpdateTagRequest) updateTag}
/// to retire a tag.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/BulkDeleteTags.cs.html">here</a> to see an example of how to use BulkDeleteTags API.</example>
public async Task<BulkDeleteTagsResponse> BulkDeleteTags(BulkDeleteTagsRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called bulkDeleteTags");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/tags/actions/bulkDelete".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<BulkDeleteTagsResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"BulkDeleteTags failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Edits the specified list of tag key definitions for the selected resources.
/// This operation triggers a process that edits the tags on all selected resources. The possible actions are:
/// <br/>
/// * Add a defined tag when the tag does not already exist on the resource.
/// * Update the value for a defined tag when the tag is present on the resource.
/// * Add a defined tag when it does not already exist on the resource or update the value for a defined tag when the tag is present on the resource.
/// * Remove a defined tag from a resource. The tag is removed from the resource regardless of the tag value.
/// <br/>
/// See {@link #bulkEditOperationDetails(BulkEditOperationDetailsRequest) bulkEditOperationDetails} for more information.
/// <br/>
/// The edits can include a combination of operations and tag sets.
/// However, multiple operations cannot apply to one key definition in the same request.
/// For example, if one request adds `tag set-1` to a resource and sets a tag value to `tag set-2`,
/// `tag set-1` and `tag set-2` cannot have any common tag definitions.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/BulkEditTags.cs.html">here</a> to see an example of how to use BulkEditTags API.</example>
public async Task<BulkEditTagsResponse> BulkEditTags(BulkEditTagsRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called bulkEditTags");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/tags/actions/bulkEdit".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<BulkEditTagsResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"BulkEditTags failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Moves multiple resources from one compartment to another. All resources must be in the same compartment.
/// This API can only be invoked from the tenancy's [home region](https://docs.cloud.oracle.com/Content/Identity/Tasks/managingregions.htm#Home).
/// To move resources, you must have the appropriate permissions to move the resource in both the source and target
/// compartments. This operation creates a {@link WorkRequest}.
/// Use the {@link #getWorkRequest(GetWorkRequestRequest) getWorkRequest} API to monitor the status of the bulk action.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/BulkMoveResources.cs.html">here</a> to see an example of how to use BulkMoveResources API.</example>
public async Task<BulkMoveResourcesResponse> BulkMoveResources(BulkMoveResourcesRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called bulkMoveResources");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/compartments/{compartmentId}/actions/bulkMoveResources".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<BulkMoveResourcesResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"BulkMoveResources failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Deletes the specified tag namespace. This operation triggers a process that removes all of the tags
/// defined in the specified tag namespace from all resources in your tenancy and then deletes the tag namespace.
/// <br/>
/// After you start the delete operation:
/// <br/>
/// * New tag key definitions cannot be created under the namespace.
/// * The state of the tag namespace changes to DELETING.
/// * Tag removal from the resources begins.
/// <br/>
/// This process can take up to 48 hours depending on the number of tag definitions in the namespace, the number of resources
/// that are tagged, and the locations of the regions in which those resources reside.
/// <br/>
/// After all tags are removed, the state changes to DELETED. You cannot restore a deleted tag namespace. After the deleted tag namespace
/// changes its state to DELETED, you can use the name of the deleted tag namespace again.
/// <br/>
/// After you start this operation, you cannot start either the {@link #deleteTag(DeleteTagRequest) deleteTag} or the {@link #bulkDeleteTags(BulkDeleteTagsRequest) bulkDeleteTags} operation until this process completes.
/// <br/>
/// To delete a tag namespace, you must first retire it. Use {@link #updateTagNamespace(UpdateTagNamespaceRequest) updateTagNamespace}
/// to retire a tag namespace.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CascadeDeleteTagNamespace.cs.html">here</a> to see an example of how to use CascadeDeleteTagNamespace API.</example>
public async Task<CascadeDeleteTagNamespaceResponse> CascadeDeleteTagNamespace(CascadeDeleteTagNamespaceRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called cascadeDeleteTagNamespace");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/tagNamespaces/{tagNamespaceId}/actions/cascadeDelete".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CascadeDeleteTagNamespaceResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CascadeDeleteTagNamespace failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Moves the specified tag namespace to the specified compartment within the same tenancy.
/// <br/>
/// To move the tag namespace, you must have the manage tag-namespaces permission on both compartments.
/// For more information about IAM policies, see [Details for IAM](https://docs.cloud.oracle.com/Content/Identity/Reference/iampolicyreference.htm).
/// <br/>
/// Moving a tag namespace moves all the tag key definitions contained in the tag namespace.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/ChangeTagNamespaceCompartment.cs.html">here</a> to see an example of how to use ChangeTagNamespaceCompartment API.</example>
public async Task<ChangeTagNamespaceCompartmentResponse> ChangeTagNamespaceCompartment(ChangeTagNamespaceCompartmentRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called changeTagNamespaceCompartment");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/tagNamespaces/{tagNamespaceId}/actions/changeCompartment".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<ChangeTagNamespaceCompartmentResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"ChangeTagNamespaceCompartment failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a new auth token for the specified user. For information about what auth tokens are for, see
/// [Managing User Credentials](https://docs.cloud.oracle.com/Content/Identity/Tasks/managingcredentials.htm).
/// <br/>
/// You must specify a *description* for the auth token (although it can be an empty string). It does not
/// have to be unique, and you can change it anytime with
/// {@link #updateAuthToken(UpdateAuthTokenRequest) updateAuthToken}.
/// <br/>
/// Every user has permission to create an auth token for *their own user ID*. An administrator in your organization
/// does not need to write a policy to give users this ability. To compare, administrators who have permission to the
/// tenancy can use this operation to create an auth token for any user, including themselves.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateAuthToken.cs.html">here</a> to see an example of how to use CreateAuthToken API.</example>
public async Task<CreateAuthTokenResponse> CreateAuthToken(CreateAuthTokenRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createAuthToken");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/users/{userId}/authTokens/".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateAuthTokenResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateAuthToken failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a new compartment in the specified compartment.
/// <br/>
/// **Important:** Compartments cannot be deleted.
/// <br/>
/// Specify the parent compartment's OCID as the compartment ID in the request object. Remember that the tenancy
/// is simply the root compartment. For information about OCIDs, see
/// [Resource Identifiers](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm).
/// <br/>
/// You must also specify a *name* for the compartment, which must be unique across all compartments in
/// your tenancy. You can use this name or the OCID when writing policies that apply
/// to the compartment. For more information about policies, see
/// [How Policies Work](https://docs.cloud.oracle.com/Content/Identity/Concepts/policies.htm).
/// <br/>
/// You must also specify a *description* for the compartment (although it can be an empty string). It does
/// not have to be unique, and you can change it anytime with
/// {@link #updateCompartment(UpdateCompartmentRequest) updateCompartment}.
/// <br/>
/// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the
/// object, first make sure its `lifecycleState` has changed to ACTIVE.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateCompartment.cs.html">here</a> to see an example of how to use CreateCompartment API.</example>
public async Task<CreateCompartmentResponse> CreateCompartment(CreateCompartmentRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createCompartment");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/compartments/".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateCompartmentResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateCompartment failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a new secret key for the specified user. Secret keys are used for authentication with the Object Storage Service's Amazon S3
/// compatible API. The secret key consists of an Access Key/Secret Key pair. For information, see
/// [Managing User Credentials](https://docs.cloud.oracle.com/Content/Identity/Tasks/managingcredentials.htm).
/// <br/>
/// You must specify a *description* for the secret key (although it can be an empty string). It does not
/// have to be unique, and you can change it anytime with
/// {@link #updateCustomerSecretKey(UpdateCustomerSecretKeyRequest) updateCustomerSecretKey}.
/// <br/>
/// Every user has permission to create a secret key for *their own user ID*. An administrator in your organization
/// does not need to write a policy to give users this ability. To compare, administrators who have permission to the
/// tenancy can use this operation to create a secret key for any user, including themselves.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateCustomerSecretKey.cs.html">here</a> to see an example of how to use CreateCustomerSecretKey API.</example>
public async Task<CreateCustomerSecretKeyResponse> CreateCustomerSecretKey(CreateCustomerSecretKeyRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createCustomerSecretKey");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/users/{userId}/customerSecretKeys/".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateCustomerSecretKeyResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateCustomerSecretKey failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a new dynamic group in your tenancy.
/// <br/>
/// You must specify your tenancy's OCID as the compartment ID in the request object (remember that the tenancy
/// is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies)
/// reside within the tenancy itself, unlike cloud resources such as compute instances, which typically
/// reside within compartments inside the tenancy. For information about OCIDs, see
/// [Resource Identifiers](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm).
/// <br/>
/// You must also specify a *name* for the dynamic group, which must be unique across all dynamic groups in your
/// tenancy, and cannot be changed. Note that this name has to be also unique across all groups in your tenancy.
/// You can use this name or the OCID when writing policies that apply to the dynamic group. For more information
/// about policies, see [How Policies Work](https://docs.cloud.oracle.com/Content/Identity/Concepts/policies.htm).
/// <br/>
/// You must also specify a *description* for the dynamic group (although it can be an empty string). It does not
/// have to be unique, and you can change it anytime with {@link #updateDynamicGroup(UpdateDynamicGroupRequest) updateDynamicGroup}.
/// <br/>
/// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the
/// object, first make sure its `lifecycleState` has changed to ACTIVE.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateDynamicGroup.cs.html">here</a> to see an example of how to use CreateDynamicGroup API.</example>
public async Task<CreateDynamicGroupResponse> CreateDynamicGroup(CreateDynamicGroupRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createDynamicGroup");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/dynamicGroups/".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateDynamicGroupResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateDynamicGroup failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a new group in your tenancy.
/// <br/>
/// You must specify your tenancy's OCID as the compartment ID in the request object (remember that the tenancy
/// is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies)
/// reside within the tenancy itself, unlike cloud resources such as compute instances, which typically
/// reside within compartments inside the tenancy. For information about OCIDs, see
/// [Resource Identifiers](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm).
/// <br/>
/// You must also specify a *name* for the group, which must be unique across all groups in your tenancy and
/// cannot be changed. You can use this name or the OCID when writing policies that apply to the group. For more
/// information about policies, see [How Policies Work](https://docs.cloud.oracle.com/Content/Identity/Concepts/policies.htm).
/// <br/>
/// You must also specify a *description* for the group (although it can be an empty string). It does not
/// have to be unique, and you can change it anytime with {@link #updateGroup(UpdateGroupRequest) updateGroup}.
/// <br/>
/// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the
/// object, first make sure its `lifecycleState` has changed to ACTIVE.
/// <br/>
/// After creating the group, you need to put users in it and write policies for it.
/// See {@link #addUserToGroup(AddUserToGroupRequest) addUserToGroup} and
/// {@link #createPolicy(CreatePolicyRequest) createPolicy}.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateGroup.cs.html">here</a> to see an example of how to use CreateGroup API.</example>
public async Task<CreateGroupResponse> CreateGroup(CreateGroupRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createGroup");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/groups/".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateGroupResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateGroup failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a new identity provider in your tenancy. For more information, see
/// [Identity Providers and Federation](https://docs.cloud.oracle.com/Content/Identity/Concepts/federation.htm).
/// <br/>
/// You must specify your tenancy's OCID as the compartment ID in the request object.
/// Remember that the tenancy is simply the root compartment. For information about
/// OCIDs, see [Resource Identifiers](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm).
/// <br/>
/// You must also specify a *name* for the `IdentityProvider`, which must be unique
/// across all `IdentityProvider` objects in your tenancy and cannot be changed.
/// <br/>
/// You must also specify a *description* for the `IdentityProvider` (although
/// it can be an empty string). It does not have to be unique, and you can change
/// it anytime with
/// {@link #updateIdentityProvider(UpdateIdentityProviderRequest) updateIdentityProvider}.
/// <br/>
/// After you send your request, the new object's `lifecycleState` will temporarily
/// be CREATING. Before using the object, first make sure its `lifecycleState` has
/// changed to ACTIVE.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateIdentityProvider.cs.html">here</a> to see an example of how to use CreateIdentityProvider API.</example>
public async Task<CreateIdentityProviderResponse> CreateIdentityProvider(CreateIdentityProviderRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createIdentityProvider");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/identityProviders/".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateIdentityProviderResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateIdentityProvider failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a single mapping between an IdP group and an IAM Service
/// {@link Group}.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateIdpGroupMapping.cs.html">here</a> to see an example of how to use CreateIdpGroupMapping API.</example>
public async Task<CreateIdpGroupMappingResponse> CreateIdpGroupMapping(CreateIdpGroupMappingRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createIdpGroupMapping");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/identityProviders/{identityProviderId}/groupMappings/".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateIdpGroupMappingResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateIdpGroupMapping failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a new MFA TOTP device for the user. A user can have one MFA TOTP device.
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateMfaTotpDevice.cs.html">here</a> to see an example of how to use CreateMfaTotpDevice API.</example>
public async Task<CreateMfaTotpDeviceResponse> CreateMfaTotpDevice(CreateMfaTotpDeviceRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createMfaTotpDevice");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/users/{userId}/mfaTotpDevices".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateMfaTotpDeviceResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateMfaTotpDevice failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates a new network source in your tenancy.
/// <br/>
/// You must specify your tenancy's OCID as the compartment ID in the request object (remember that the tenancy
/// is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies)
/// reside within the tenancy itself, unlike cloud resources such as compute instances, which typically
/// reside within compartments inside the tenancy. For information about OCIDs, see
/// [Resource Identifiers](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm).
/// <br/>
/// You must also specify a *name* for the network source, which must be unique across all network sources in your
/// tenancy, and cannot be changed.
/// You can use this name or the OCID when writing policies that apply to the network source. For more information
/// about policies, see [How Policies Work](https://docs.cloud.oracle.com/Content/Identity/Concepts/policies.htm).
/// <br/>
/// You must also specify a *description* for the network source (although it can be an empty string). It does not
/// have to be unique, and you can change it anytime with {@link #updateNetworkSource(UpdateNetworkSourceRequest) updateNetworkSource}.
/// <br/>
/// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the
/// object, first make sure its `lifecycleState` has changed to ACTIVE.
/// <br/>
/// After your network resource is created, you can use it in policy to restrict access to only requests made from an allowed
/// IP address specified in your network source. For more information, see [Managing Network Sources](https://docs.cloud.oracle.com/Content/Identity/Tasks/managingnetworksources.htm).
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateNetworkSource.cs.html">here</a> to see an example of how to use CreateNetworkSource API.</example>
public async Task<CreateNetworkSourceResponse> CreateNetworkSource(CreateNetworkSourceRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createNetworkSource");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/networkSources".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateNetworkSourceResponse>(responseMessage);
}
catch (Exception e)
{
logger.Error($"CreateNetworkSource failed with error: {e.Message}");
throw;
}
}
/// <summary>
/// Creates Oauth token for the user
///
/// </summary>
/// <param name="request">The request object containing the details to send. Required.</param>
/// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
/// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
/// <returns>A response object containing details about the completed operation</returns>
/// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/identity/CreateOAuthClientCredential.cs.html">here</a> to see an example of how to use CreateOAuthClientCredential API.</example>
public async Task<CreateOAuthClientCredentialResponse> CreateOAuthClientCredential(CreateOAuthClientCredentialRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
{
logger.Trace("Called createOAuthClientCredential");
Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/users/{userId}/oauth2ClientCredentials".Trim('/')));
HttpMethod method = new HttpMethod("POST");
HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);
requestMessage.Headers.Add("Accept", "application/json");
GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
HttpResponseMessage responseMessage;
try
{
if (retryingClient != null)
{
responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
}
else
{
responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
}
this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);
return Converter.FromHttpResponseMessage<CreateOAuthClientCredentialResponse>(responseMessage);