Last active
July 16, 2020 08:10
-
-
Save viralmodi/609af972f6f2ae416e6261eba2d043aa to your computer and use it in GitHub Desktop.
List Compartments Using Paginators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
// Using Identity client paginator and its record enumerator to iterate through all compartments | |
var compartments = client.Paginators.ListCompartmentsRecordEnumerator(listCompartmentsRequest); | |
foreach (var compartment in compartments) | |
{ | |
Console.WriteLine("{0, 30} | {1, 60} | {2, 60}", | |
compartment.Name, | |
compartment.Description, | |
compartment.Id); | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Failed to call List Compartments " + e.Message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment