Search in sources :

Example 11 with ClientStorageAccount

use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.

the class ExternalStorageAccountForm method getFullStorageAccount.

public ClientStorageAccount getFullStorageAccount() {
    ClientStorageAccount clientStorageAccount = new ClientStorageAccount(accountNameTextField.getText());
    clientStorageAccount.setPrimaryKey(accountKeyTextField.getText());
    clientStorageAccount.setUseCustomEndpoints(specifyCustomEndpointsRadioButton.isSelected());
    if (specifyCustomEndpointsRadioButton.isSelected()) {
        clientStorageAccount.setBlobsUri(blobURLTextField.getText());
        clientStorageAccount.setQueuesUri(queueURLTextField.getText());
        clientStorageAccount.setTablesUri(tableURLTextField.getText());
    } else {
        clientStorageAccount.setProtocol(useHTTPRadioButton.isSelected() ? HTTP : HTTPS);
    }
    return clientStorageAccount;
}
Also used : ClientStorageAccount(com.microsoft.tooling.msservices.model.storage.ClientStorageAccount)

Example 12 with ClientStorageAccount

use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.

the class ExternalStorageHelper method getList.

public static List<ClientStorageAccount> getList(Object projectObject) {
    List<ClientStorageAccount> list = new ArrayList<ClientStorageAccount>();
    String[] storageArray = DefaultLoader.getIdeHelper().getProperties(EXTERNAL_STORAGE_LIST, projectObject);
    if (storageArray != null) {
        for (String json : storageArray) {
            ClientStorageAccount clientStorageAccount = new Gson().fromJson(json, ClientStorageAccount.class);
            list.add(clientStorageAccount);
        }
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) ClientStorageAccount(com.microsoft.tooling.msservices.model.storage.ClientStorageAccount) Gson(com.google.gson.Gson)

Example 13 with ClientStorageAccount

use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.

the class AttachExternalStorageAccountAction method actionPerformed.

@Override
public void actionPerformed(NodeActionEvent e) {
    final ExternalStorageAccountForm form = new ExternalStorageAccountForm(PluginUtil.getParentShell(), "Attach External Storage Account");
    form.setOnFinish(new Runnable() {

        @Override
        public void run() {
            DefaultLoader.getIdeHelper().invokeLater(new Runnable() {

                public void run() {
                    ClientStorageAccount storageAccount = form.getStorageAccount();
                    ClientStorageAccount fullStorageAccount = form.getFullStorageAccount();
                    for (ClientStorageAccount clientStorageAccount : ExternalStorageHelper.getList(null)) {
                        String name = storageAccount.getName();
                        if (clientStorageAccount.getName().equals(name)) {
                            DefaultLoader.getUIHelper().showError("Storage account with name '" + name + "' already exists.", "Service Explorer");
                            return;
                        }
                    }
                    ExternalStorageNode node = new ExternalStorageNode(storageModule, fullStorageAccount);
                    storageModule.addChildNode(node);
                    ExternalStorageHelper.add(storageAccount);
                }
            });
        }
    });
    form.open();
}
Also used : ClientStorageAccount(com.microsoft.tooling.msservices.model.storage.ClientStorageAccount) ExternalStorageAccountForm(com.microsoft.azuretools.azureexplorer.forms.ExternalStorageAccountForm) ExternalStorageNode(com.microsoft.tooling.msservices.serviceexplorer.azure.storage.ExternalStorageNode)

Aggregations

ClientStorageAccount (com.microsoft.tooling.msservices.model.storage.ClientStorageAccount)13 ExternalStorageNode (com.microsoft.tooling.msservices.serviceexplorer.azure.storage.ExternalStorageNode)4 ExternalStorageAccountForm (com.microsoft.intellij.forms.ExternalStorageAccountForm)3 ArrayList (java.util.ArrayList)3 StorageAccount (com.microsoft.azure.management.storage.StorageAccount)2 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)2 Gson (com.google.gson.Gson)1 HDIException (com.microsoft.azure.hdinsight.sdk.common.HDIException)1 HDStorageAccount (com.microsoft.azure.hdinsight.sdk.storage.HDStorageAccount)1 Azure (com.microsoft.azure.management.Azure)1 SubscriptionManager (com.microsoft.azuretools.authmanage.SubscriptionManager)1 NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)1 ExternalStorageAccountForm (com.microsoft.azuretools.azureexplorer.forms.ExternalStorageAccountForm)1 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)1 BlobContainer (com.microsoft.tooling.msservices.model.storage.BlobContainer)1 StorageModule (com.microsoft.tooling.msservices.serviceexplorer.azure.storage.StorageModule)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 HashMap (java.util.HashMap)1 Matcher (java.util.regex.Matcher)1