Class DefaultDeviceConfigRestService
- java.lang.Object
-
- org.opennms.features.deviceconfig.rest.impl.DefaultDeviceConfigRestService
-
- All Implemented Interfaces:
DeviceConfigRestService
public class DefaultDeviceConfigRestService extends Object implements DeviceConfigRestService
-
-
Field Summary
Fields Modifier and Type Field Description static String
BINARY_ENCODING
static String
DEFAULT_ENCODING
-
Constructor Summary
Constructors Constructor Description DefaultDeviceConfigRestService(DeviceConfigDao deviceConfigDao, DeviceConfigService deviceConfigService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
createDownloadFileName(String deviceName, String ipAddress, String configType, Date createdTime)
void
deleteDeviceConfig(long id)
Delete a single device config.javax.ws.rs.core.Response
downloadDeviceConfig(String id)
Download configurations for the given id or comma-separated list of ids.javax.ws.rs.core.Response
getDeviceConfig(long id)
Get device config info for a single item, by DeviceConfig id.javax.ws.rs.core.Response
getDeviceConfigs(Integer limit, Integer offset, String orderBy, String order, String deviceName, String ipAddress, Integer ipInterfaceId, String configType, Set<DeviceConfigStatus> statuses, Long createdAfter, Long createdBefore)
Gets a list of device configs along with backup schedule information.javax.ws.rs.core.Response
getDeviceConfigsByInterface(Integer ipInterfaceId, String configType)
Get a list of device configs for a given IP interface id.javax.ws.rs.core.Response
getLatestDeviceConfigsForDeviceAndConfigType(Integer limit, Integer offset, String orderBy, String order, String searchTerm, Set<DeviceConfigStatus> statuses)
Gets the most recent device config for each device / config type combination.javax.ws.rs.core.Response
triggerDeviceConfigBackup(List<BackupRequestDTO> backupRequestDtoList)
-
-
-
Field Detail
-
DEFAULT_ENCODING
public static final String DEFAULT_ENCODING
-
BINARY_ENCODING
public static final String BINARY_ENCODING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultDeviceConfigRestService
public DefaultDeviceConfigRestService(DeviceConfigDao deviceConfigDao, DeviceConfigService deviceConfigService)
-
-
Method Detail
-
getDeviceConfig
public javax.ws.rs.core.Response getDeviceConfig(long id)
Get device config info for a single item, by DeviceConfig id.- Specified by:
getDeviceConfig
in interfaceDeviceConfigRestService
- Parameters:
id
- database id of device config
-
getDeviceConfigs
public javax.ws.rs.core.Response getDeviceConfigs(Integer limit, Integer offset, String orderBy, String order, String deviceName, String ipAddress, Integer ipInterfaceId, String configType, Set<DeviceConfigStatus> statuses, Long createdAfter, Long createdBefore)
Gets a list of device configs along with backup schedule information.- Specified by:
getDeviceConfigs
in interfaceDeviceConfigRestService
- Parameters:
limit
- used for paging; defaults to 10offset
- used for paging; defaults to 0orderBy
- used for sorting. Valid values are 'lastUpdated', 'deviceName', 'lastBackup' and 'ipAddress'. Defaults to 'lastUpdated'order
- used for sorting; valid values are 'asc' and 'desc', defaults to 'desc'deviceName
- filter results by device name. Should use 'searchTerm' instead.ipAddress
- filter results by device IP address. Should use 'searchTerm' instead.ipInterfaceId
- database id of OnmsIpInterface instance. This will retrieve a record history.configType
- Configuration type, typically 'default' or 'running'createdAfter
- If set, only return items with saved backup after this date in epoch milliscreatedBefore
- If set, only return items with saved backup before this date in epoch millis- Returns:
- Json response containing a list of device configs in the
shape of
DeviceConfigDTO
-
getLatestDeviceConfigsForDeviceAndConfigType
public javax.ws.rs.core.Response getLatestDeviceConfigsForDeviceAndConfigType(Integer limit, Integer offset, String orderBy, String order, String searchTerm, Set<DeviceConfigStatus> statuses)
Gets the most recent device config for each device / config type combination. Typically called by UI to get latest status.- Specified by:
getLatestDeviceConfigsForDeviceAndConfigType
in interfaceDeviceConfigRestService
- Parameters:
limit
- used for paging; defaults to 10offset
- used for paging; defaults to 0orderBy
- used for sorting. Valid values are 'lastUpdated', 'deviceName', 'lastBackup' and 'ipAddress'. Defaults to 'lastUpdated'order
- used for sorting; valid values are 'asc' and 'desc', defaults to 'desc'searchTerm
- A search term, currently to search by device name or IP address.statuses
- An optional set ofDeviceConfigStatus
values. If supplied, only return records with any of the given statuses; defaults to returning all values.
-
getDeviceConfigsByInterface
public javax.ws.rs.core.Response getDeviceConfigsByInterface(Integer ipInterfaceId, String configType)
Get a list of device configs for a given IP interface id. This is a history of configs for a particular device. Returns all config types by default, use 'configType' to filter.- Specified by:
getDeviceConfigsByInterface
in interfaceDeviceConfigRestService
-
deleteDeviceConfig
public void deleteDeviceConfig(long id)
Delete a single device config.- Specified by:
deleteDeviceConfig
in interfaceDeviceConfigRestService
-
downloadDeviceConfig
public javax.ws.rs.core.Response downloadDeviceConfig(String id)
Download configurations for the given id or comma-separated list of ids. Single configurations will be returned as a single file. Multiple configurations will be returned inside a .tgz file.- Specified by:
downloadDeviceConfig
in interfaceDeviceConfigRestService
-
createDownloadFileName
public static String createDownloadFileName(String deviceName, String ipAddress, String configType, Date createdTime)
-
triggerDeviceConfigBackup
public javax.ws.rs.core.Response triggerDeviceConfigBackup(List<BackupRequestDTO> backupRequestDtoList)
- Specified by:
triggerDeviceConfigBackup
in interfaceDeviceConfigRestService
-
-