@Override public FwBaseline getFirmwareDriver(final RestParams params, final String resourceId) { logger.info("FirmwareDriverClientImpl : getFirmwareDriver : Start"); // validate args if (null == params) { throw new SDKInvalidArgumentException( SDKErrorEnum.invalidArgument, null, null, null, SdkConstants.APPLIANCE, null); } // set the additional params params.setType(HttpMethodType.GET); params.setUrl( urlUtils.createRestUrl(params.getHostname(), ResourceUris.FIRMWARE_DRIVER_URI, resourceId)); final String returnObj = restClient.sendRequestToHPOV(params, null); logger.debug("FirmwareDriverClientImpl : getFirmwareDriver : response from OV :" + returnObj); if (null == returnObj || returnObj.equals("")) { throw new SDKNoResponseException( SDKErrorEnum.noResponseFromAppliance, null, null, null, SdkConstants.FIRMWARE_DRIVER, null); } // Call adaptor to convert to DTO final FwBaseline fwBaselineDto = adaptor.buildDto(returnObj); logger.debug("FirmwareDriverClientImpl : getFirmwareDriver : name :" + fwBaselineDto.getName()); logger.info("FirmwareDriverClientImpl : getFirmwareDriver : End"); return fwBaselineDto; }
@Override public String getId(final RestParams creds, final String name) { String resourceId = ""; // fetch resource Id using resource name FwBaseline fwBaselineDto = getFirmwareDriverByName(creds, name); if (null != fwBaselineDto.getUri()) { resourceId = urlUtils.getResourceIdFromUri(fwBaselineDto.getUri()); } return resourceId; }
@Override public FwBaseline getFirmwareDriverByName(final RestParams params, final String firmwareName) { logger.info("FirmwareDriverClientImpl : getFirmwareDriverByName : Start"); // validate args if (null == params) { throw new SDKInvalidArgumentException( SDKErrorEnum.invalidArgument, null, null, null, SdkConstants.APPLIANCE, null); } final FwBaselineCollection fwBaselineCollectionDto = getAllFirmwareDrivers(params); for (final FwBaseline fwBaselineDto : new ArrayList<>(fwBaselineCollectionDto.getMembers())) { if ((fwBaselineDto.getName().replaceAll(" ", "")) .equalsIgnoreCase((firmwareName.replaceAll(" ", "")))) { System.out.println(fwBaselineDto.getName()); logger.info("FirmwareDriverClientImpl : getFirmwareDriverByName : End"); return fwBaselineDto; } } logger.error( "FirmwareDriverClientImpl : getFirmwareDriverByName : resource not Found for name :" + firmwareName); throw new SDKResourceNotFoundException( SDKErrorEnum.invalidArgument, null, null, null, SdkConstants.FIRMWARE_DRIVER, null); }