@Override public FcNetworkCollection getFcNetworkByFilter( final RestParams params, final Integer start, final Integer count) { logger.info("FcNetworkClientImpl : getFcNetworkByFilter : Start"); final String query = "start=" + start + "&count=" + count; // 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.createRestQueryUrl(params.getHostname(), ResourceUris.FC_NETWORK_URI, query)); final String returnObj = restClient.sendRequestToHPOV(params, null); logger.debug("FcNetworkClientImpl : getFcNetworkByFilter : response from OV :" + returnObj); if (null == returnObj || returnObj.equals("")) { throw new SDKNoResponseException( SDKErrorEnum.noResponseFromAppliance, null, null, null, SdkConstants.FC_NETWORKS, null); } // Call adaptor to convert to DTO final FcNetworkCollection fcNetworkCollectionDto = adaptor.buildCollectionDto(returnObj); logger.debug( "FcNetworkClientImpl : getFcNetworkByFilter : count :" + fcNetworkCollectionDto.getCount()); logger.info("FcNetworkClientImpl : getFcNetworkByFilter : End"); return fcNetworkCollectionDto; }
@Override public FcNetwork getFcNetworkByName(final RestParams params, final String name) { logger.info("FcNetworkClientImpl : getFcNetworkByName : Start"); // final String query = "filter=\"name=\'" + name + "\'\""; final String query = urlUtils.createFilterString(name); // 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.createRestQueryUrl(params.getHostname(), ResourceUris.FC_NETWORK_URI, query)); final String returnObj = restClient.sendRequestToHPOV(params, null); logger.debug("FcNetworkClientImpl : getFcNetworkByName : response from OV :" + returnObj); if (null == returnObj || returnObj.equals("")) { throw new SDKNoResponseException( SDKErrorEnum.noResponseFromAppliance, null, null, null, SdkConstants.FC_NETWORKS, null); } // Call adaptor to convert to DTO final FcNetworkCollection fcNetworkCollectionDto = adaptor.buildCollectionDto(returnObj); FcNetwork fcNetworkDto; if (fcNetworkCollectionDto.getCount() != 0) { fcNetworkDto = fcNetworkCollectionDto.getMembers().get(0); } else { fcNetworkDto = null; } if (fcNetworkDto == null) { logger.error( "FcNetworkClientImpl : getFcNetworkByName : resource not Found for name :" + name); throw new SDKResourceNotFoundException( SDKErrorEnum.resourceNotFound, null, null, null, SdkConstants.FC_NETWORK, null); } logger.info("FcNetworkClientImpl : getFcNetworkByName : End"); return fcNetworkDto; }