Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
List Regions Example
private static async Task ListOciRegions()
{
// Accepts profile name and creates a auth provider based on config file
var authProvider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
// Create a client for the service to enable using its APIs
var client = new IdentityClient(authProvider);
// List regions
var listRegionsRequest = new ListRegionsRequest();
try
{
Task <ListRegionsResponse> regRespTask = client.ListRegions(listRegionsRequest);
var listRegionsResponse = await regRespTask;
foreach (Oci.IdentityService.Models.Region reg in listRegionsResponse.Items)
{
Console.WriteLine(reg.Key + " : " + reg.Name);
}
}
catch (Exception e)
{
Console.WriteLine("Failed to call List Regions "+e.Message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment