use of com.microsoft.azuretools.azurecommons.helpers.Nullable in project azure-tools-for-java by Microsoft.
the class AzureManagerBase method getInsightsManager.
@Nullable
public InsightsManager getInsightsManager(String sid) {
if (!isSignedIn()) {
return null;
}
return sidToInsightsManagerMap.computeIfAbsent(sid, s -> {
// Register insights namespace first
final Azure azure = getAzure(sid);
azure.providers().register(MICROSOFT_INSIGHTS_NAMESPACE);
final String tid = this.subscriptionManager.getSubscriptionTenant(sid);
return authApplicationInsights(sid, tid);
});
}
use of com.microsoft.azuretools.azurecommons.helpers.Nullable in project azure-tools-for-java by Microsoft.
the class AzureManagerBase method getAzure.
@Override
@Nullable
public Azure getAzure(String sid) {
if (!isSignedIn()) {
return null;
}
if (sidToAzureMap.containsKey(sid)) {
return sidToAzureMap.get(sid);
}
final String tid = this.subscriptionManager.getSubscriptionTenant(sid);
final Azure azure = authTenant(tid).withSubscription(sid);
// TODO: remove this call after Azure SDK properly implements handling of unregistered provider namespaces
AzureRegisterProviderNamespaces.registerAzureNamespaces(azure);
sidToAzureMap.put(sid, azure);
return azure;
}
use of com.microsoft.azuretools.azurecommons.helpers.Nullable in project azure-tools-for-java by Microsoft.
the class AzureSparkCosmosCluster method prepareStorageFolder.
@Nullable
public Observable<Boolean> prepareStorageFolder(@NotNull String path) {
return Observable.fromCallable(() -> {
try {
String accessToken = getHttp().getAccessToken();
ADLStoreClient storeClient = ADLStoreClient.createClient(URI.create(this.getStorageAccount().getDefaultContainerOrRootPath()).getHost(), accessToken);
if (storeClient.checkExists(path)) {
return true;
} else {
return storeClient.createDirectory(path);
}
} catch (Exception ex) {
throw new Exception("Failed to create or access spark events log path", ex);
}
});
}
use of com.microsoft.azuretools.azurecommons.helpers.Nullable in project azure-tools-for-java by Microsoft.
the class AzureSparkServerlessAccount method getStorageRootPath.
@Nullable
public String getStorageRootPath() {
String storageRootPath = null;
DataLakeAnalyticsAccount accountDetail = this.getDetailResponse();
if (accountDetail != null) {
// find default storage account name and suffix
String defaultStorageAccountName = accountDetail.defaultDataLakeStoreAccount();
storageRootPath = accountDetail.dataLakeStoreAccounts().stream().filter(info -> info.name().equals(defaultStorageAccountName)).findFirst().map(DataLakeStoreAccountInformation::suffix).map(suffix -> String.format("adl://%s.%s/", defaultStorageAccountName, suffix)).orElse(null);
}
return storageRootPath;
}
use of com.microsoft.azuretools.azurecommons.helpers.Nullable in project azure-tools-for-java by Microsoft.
the class CreateWebAppAction method openDialog.
@AzureOperation(name = "webapp.open_creation_dialog", type = AzureOperation.Type.ACTION)
private void openDialog(final Project project, @Nullable final WebAppConfig data) {
final WebAppCreationDialog dialog = new WebAppCreationDialog(project);
if (Objects.nonNull(data)) {
dialog.setData(data);
}
dialog.setOkActionListener((config) -> {
dialog.close();
this.createWebApp(config).subscribe(webapp -> {
final Path artifact = config.getApplication();
if (Objects.nonNull(artifact) && artifact.toFile().exists()) {
AzureTaskManager.getInstance().runLater("deploy", () -> deploy(webapp, artifact, project));
}
}, (error) -> {
final String title = String.format("Reopen dialog \"%s\"", dialog.getTitle());
final Consumer<Object> act = t -> AzureTaskManager.getInstance().runLater("open dialog", () -> this.openDialog(project, config));
final Action<?> action = new Action<>(act, new ActionView.Builder(title));
AzureMessager.getMessager().error(error, null, action);
});
});
dialog.show();
}
Aggregations