Search in sources :

Example 1 with Tag

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

the class ContainerRegistryPropertyViewPresenter method onListTags.

/**
 * Called when listing image tags for the given repository.
 */
public void onListTags(String sid, String id, String repo, 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, tagStack, nextTag);
        Map<String, String> responseMap = ContainerExplorerMvpModel.getInstance().listTags(registry.loginServerUrl(), setting.getUsername(), setting.getPassword(), repo, query);
        updatePaginationInfo(isNextPage, Type.TAG, responseMap.get(HEADER_LINK));
        Gson gson = new Gson();
        Tag tag = gson.fromJson(responseMap.get(BODY), Tag.class);
        return tag.getTags();
    }).subscribeOn(getSchedulerProvider().io()).subscribe(tags -> DefaultLoader.getIdeHelper().invokeLater(() -> {
        if (isViewDetached()) {
            return;
        }
        getMvpView().listTag(tags);
    }), e -> errorHandler(CANNOT_GET_TAGS, (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) Tag(com.microsoft.azuretools.core.mvp.model.container.pojo.Tag)

Aggregations

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