use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.
the class ClusterManager method getClusterDetails.
private List<IClusterDetail> getClusterDetails(List<SubscriptionDetail> subscriptions, final Object project) throws AggregatedException {
ExecutorService taskExecutor = Executors.newFixedThreadPool(MAX_CONCURRENT);
final List<IClusterDetail> cachedClusterList = new ArrayList<>();
final List<Exception> aggregateExceptions = new ArrayList<>();
for (SubscriptionDetail subscription : subscriptions) {
taskExecutor.execute(new CommonRunnable<SubscriptionDetail, Exception>(subscription) {
@Override
public void runSpecificParameter(SubscriptionDetail parameter) throws IOException, HDIException, AzureCmdException {
IClusterOperation clusterOperation = new ClusterOperationImpl(project);
List<ClusterRawInfo> clusterRawInfoList = clusterOperation.listCluster(parameter);
if (clusterRawInfoList != null) {
for (ClusterRawInfo item : clusterRawInfoList) {
IClusterDetail tempClusterDetail = new ClusterDetail(parameter, item);
synchronized (ClusterManager.class) {
cachedClusterList.add(tempClusterDetail);
}
}
}
}
@Override
public void exceptionHandle(Exception e) {
synchronized (aggregateExceptions) {
aggregateExceptions.add(e);
}
}
});
}
taskExecutor.shutdown();
try {
taskExecutor.awaitTermination(TIME_OUT, TimeUnit.SECONDS);
} catch (InterruptedException exception) {
aggregateExceptions.add(exception);
}
if (aggregateExceptions.size() > 0) {
throw new AggregatedException(aggregateExceptions);
}
return cachedClusterList;
}
use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.
the class AppInsightsMngmtPanel method loadInfoFirstTime.
private void loadInfoFirstTime() {
try {
if (AuthMethodManager.getInstance().isSignedIn()) {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
List<SubscriptionDetail> subList = azureManager.getSubscriptionManager().getSubscriptionDetails();
if (subList.size() > 0) {
// if (!AzureSettings.getSafeInstance(myProject).isAppInsightsLoaded()) {
updateApplicationInsightsResourceRegistry(subList, myProject);
} else {
// just show manually added list from preferences
// Neither clear subscription list nor show sign in dialog as user may just want to add key manually.
keeepManuallyAddedList(myProject);
}
// } else {
// show list from preferences - getTableContent() does it. So nothing to handle here
// }
} else {
// just show manually added list from preferences
keeepManuallyAddedList(myProject);
}
} catch (Exception ex) {
AzurePlugin.log(ex.getMessage(), ex);
}
}
use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.
the class ApplicationInsightsNewDialog method subscriptionListener.
private ItemListener subscriptionListener() {
return new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
SubscriptionDetail newSub = (SubscriptionDetail) comboSub.getSelectedItem();
String prevResGrpVal = (String) comboGrp.getSelectedItem();
if (currentSub.equals(newSub)) {
populateResourceGroupValues(currentSub.getSubscriptionId(), prevResGrpVal);
} else {
populateResourceGroupValues(currentSub.getSubscriptionId(), "");
}
currentSub = newSub;
}
};
}
use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.
the class AppServiceCreateDialog method fillAppServicePlanLocations.
protected void fillAppServicePlanLocations() {
int i = comboSubscription.getSelectionIndex();
if (i < 0) {
// empty
System.out.println("No subscription is selected");
return;
}
comboAppServicePlanLocation.removeAll();
binderAppServicePlanLocation = new ArrayList<Location>();
//List<Location> locl = AzureModel.getInstance().getSubscriptionToLocationMap().get(binderSubscriptionDetails.get(i));
Map<SubscriptionDetail, List<Location>> sdlocMap = AzureModel.getInstance().getSubscriptionToLocationMap();
SubscriptionDetail sd = binderSubscriptionDetails.get(i);
List<Location> locl = sdlocMap.get(sd);
comboAppServicePlanLocation.add("<select location>");
binderAppServicePlanLocation.add(null);
for (Location loc : locl) {
comboAppServicePlanLocation.add(loc.displayName());
binderAppServicePlanLocation.add(loc);
}
if (comboAppServicePlanLocation.getItemCount() > 0) {
comboAppServicePlanLocation.select(0);
}
}
use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.
the class SubscriptionStep method loadSubscriptions.
private void loadSubscriptions() {
try {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureManager == null) {
model.getCurrentNavigationState().NEXT.setEnabled(false);
return;
}
SubscriptionManager subscriptionManager = azureManager.getSubscriptionManager();
List<SubscriptionDetail> subscriptionDetails = subscriptionManager.getSubscriptionDetails();
List<SubscriptionDetail> selectedSubscriptions = subscriptionDetails.stream().filter(SubscriptionDetail::isSelected).collect(Collectors.toList());
subscriptionComboBox.setModel(new DefaultComboBoxModel<>(selectedSubscriptions.toArray(new SubscriptionDetail[selectedSubscriptions.size()])));
if (selectedSubscriptions.size() > 0) {
model.setSubscription(selectedSubscriptions.get(0));
}
} catch (Exception ex) {
DefaultLoader.getUIHelper().logError("An error occurred when trying to load Subscriptions\n\n" + ex.getMessage(), ex);
}
// if (manager.authenticated()) {
// String upn = manager.getUserInfo().getUniqueName();
// userInfoLabel.setText("Signed in as: " + (upn.contains("#") ? upn.split("#")[1] : upn));
// } else {
// userInfoLabel.setText("");
// }
}
Aggregations