private static void ListAgencies(IamClient iamClient) { var listAgenciesRequest = new ListAgenciesRequest() { DomainId = "", TrustDomainId = "", Name = "" }; try { var listAgenciesResponse = iamClient.ListAgencies(listAgenciesRequest); foreach (var agency in listAgenciesResponse.Agencies) { Console.WriteLine(JsonConvert.SerializeObject(agency)); } } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }