use of com.azure.resourcemanager.resources.fluentcore.arm.ResourceId in project azure-tools-for-java by Microsoft.
the class WebAppBasePropertyViewPresenter method getPublishingProfile.
protected boolean getPublishingProfile(@Nonnull String sid, @Nonnull String webAppId, @Nullable String name, @Nonnull String filePath) throws Exception {
final ResourceId resourceId = ResourceId.fromString(webAppId);
final File file = new File(Paths.get(filePath, String.format("%s_%s.PublishSettings", resourceId.name(), System.currentTimeMillis())).toString());
try {
file.createNewFile();
} catch (final IOException e) {
AzureMessager.getMessager().warning("failed to create publishing profile xml file");
return false;
}
final IAppService resource = getWebAppBase(sid, webAppId, name);
try (final InputStream inputStream = resource.listPublishingProfileXmlWithSecrets();
final OutputStream outputStream = new FileOutputStream(file)) {
IOUtils.copy(inputStream, outputStream);
return true;
} catch (final IOException e) {
AzureMessager.getMessager().warning("failed to get publishing profile xml");
return false;
}
}
use of com.azure.resourcemanager.resources.fluentcore.arm.ResourceId in project azure-tools-for-java by Microsoft.
the class UIHelperImpl method openSqlServerPropertyView.
@Override
public void openSqlServerPropertyView(@NotNull String id, @NotNull Object project) {
EventUtil.executeWithLog(ActionConstants.SqlServer.SHOW_PROPERTIES, (operation) -> {
final ResourceId resourceId = ResourceId.fromString(id);
final FileEditorManager fileEditorManager = getFileEditorManager(resourceId.subscriptionId(), resourceId.id(), (Project) project);
if (fileEditorManager == null) {
return;
}
LightVirtualFile itemVirtualFile = searchExistingFile(fileEditorManager, SqlServerPropertyViewProvider.TYPE, resourceId.id());
if (itemVirtualFile == null) {
itemVirtualFile = createVirtualFile(resourceId.name(), resourceId.subscriptionId(), resourceId.id());
itemVirtualFile.setFileType(new AzureFileType(SqlServerPropertyViewProvider.TYPE, AzureIconLoader.loadIcon(AzureIconSymbol.SqlServer.MODULE)));
}
FileEditor[] editors = fileEditorManager.openFile(itemVirtualFile, true, true);
for (FileEditor editor : editors) {
if (editor.getName().equals(SqlServerPropertyView.ID) && editor instanceof SqlServerPropertyView) {
((SqlServerPropertyView) editor).onReadProperty(resourceId.subscriptionId(), resourceId.resourceGroupName(), resourceId.name());
}
}
});
}
use of com.azure.resourcemanager.resources.fluentcore.arm.ResourceId in project azure-tools-for-java by Microsoft.
the class UIHelperImpl method openMySQLPropertyView.
@Override
public void openMySQLPropertyView(@NotNull String id, @NotNull Object project) {
EventUtil.executeWithLog(ActionConstants.MySQL.SHOW_PROPERTIES, (operation) -> {
final ResourceId resourceId = ResourceId.fromString(id);
final FileEditorManager fileEditorManager = getFileEditorManager(resourceId.subscriptionId(), resourceId.id(), (Project) project);
if (fileEditorManager == null) {
return;
}
LightVirtualFile itemVirtualFile = searchExistingFile(fileEditorManager, MySQLPropertyViewProvider.TYPE, resourceId.id());
if (itemVirtualFile == null) {
itemVirtualFile = createVirtualFile(resourceId.name(), resourceId.subscriptionId(), resourceId.id());
itemVirtualFile.setFileType(new AzureFileType(MySQLPropertyViewProvider.TYPE, AzureIconLoader.loadIcon(AzureIconSymbol.MySQL.MODULE)));
}
FileEditor[] editors = fileEditorManager.openFile(itemVirtualFile, true, true);
for (FileEditor editor : editors) {
if (editor.getName().equals(MySQLPropertyView.ID) && editor instanceof MySQLPropertyView) {
((MySQLPropertyView) editor).onReadProperty(resourceId.subscriptionId(), resourceId.resourceGroupName(), resourceId.name());
}
}
});
}
Aggregations