Search in sources :

Example 26 with Azure

use of com.microsoft.azure.management.Azure in project azure-sdk-for-java by Azure.

the class ManageVirtualMachinesInParallelWithNetwork method main.

/**
     * Main entry point.
     * @param args the parameters
     */
public static void main(String[] args) {
    try {
        //=============================================================
        // Authenticate
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
        Azure azure = Azure.configure().withLogLevel(LogLevel.BASIC).authenticate(credFile).withDefaultSubscription();
        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());
        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
Also used : Azure(com.microsoft.azure.management.Azure) File(java.io.File)

Example 27 with Azure

use of com.microsoft.azure.management.Azure in project azure-sdk-for-java by Azure.

the class ManageVirtualNetwork method main.

/**
     * Main entry point.
     * @param args the parameters
     */
public static void main(String[] args) {
    try {
        //=============================================================
        // Authenticate
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
        Azure azure = Azure.configure().withLogLevel(LogLevel.BODY).authenticate(credFile).withDefaultSubscription();
        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());
        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
Also used : Azure(com.microsoft.azure.management.Azure) File(java.io.File)

Example 28 with Azure

use of com.microsoft.azure.management.Azure in project azure-sdk-for-java by Azure.

the class ManageNetworkSecurityGroup method main.

/**
     * Main entry point.
     * @param args the parameters
     */
public static void main(String[] args) {
    try {
        //=============================================================
        // Authenticate
        final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
        Azure azure = Azure.configure().withLogLevel(LogLevel.BASIC).authenticate(credFile).withDefaultSubscription();
        // Print selected subscription
        System.out.println("Selected subscription: " + azure.subscriptionId());
        runSample(azure);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}
Also used : Azure(com.microsoft.azure.management.Azure) File(java.io.File)

Example 29 with Azure

use of com.microsoft.azure.management.Azure in project azure-tools-for-java by Microsoft.

the class AzureSelectDockerHostStep method onRemoveDockerHostAction.

private void onRemoveDockerHostAction() {
    DefaultTableModel tableModel = (DefaultTableModel) dockerHostsTable.getModel();
    String apiURL = (String) tableModel.getValueAt(dockerHostsTable.getSelectedRow(), 4);
    DockerHost deleteHost = dockerManager.getDockerHostForURL(apiURL);
    Azure azureClient = dockerManager.getSubscriptionsMap().get(deleteHost.sid).azureClient;
    int option = AzureDockerUIResources.deleteAzureDockerHostConfirmationDialog(azureClient, deleteHost);
    if (option != 1 && option != 2) {
        if (AzureDockerUtils.DEBUG)
            System.out.format("User canceled delete Docker host op: %d\n", option);
        return;
    }
    AppInsightsClient.createByType(AppInsightsClient.EventType.DockerHost, deleteHost.name, "Remove");
    int currentRow = dockerHostsTable.getSelectedRow();
    tableModel.removeRow(currentRow);
    tableModel.fireTableDataChanged();
    if (dockerHostsTableSelection.row == currentRow) {
        dockerHostsTableSelection = null;
    }
    AzureDockerUIResources.deleteDockerHost(model.getProject(), azureClient, deleteHost, option, new Runnable() {

        @Override
        public void run() {
            dockerManager.refreshDockerHostDetails();
            ApplicationManager.getApplication().invokeLater(new Runnable() {

                @Override
                public void run() {
                    refreshDockerHostsTable();
                }
            });
        }
    });
    setFinishButtonState(doValidate(false) == null);
    setNextButtonState(doValidate(false) == null);
}
Also used : Azure(com.microsoft.azure.management.Azure) DefaultTableModel(javax.swing.table.DefaultTableModel) DockerHost(com.microsoft.azure.docker.model.DockerHost) EditableDockerHost(com.microsoft.azure.docker.model.EditableDockerHost)

Example 30 with Azure

use of com.microsoft.azure.management.Azure in project azure-tools-for-java by Microsoft.

the class CreateRedisCacheForm method onOK.

private void onOK() {
    try {
        Azure azure = azureManager.getAzure(currentSub.getSubscriptionId());
        setSubscription(currentSub);
        ProcessingStrategy processor = RedisCacheUtil.doGetProcessor(azure, skus, redisCacheNameValue, selectedLocationValue, selectedResGrpValue, selectedPriceTierValue, noSSLPort, newResGrp);
        ExecutorService executor = Executors.newSingleThreadExecutor();
        ListeningExecutorService executorService = MoreExecutors.listeningDecorator(executor);
        ListenableFuture<Void> futureTask = executorService.submit(new CreateRedisCallable(processor));
        final ProcessingStrategy processorInner = processor;
        Futures.addCallback(futureTask, new FutureCallback<Void>() {

            @Override
            public void onSuccess(Void arg0) {
                if (onCreate != null) {
                    onCreate.run();
                }
            }

            @Override
            public void onFailure(Throwable throwable) {
                JOptionPane.showMessageDialog(null, throwable.getMessage(), "Error occurred when creating Redis Cache: " + redisCacheNameValue, JOptionPane.ERROR_MESSAGE, null);
                try {
                    // notify the waitting thread the thread being waited incurred exception to clear blocking queue
                    processorInner.notifyCompletion();
                } catch (InterruptedException ex) {
                    String msg = String.format(CREATING_ERROR_INDICATOR, "notifyCompletion", ex.getMessage());
                    PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, ex);
                }
            }
        });
        close(DialogWrapper.OK_EXIT_CODE, true);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : Azure(com.microsoft.azure.management.Azure) ProcessingStrategy(com.microsoft.azuretools.azurecommons.rediscacheprocessors.ProcessingStrategy) IOException(java.io.IOException) ExecutorService(java.util.concurrent.ExecutorService)

Aggregations

Azure (com.microsoft.azure.management.Azure)144 File (java.io.File)75 ArrayList (java.util.ArrayList)20 HashMap (java.util.HashMap)20 ExecutorService (java.util.concurrent.ExecutorService)17 ComputeService (com.vmware.photon.controller.model.resources.ComputeService)16 DiskService (com.vmware.photon.controller.model.resources.DiskService)16 ComputeEnumerateResourceRequest (com.vmware.photon.controller.model.adapterapi.ComputeEnumerateResourceRequest)15 EnumerationAction (com.vmware.photon.controller.model.adapterapi.EnumerationAction)15 AzureUriPaths (com.vmware.photon.controller.model.adapters.azure.AzureUriPaths)15 AzureConstants (com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants)15 AzureResourceType (com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType)15 AzureConstants.getQueryResultLimit (com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.getQueryResultLimit)15 AzureDeferredResultServiceCallback (com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallback)15 Default (com.vmware.photon.controller.model.adapters.azure.utils.AzureDeferredResultServiceCallback.Default)15 AzureSdkClients (com.vmware.photon.controller.model.adapters.azure.utils.AzureSdkClients)15 AzureUtils (com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils)15 AzureUtils.getResourceGroupName (com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils.getResourceGroupName)15 AdapterUtils (com.vmware.photon.controller.model.adapters.util.AdapterUtils)15 ComputeEnumerateAdapterRequest (com.vmware.photon.controller.model.adapters.util.ComputeEnumerateAdapterRequest)15