use of com.microsoft.intellij.docker.wizards.publish.AzureSelectDockerWizardDialog in project azure-tools-for-java by Microsoft.
the class AzureDockerUIResources method publish2DockerHostContainer.
public static void publish2DockerHostContainer(Project project) {
try {
AzureDockerUIResources.CANCELED = false;
AzureManager azureAuthManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureAuthManager == null) {
System.out.println("ERROR! Not signed in!");
return;
}
AzureDockerHostsManager dockerManager = AzureDockerHostsManager.getAzureDockerHostsManagerEmpty(azureAuthManager);
if (!dockerManager.isInitialized()) {
AzureDockerUIResources.updateAzureResourcesWithProgressDialog(project);
if (AzureDockerUIResources.CANCELED) {
return;
}
}
DockerHost dockerHost = (dockerManager.getDockerPreferredSettings() != null) ? dockerManager.getDockerHostForURL(dockerManager.getDockerPreferredSettings().dockerApiName) : null;
AzureDockerImageInstance dockerImageDescription = dockerManager.getDefaultDockerImageDescription(project.getName(), dockerHost);
AzureSelectDockerWizardModel model = new AzureSelectDockerWizardModel(project, dockerManager, dockerImageDescription);
AzureSelectDockerWizardDialog wizard = new AzureSelectDockerWizardDialog(model);
if (dockerHost != null) {
model.selectDefaultDockerHost(dockerHost, true);
}
wizard.show();
if (wizard.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
try {
String url = wizard.deploy();
if (AzureDockerUtils.DEBUG)
System.out.println("Web app published at: " + url);
} catch (Exception ex) {
PluginUtil.displayErrorDialogAndLog(message("webAppDplyErr"), ex.getMessage(), ex);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.microsoft.intellij.docker.wizards.publish.AzureSelectDockerWizardDialog in project azure-tools-for-java by Microsoft.
the class AzureDockerHostDeployAction method onActionPerformed.
public void onActionPerformed(AnActionEvent actionEvent) {
try {
Project project = getCurrentProject();
if (!AzureSignInAction.doSignIn(AuthMethodManager.getInstance(), project))
return;
AzureDockerUIResources.CANCELED = false;
Module module = PluginUtil.getSelectedModule();
List<Module> modules = Arrays.asList(ModuleManager.getInstance(project).getModules());
if (module == null && modules.isEmpty()) {
Messages.showErrorDialog(message("noModule"), message("error"));
} else if (module == null) {
module = modules.iterator().next();
}
AzureManager azureAuthManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureAuthManager == null) {
System.out.println("ERROR! Not signed in!");
return;
}
AzureDockerHostsManager dockerManager = AzureDockerHostsManager.getAzureDockerHostsManagerEmpty(azureAuthManager);
if (!dockerManager.isInitialized()) {
AzureDockerUIResources.updateAzureResourcesWithProgressDialog(project);
if (AzureDockerUIResources.CANCELED) {
return;
}
}
if (dockerManager.getSubscriptionsMap().isEmpty()) {
PluginUtil.displayErrorDialog("Publish Docker Container", "Please select a subscription first");
return;
}
DockerHost dockerHost = (dockerManager.getDockerPreferredSettings() != null) ? dockerManager.getDockerHostForURL(dockerManager.getDockerPreferredSettings().dockerApiName) : null;
AzureDockerImageInstance dockerImageDescription = dockerManager.getDefaultDockerImageDescription(project.getName(), dockerHost);
AzureSelectDockerWizardModel model = new AzureSelectDockerWizardModel(project, dockerManager, dockerImageDescription);
AzureSelectDockerWizardDialog wizard = new AzureSelectDockerWizardDialog(model);
if (dockerHost != null) {
model.selectDefaultDockerHost(dockerHost, true);
}
wizard.show();
if (wizard.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
try {
String url = wizard.deploy();
System.out.println("Web app published at: " + url);
} catch (Exception ex) {
PluginUtil.displayErrorDialogAndLog(message("webAppDplyErr"), ex.getMessage(), ex);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.microsoft.intellij.docker.wizards.publish.AzureSelectDockerWizardDialog in project azure-tools-for-java by Microsoft.
the class DeployDockerContainerAction method actionPerformed.
@Override
public void actionPerformed(NodeActionEvent e) {
try {
if (!AzureSignInAction.doSignIn(AuthMethodManager.getInstance(), project))
return;
if (dockerManager.getSubscriptionsMap().isEmpty()) {
PluginUtil.displayErrorDialog("Publish Docker Container", "Must select an Azure subscription first");
return;
}
AzureDockerImageInstance dockerImageDescription = dockerManager.getDefaultDockerImageDescription(project.getName(), dockerHost);
AzureSelectDockerWizardModel model = new AzureSelectDockerWizardModel(project, dockerManager, dockerImageDescription);
AzureSelectDockerWizardDialog wizard = new AzureSelectDockerWizardDialog(model);
model.selectDefaultDockerHost(dockerHost, false);
wizard.show();
if (wizard.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
try {
String url = wizard.deploy();
System.out.println("Container published at: " + url);
} catch (Exception ex) {
PluginUtil.displayErrorDialogAndLog(message("webAppDplyErr"), ex.getMessage(), ex);
}
}
} catch (Exception ex1) {
LOGGER.error("actionPerformed", ex1);
ex1.printStackTrace();
}
}
Aggregations