Search in sources :

Example 6 with AuthConfigDto

use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.

the class FlowStoreService method getAllStatus.

/**
 * Gets the all status list.
 *
 * @return the all status list
 */
public List<String> getAllStatus() {
    try {
        UrlDto urlDto = storeService.getUrl(StoreType.LINK_STORE, Url.GET_STATUS_LIST);
        AuthConfigDto authDto = authService.getAuth(StoreType.LINK_STORE);
        IAuthService authService = IAuthService.getService(authDto.getAuthType());
        return authService.getResponseList(urlDto, authDto, String.class);
    } catch (Exception e) {
        LOGGER.error("Error occurred while retriving status list", e);
        throw new StoreIntegrationException(e);
    }
}
Also used : UrlDto(org.openkilda.store.model.UrlDto) IAuthService(org.openkilda.integration.auth.service.IAuthService) StoreIntegrationException(org.openkilda.integration.exception.StoreIntegrationException) StoreIntegrationException(org.openkilda.integration.exception.StoreIntegrationException) AuthConfigDto(org.openkilda.store.model.AuthConfigDto)

Example 7 with AuthConfigDto

use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.

the class FlowStoreService method getFlowsWithParams.

/**
 * Gets the flows with params.
 *
 * @param status the status
 * @return the flows with params
 */
public List<InventoryFlow> getFlowsWithParams(final String status) {
    try {
        UrlDto urlDto = storeService.getUrl(StoreType.LINK_STORE, Url.GET_LINKS_WITH_PARAMS);
        Map<String, String> params = new HashMap<String, String>();
        params.put(RequestParams.STATUS.getName(), status);
        urlDto.setParams(params);
        AuthConfigDto authDto = authService.getAuth(StoreType.LINK_STORE);
        IAuthService authService = IAuthService.getService(authDto.getAuthType());
        return authService.getResponseList(urlDto, authDto, InventoryFlow.class);
    } catch (Exception e) {
        LOGGER.error("Error occurred while retriving flows with status: " + status, e);
        throw new StoreIntegrationException(e);
    }
}
Also used : UrlDto(org.openkilda.store.model.UrlDto) HashMap(java.util.HashMap) IAuthService(org.openkilda.integration.auth.service.IAuthService) StoreIntegrationException(org.openkilda.integration.exception.StoreIntegrationException) StoreIntegrationException(org.openkilda.integration.exception.StoreIntegrationException) AuthConfigDto(org.openkilda.store.model.AuthConfigDto)

Example 8 with AuthConfigDto

use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.

the class FlowStoreService method getFlowById.

/**
 * Gets the flow by id.
 *
 * @param flowId the flow id
 * @return the flow by id
 */
public InventoryFlow getFlowById(final String flowId) {
    try {
        UrlDto urlDto = storeService.getUrl(StoreType.LINK_STORE, Url.GET_LINK);
        Map<String, String> params = new HashMap<String, String>();
        params.put(RequestParams.LINK_ID.getName(), flowId);
        urlDto.setParams(params);
        AuthConfigDto authDto = authService.getAuth(StoreType.LINK_STORE);
        IAuthService authService = IAuthService.getService(authDto.getAuthType());
        return authService.getResponse(urlDto, authDto, InventoryFlow.class);
    } catch (Exception e) {
        LOGGER.error("Error occurred while retriving flow by id: " + flowId, e);
        throw new StoreIntegrationException(e);
    }
}
Also used : UrlDto(org.openkilda.store.model.UrlDto) HashMap(java.util.HashMap) IAuthService(org.openkilda.integration.auth.service.IAuthService) StoreIntegrationException(org.openkilda.integration.exception.StoreIntegrationException) StoreIntegrationException(org.openkilda.integration.exception.StoreIntegrationException) AuthConfigDto(org.openkilda.store.model.AuthConfigDto)

Example 9 with AuthConfigDto

use of org.openkilda.store.model.AuthConfigDto in project open-kilda by telstra.

the class SwitchStoreService method getPortFlows.

/**
 * Gets the customer flows.
 *
 * @return the customer with flows
 */
public List<Customer> getPortFlows(String switchId, String port) {
    try {
        UrlDto urlDto = storeService.getUrl(StoreType.SWITCH_STORE, Url.GET_SWITCH_PORT_FLOWS);
        Map<String, String> params = new HashMap<String, String>();
        params.put(RequestParams.SWITCH_ID.getName(), switchId);
        params.put(RequestParams.PORT_NUMBER.getName(), port);
        urlDto.setParams(params);
        AuthConfigDto authDto = authService.getAuth(StoreType.SWITCH_STORE);
        IAuthService authService = IAuthService.getService(authDto.getAuthType());
        return authService.getResponseList(urlDto, authDto, Customer.class);
    } catch (Exception e) {
        LOGGER.error("Error occurred while retriving switch port flows. Switch Id: " + switchId + ", Port: " + port, e);
        throw new StoreIntegrationException(e);
    }
}
Also used : UrlDto(org.openkilda.store.model.UrlDto) HashMap(java.util.HashMap) IAuthService(org.openkilda.integration.auth.service.IAuthService) StoreIntegrationException(org.openkilda.integration.exception.StoreIntegrationException) StoreIntegrationException(org.openkilda.integration.exception.StoreIntegrationException) AuthConfigDto(org.openkilda.store.model.AuthConfigDto)

Aggregations

IAuthService (org.openkilda.integration.auth.service.IAuthService)9 StoreIntegrationException (org.openkilda.integration.exception.StoreIntegrationException)9 AuthConfigDto (org.openkilda.store.model.AuthConfigDto)9 UrlDto (org.openkilda.store.model.UrlDto)9 HashMap (java.util.HashMap)7