use of com.cloudera.api.swagger.ParcelsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method removeUnusedParcelVersions.
private void removeUnusedParcelVersions(ParcelResourceApi parcelResourceApi, Set<ClouderaManagerProduct> products) throws ApiException {
ParcelsResourceApi parcelsResourceApi = clouderaManagerApiFactory.getParcelsResourceApi(apiClient);
for (ClouderaManagerProduct product : products) {
LOGGER.info("Removing unused {} parcels.", product.getName());
clouderaManagerParcelDecommissionService.removeUnusedParcelVersions(apiClient, parcelsResourceApi, parcelResourceApi, stack, product);
}
}
use of com.cloudera.api.swagger.ParcelsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerParcelsApiListenerTask method pollParcels.
private boolean pollParcels(ClouderaManagerPollerObject pollerObject) throws ApiException {
ParcelsResourceApi parcelsResourceApi = clouderaManagerApiPojoFactory.getParcelsResourceApi(pollerObject.getApiClient());
ApiParcelList apiParcelList = parcelsResourceApi.readParcels(pollerObject.getStack().getName(), "");
return Objects.nonNull(apiParcelList) && CollectionUtils.isNotEmpty(apiParcelList.getItems());
}
use of com.cloudera.api.swagger.ParcelsResourceApi in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method removeUnusedParcels.
@Override
public ParcelOperationStatus removeUnusedParcels(Set<ClusterComponent> usedParcelComponents, Set<String> parcelNamesFromImage) {
ParcelsResourceApi parcelsResourceApi = clouderaManagerApiFactory.getParcelsResourceApi(apiClient);
ParcelResourceApi parcelResourceApi = clouderaManagerApiFactory.getParcelResourceApi(apiClient);
Set<String> usedParcelComponentNames = usedParcelComponents.stream().map(component -> component.getAttributes().getSilent(ClouderaManagerProduct.class).getName()).collect(Collectors.toSet());
ParcelOperationStatus deactivateStatus = clouderaManagerParcelDecommissionService.deactivateUnusedParcels(parcelsResourceApi, parcelResourceApi, stack.getName(), usedParcelComponentNames, parcelNamesFromImage);
ParcelOperationStatus undistributeStatus = clouderaManagerParcelDecommissionService.undistributeUnusedParcels(apiClient, parcelsResourceApi, parcelResourceApi, stack, usedParcelComponentNames, parcelNamesFromImage);
ParcelOperationStatus removalStatus = clouderaManagerParcelDecommissionService.removeUnusedParcels(apiClient, parcelsResourceApi, parcelResourceApi, stack, usedParcelComponentNames, parcelNamesFromImage);
ParcelOperationStatus result = removalStatus.merge(deactivateStatus).merge(undistributeStatus);
LOGGER.info("Result of the parcel removal: {}", result);
return result;
}
Aggregations