Class VariablesRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.aem.VariablesRestController
-
- All Implemented Interfaces:
VariablesRestOpenApi
@RestController @RequestMapping("/v2.1.1/configuration-variables/") public class VariablesRestController extends Object implements VariablesRestOpenApi
Variables Rest Controller.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description VariablesRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
createConfigurationVariable(String poolId, String name, String description, int type, boolean masked, String value, String sessionId)
Creates a configuration variable inside a pool.String
createConfigurationVariablesPool(String name, String description, String sessionId)
Creates a pool of configuration variables.void
deleteConfigurationVariable(String name, String userName, String sessionId)
Deletes a configuration variable.void
deleteConfigurationVariablesPool(String poolId, String userName, String sessionId)
Deletes a configuration variables pool.Deleting a pool also deletes the configuration variables contained within.List<ConfigurationVariable>
getAllConfigurationVariables(String sessionId)
Gets all the configuration variables in the database, no matter what pool they belong to.Properties
getConfiguration(String sessionId)
Gets the configuration variables of this manager.ConfigurationVariable
getConfigurationVariable(String name, String sessionId)
Retrieves a configuration variable.List<ConfigurationVariable>
getConfigurationVariablesInPool(String poolId, String sessionId)
Gets the configuration variables in a configuration variable pool.List<InventoryObjectPool>
getConfigurationVariablesPools(String sessionId)
Retrieves the list of pools of configuration variables.List<ConfigurationVariable>
getConfigurationVariablesWithPrefix(String prefix, String sessionId)
Gets the configuration variables with a given prefix.Object
getConfigurationVariableValue(String name, String sessionId)
Retrieves only the value of a configuration variable.void
updateConfigurationVariable(String name, String property, String value, String sessionId)
Updates the value of a configuration variable.See ##createConfigurationVariable(long, java.lang.String, java.lang.String, int, boolean, java.lang.String)
for value definition syntax.void
updateConfigurationVariablesPool(String poolId, String property, String value, String userName, String sessionId)
Updates an attribute of a given configuration variables pool.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and the module id- See Also:
- Constant Field Values
-
-
Method Detail
-
createConfigurationVariable
@RequestMapping(method=POST, value="createConfigurationVariable/{poolId}/{name}/{description}/{type}/{masked}/{value}/{sessionId}", produces="application/json") public long createConfigurationVariable(@PathVariable("poolId") String poolId, @PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("type") int type, @PathVariable("masked") boolean masked, @PathVariable("value") String value, @PathVariable("sessionId") String sessionId)
Creates a configuration variable inside a pool. A configuration variable is a place where a value will be stored so it can retrieved by whomever need it. These variables are typically used to store values that help other modules to work, such as URLs, user names, dimensions, etc.- Specified by:
createConfigurationVariable
in interfaceVariablesRestOpenApi
- Parameters:
poolId
- The id of the pool where the configuration variable will be put.name
- The name of the pool. This value can not be null or empty. Duplicate variable names are not allowed.description
- The description of the what the variable does.type
- The type of the variable. Use 1 for number, 2 for strings, 3 for booleans, 4 for unidimensional arrays and 5 for matrixes.masked
- If the value should be masked when rendered (for security reasons, for example).value
- In most cases (primitive types like numbers, strings or booleans) will be the actual value of the variable as a string (for example "5" or "admin" or "true"). For arrays and matrixes use the following notation:
Arrays: (value1,value2,value3,valueN), matrixes: [(row1col1, row1col2,... row1colN), (row2col1, row2col2,... row2colN), (rowNcol1, rowNcol2,... rowNcolN)]. The values will be interpreted as stringssessionId
- The session token id.- Returns:
- The id of the newly created variable.
-
createConfigurationVariablesPool
@RequestMapping(method=POST, value="createConfigurationVariablesPool/{name}/{description}/{sessionId}", produces="application/json") public String createConfigurationVariablesPool(@PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("sessionId") String sessionId)
Creates a pool of configuration variables.- Specified by:
createConfigurationVariablesPool
in interfaceVariablesRestOpenApi
- Parameters:
name
- The name of the pool. Empty or null values are not allowed.description
- The description of the pool.sessionId
- The session token id.- Returns:
- The id of the newly created pool.
-
updateConfigurationVariable
@RequestMapping(method=PUT, value="updateConfigurationVariable/{name}/{property}/{value}/{sessionId}", produces="application/json") public void updateConfigurationVariable(@PathVariable("name") String name, @PathVariable("property") String property, @PathVariable("value") String value, @PathVariable("sessionId") String sessionId)
Updates the value of a configuration variable.See ##createConfigurationVariable(long, java.lang.String, java.lang.String, int, boolean, java.lang.String)
for value definition syntax.- Specified by:
updateConfigurationVariable
in interfaceVariablesRestOpenApi
- Parameters:
name
- The current name of the variable that will be modified.property
- The name of the property to be updated. Possible values are: "name", "description", "type", "masked" and "value".value
- The new value as string.sessionId
- The session token id.
-
updateConfigurationVariablesPool
@RequestMapping(method=PUT, value="updateConfigurationVariablesPool/{poolId}/{property}/{value}/{userName}/{sessionId}", produces="application/json") public void updateConfigurationVariablesPool(@PathVariable("poolId") String poolId, @PathVariable("property") String property, @PathVariable("value") String value, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Updates an attribute of a given configuration variables pool.- Specified by:
updateConfigurationVariablesPool
in interfaceVariablesRestOpenApi
- Parameters:
poolId
- The id of the pool to update.property
- The property to update. The valid values are "name" and "description".value
- The value of the property to be updated.userName
- The session token user name.sessionId
- The session token id.
-
getConfigurationVariable
@RequestMapping(method=GET, value="getConfigurationVariable/{name}/{sessionId}", produces="application/json") public ConfigurationVariable getConfigurationVariable(@PathVariable("name") String name, @PathVariable("sessionId") String sessionId)
Retrieves a configuration variable.- Specified by:
getConfigurationVariable
in interfaceVariablesRestOpenApi
- Parameters:
name
- The name of the variable to be retrieved.sessionId
- The session token id.- Returns:
- The variable.
-
getConfigurationVariableValue
@RequestMapping(method=GET, value="getConfigurationVariableValue/{name}/{sessionId}", produces="application/json") public Object getConfigurationVariableValue(@PathVariable("name") String name, @PathVariable("sessionId") String sessionId)
Retrieves only the value of a configuration variable. Masked values are returned as null.- Specified by:
getConfigurationVariableValue
in interfaceVariablesRestOpenApi
- Parameters:
name
- The name of the variable. Masked values are returned as null.sessionId
- The session token id.- Returns:
- The value of the variable as a java object/data type. The numbers are returned as floats.
The arrays and matrixes are returned as
ArrayList<String>
andArrayList
instances respectively.
-
getConfigurationVariablesInPool
@RequestMapping(method=GET, value="getConfigurationVariablesInPool/{poolId}/{sessionId}", produces="application/json") public List<ConfigurationVariable> getConfigurationVariablesInPool(@PathVariable("poolId") String poolId, @PathVariable("sessionId") String sessionId)
Gets the configuration variables in a configuration variable pool.- Specified by:
getConfigurationVariablesInPool
in interfaceVariablesRestOpenApi
- Parameters:
poolId
- The id pool to retrieve the variables from.sessionId
- The session token id.- Returns:
- The list of configuration variables in the given pool.
-
getConfigurationVariablesWithPrefix
@RequestMapping(method=GET, value="getConfigurationVariablesWithPrefix/{prefix}/{sessionId}", produces="application/json") public List<ConfigurationVariable> getConfigurationVariablesWithPrefix(@PathVariable("prefix") String prefix, @PathVariable("sessionId") String sessionId)
Gets the configuration variables with a given prefix.- Specified by:
getConfigurationVariablesWithPrefix
in interfaceVariablesRestOpenApi
- Parameters:
prefix
- The prefix of the variables name.sessionId
- The session token id.- Returns:
- The list of configuration variables with the given prefix.
-
getAllConfigurationVariables
@RequestMapping(method=GET, value="getAllConfigurationVariables/{sessionId}", produces="application/json") public List<ConfigurationVariable> getAllConfigurationVariables(@PathVariable("sessionId") String sessionId)
Gets all the configuration variables in the database, no matter what pool they belong to.- Specified by:
getAllConfigurationVariables
in interfaceVariablesRestOpenApi
- Parameters:
sessionId
- The session token id.- Returns:
- The list of existing configuration variables.
-
getConfigurationVariablesPools
@RequestMapping(method=GET, value="getConfigurationVariablesPools/{sessionId}", produces="application/json") public List<InventoryObjectPool> getConfigurationVariablesPools(@PathVariable("sessionId") String sessionId)
Retrieves the list of pools of configuration variables.- Specified by:
getConfigurationVariablesPools
in interfaceVariablesRestOpenApi
- Parameters:
sessionId
- The session token id.- Returns:
- The available pools of configuration variables.
-
getConfiguration
@RequestMapping(method=GET, value="getConfiguration/{sessionId}", produces="application/json") public Properties getConfiguration(@PathVariable("sessionId") String sessionId)
Gets the configuration variables of this manager.- Specified by:
getConfiguration
in interfaceVariablesRestOpenApi
- Parameters:
sessionId
- The session token id.- Returns:
- A Properties object with the configuration variables.
-
deleteConfigurationVariable
@RequestMapping(method=DELETE, value="deleteConfigurationVariable/{name}/{userName}/{sessionId}", produces="application/json") public void deleteConfigurationVariable(@PathVariable("name") String name, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a configuration variable.- Specified by:
deleteConfigurationVariable
in interfaceVariablesRestOpenApi
- Parameters:
name
- The name of the variable to be deleted.userName
- The session token user name.sessionId
- The session token id.
-
deleteConfigurationVariablesPool
@RequestMapping(method=DELETE, value="deleteConfigurationVariablesPool/{poolId}/{userName}/{sessionId}", produces="application/json") public void deleteConfigurationVariablesPool(@PathVariable("poolId") String poolId, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a configuration variables pool.Deleting a pool also deletes the configuration variables contained within.- Specified by:
deleteConfigurationVariablesPool
in interfaceVariablesRestOpenApi
- Parameters:
poolId
- The id of the pool to be deleted.userName
- The session token user name.sessionId
- The session token id.
-
-