Search in sources :

Example 1 with Catalog

use of com.microsoft.azuretools.core.mvp.model.container.pojo.Catalog in project azure-tools-for-java by Microsoft.

the class ContainerRegistryPropertyViewPresenter method onListRepositories.

/**
 * Called when listing repositories of ACR.
 */
public void onListRepositories(String sid, String id, boolean isNextPage) {
    if (isSubscriptionIdAndResourceIdInValid(sid, id)) {
        return;
    }
    resetTagStack();
    Observable.fromCallable(() -> {
        Registry registry = ContainerRegistryMvpModel.getInstance().getContainerRegistry(sid, id);
        PrivateRegistryImageSetting setting = ContainerRegistryMvpModel.getInstance().createImageSettingWithRegistry(registry);
        Map<String, String> query = buildQueryMap(isNextPage, repoStack, nextRepo);
        Map<String, String> responseMap = ContainerExplorerMvpModel.getInstance().listRepositories(registry.loginServerUrl(), setting.getUsername(), setting.getPassword(), query);
        updatePaginationInfo(isNextPage, Type.REPO, responseMap.get(HEADER_LINK));
        Gson gson = new Gson();
        Catalog catalog = gson.fromJson(responseMap.get(BODY), Catalog.class);
        return catalog.getRepositories();
    }).subscribeOn(getSchedulerProvider().io()).subscribe(repos -> DefaultLoader.getIdeHelper().invokeLater(() -> {
        if (isViewDetached()) {
            return;
        }
        getMvpView().listRepo(repos);
    }), e -> errorHandler(CANNOT_GET_REPOS, (Exception) e));
}
Also used : PrivateRegistryImageSetting(com.microsoft.azuretools.core.mvp.model.webapp.PrivateRegistryImageSetting) Gson(com.google.gson.Gson) Registry(com.microsoft.azure.management.containerregistry.Registry) Catalog(com.microsoft.azuretools.core.mvp.model.container.pojo.Catalog)

Aggregations

Gson (com.google.gson.Gson)1 Registry (com.microsoft.azure.management.containerregistry.Registry)1 Catalog (com.microsoft.azuretools.core.mvp.model.container.pojo.Catalog)1 PrivateRegistryImageSetting (com.microsoft.azuretools.core.mvp.model.webapp.PrivateRegistryImageSetting)1