use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class ExternalStorageAccountForm method populateFullStorageAccount.
public void populateFullStorageAccount() {
ClientStorageAccount clientStorageAccount = new ClientStorageAccount(accountNameTextField.getText());
clientStorageAccount.setPrimaryKey(accountKeyTextField.getText());
clientStorageAccount.setUseCustomEndpoints(specifyCustomEndpointsRadioButton.getSelection());
if (specifyCustomEndpointsRadioButton.getSelection()) {
clientStorageAccount.setBlobsUri(blobURLTextField.getText());
clientStorageAccount.setQueuesUri(queueURLTextField.getText());
clientStorageAccount.setTablesUri(tableURLTextField.getText());
} else {
clientStorageAccount.setProtocol(useHTTPRadioButton.getSelection() ? HTTP : HTTPS);
}
fullStorageAccount = clientStorageAccount;
}
use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class ExternalStorageAccountForm method getStorageAccount.
public ClientStorageAccount getStorageAccount() {
ClientStorageAccount clientStorageAccount = new ClientStorageAccount(accountNameTextField.getText());
clientStorageAccount.setUseCustomEndpoints(specifyCustomEndpointsRadioButton.isSelected());
if (rememberAccountKeyCheckBox.isSelected()) {
clientStorageAccount.setPrimaryKey(accountKeyTextField.getText());
}
if (specifyCustomEndpointsRadioButton.isSelected()) {
clientStorageAccount.setBlobsUri(blobURLTextField.getText());
clientStorageAccount.setQueuesUri(queueURLTextField.getText());
clientStorageAccount.setTablesUri(tableURLTextField.getText());
} else {
clientStorageAccount.setProtocol(useHTTPRadioButton.isSelected() ? HTTP : HTTPS);
}
return clientStorageAccount;
}
use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class ModifyExternalStorageAccountAction method actionPerformed.
@Override
public void actionPerformed(NodeActionEvent e) {
final ExternalStorageAccountForm form = new ExternalStorageAccountForm((Project) storageNode.getProject());
form.setTitle("Modify External Storage Account");
for (ClientStorageAccount account : ExternalStorageHelper.getList(storageNode.getProject())) {
if (account.getName().equals(storageNode.getClientStorageAccount().getName())) {
form.setStorageAccount(account);
}
}
form.setOnFinish(new Runnable() {
@Override
public void run() {
ClientStorageAccount oldStorageAccount = storageNode.getClientStorageAccount();
ClientStorageAccount storageAccount = StorageClientSDKManager.getManager().getStorageAccount(form.getStorageAccount().getConnectionString());
ClientStorageAccount fullStorageAccount = form.getFullStorageAccount();
StorageModule parent = (StorageModule) storageNode.getParent();
parent.removeDirectChildNode(storageNode);
parent.addChildNode(new ExternalStorageNode(parent, fullStorageAccount));
ExternalStorageHelper.detach(oldStorageAccount);
ExternalStorageHelper.add(form.getStorageAccount());
}
});
form.show();
}
use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class ConfirmDialogAction method actionPerformed.
@Override
public void actionPerformed(NodeActionEvent e) {
final ExternalStorageNode node = (ExternalStorageNode) e.getAction().getNode();
final ExternalStorageAccountForm form = new ExternalStorageAccountForm((Project) node.getProject());
form.setTitle("Storage Account Key Required");
form.setStorageAccount(node.getClientStorageAccount());
form.setOnFinish(new Runnable() {
@Override
public void run() {
node.getClientStorageAccount().setPrimaryKey(form.getPrimaryKey());
ClientStorageAccount clientStorageAccount = StorageClientSDKManager.getManager().getStorageAccount(node.getClientStorageAccount().getConnectionString());
node.getClientStorageAccount().setPrimaryKey(clientStorageAccount.getPrimaryKey());
node.getClientStorageAccount().setBlobsUri(clientStorageAccount.getBlobsUri());
node.getClientStorageAccount().setQueuesUri(clientStorageAccount.getQueuesUri());
node.getClientStorageAccount().setTablesUri(clientStorageAccount.getTablesUri());
node.load(false);
}
});
form.show();
}
use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class StorageModule method refreshItems.
@Override
protected void refreshItems() throws AzureCmdException {
List<Pair<String, String>> failedSubscriptions = new ArrayList<>();
try {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureManager == null) {
return;
}
SubscriptionManager subscriptionManager = azureManager.getSubscriptionManager();
Set<String> sidList = subscriptionManager.getAccountSidList();
for (String sid : sidList) {
try {
Azure azure = azureManager.getAzure(sid);
List<com.microsoft.azure.management.storage.StorageAccount> storageAccounts = azure.storageAccounts().list();
for (StorageAccount sm : storageAccounts) {
addChildNode(new StorageNode(this, sid, sm));
}
} catch (Exception ex) {
failedSubscriptions.add(new ImmutablePair<>(sid, ex.getMessage()));
continue;
}
}
} catch (Exception ex) {
DefaultLoader.getUIHelper().logError("An error occurred when trying to load Storage Accounts\n\n" + ex.getMessage(), ex);
}
// load External Accounts
for (ClientStorageAccount clientStorageAccount : ExternalStorageHelper.getList(getProject())) {
ClientStorageAccount storageAccount = StorageClientSDKManager.getManager().getStorageAccount(clientStorageAccount.getConnectionString());
// addChildNode(new ExternalStorageNode(this, storageAccount));
}
if (!failedSubscriptions.isEmpty()) {
StringBuilder errorMessage = new StringBuilder("An error occurred when trying to load Storage Accounts for the subscriptions:\n\n");
for (Pair error : failedSubscriptions) {
errorMessage.append(error.getKey()).append(": ").append(error.getValue()).append("\n");
}
DefaultLoader.getUIHelper().logError("An error occurred when trying to load Storage Accounts\n\n" + errorMessage.toString(), null);
}
}
Aggregations