use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.
the class SubscriptionManager method updateAccountSubscriptionList.
protected List<SubscriptionDetail> updateAccountSubscriptionList() throws IOException {
System.out.println(Thread.currentThread().getId() + " SubscriptionManager.updateAccountSubscriptionList()");
if (azureManager == null) {
throw new IllegalArgumentException("azureManager is null");
}
System.out.println("Getting subscription list from Azure");
List<SubscriptionDetail> sdl = new ArrayList<>();
List<Pair<Subscription, Tenant>> stpl = azureManager.getSubscriptionsWithTenant();
for (Pair<Subscription, Tenant> stp : stpl) {
sdl.add(new SubscriptionDetail(stp.first().subscriptionId(), stp.first().displayName(), stp.second().tenantId(), true));
}
return sdl;
}
use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.
the class SubscriptionManagerPersist method loadSubscriptions.
private static List<SubscriptionDetail> loadSubscriptions(String subscriptionsDetailsFileName) throws IOException {
System.out.println("SubscriptionManagerPersist.loadSubscriptions()");
//subscriptionDetails.clear();
FileStorage subscriptionsDetailsFileStorage = new FileStorage(subscriptionsDetailsFileName, CommonSettings.settingsBaseDir);
byte[] data = subscriptionsDetailsFileStorage.read();
String json = new String(data, StandardCharsets.UTF_8);
if (json.isEmpty()) {
System.out.println(subscriptionsDetailsFileName + " file is empty");
return null;
}
SubscriptionDetail[] sda = JsonHelper.deserialize(SubscriptionDetail[].class, json);
List<SubscriptionDetail> sdl = new ArrayList<>();
for (SubscriptionDetail sd : sda) {
sdl.add(sd);
}
return sdl;
}
Aggregations