public class CSApiKey extends CSItem
The CSApiKey
class includes methods for the retrieval of a particular link's details.
All such methods require that certain database and key information (name or ApiKey for example) be specified via the
set
methods provided, prior to their invocation.
All database access/connectivity is handled internally by the CSApiKey
class.
IP Rules: By default this list is the same as those defaulted to in iCM: 127.0.0.1/32, ::1/128, 172.16.0.0/12, 192.168.0.0/16, and 10.0.0.0/8. Setting a new list of IP rules will override this.
CSApiKeyContent
,
Serialized FormACCESS_GRANTED, DOES_NOT_EXIST, EMPTY, EXISTS, SECURE_ACCESS_DENIED, SECURE_ACCESS_GRANTED, UPDATE_ACTION_INSERTED, UPDATE_ACTION_UPDATED
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSApiKey()
Creates an empty
CSApiKey object. |
CSApiKey(java.lang.String strPropertyFile)
Creates a new
CSApiKey object, specifying a property file that contains all of the required database
connection details. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a duplicate of this
CSDatabaseItem object. |
void |
delete()
Allows deletion of an Api Key using (
setApiKey(UUID) ), or setName(String)
as key information. |
void |
get()
Given an Api Key (
setApiKey(UUID) ), supports resolving that to an
Api Key Name setName(String) and vice versa at a detail level of
CSDatabaseItem.LEVEL_ID . |
java.util.UUID |
getApiKey()
Gets the Api Key currently specified as key information.
|
java.lang.String |
getComments()
Returns comments associated with the Api Key
|
java.util.Date |
getCreated()
Returns the Api Key's created timestamp
|
boolean |
getEnabled()
Returns whether the Api Key is enabled
|
java.util.List<CSApiKeyIpRule> |
getIpRules()
Returns a list of
CSApiKeyIpRule s associated with the Api Key. |
boolean |
getKeyless()
Returns whether the Api Key is keyless
|
java.lang.String |
getName()
Gets the Api Key name currently specified as key information.
|
boolean |
getProtected()
Returns whether the Api Key is protected
|
java.util.List<CSApiKeyWorker> |
getWorkers()
Returns a list of
CSApiKeyWorker s to associate with the Api Key. |
void |
setApiKey(java.util.UUID apiKey)
Sets the Api Key to be used as key information
setApiKey followed by a call to get will return details of the Api Key with the
specified Api Key value. |
void |
setComments(java.lang.String comments)
Sets comments associated with the Api Key
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setEnabled(boolean enabled)
Sets whether the Api Key is enabled
|
void |
setIpRules(java.util.List<CSApiKeyIpRule> ipRules)
Sets a list of
CSApiKeyIpRule s to associate with the Api Key. |
void |
setKeyless(boolean keyless)
Sets whether the Api Key is keyless
|
void |
setName(java.lang.String name)
Sets the Api Key name to be used as key information.
|
void |
setProtected(boolean bProtected)
Sets whether the Api Key is protected
|
void |
setWorkers(java.util.List<CSApiKeyWorker> workers)
Sets a list of
CSApiKeyWorker s to associate with the Api Key. |
java.lang.String |
toString()
Provides debug information on the contents of the
CSApiKey object. |
void |
update()
Updates an Api Key on the database.
|
equals, exist, getID, getStatus, hashCode, jsonString, serialiseWithTypes, setID, setStatus, unset
clearRecordedGatewayMessages, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSApiKey()
CSApiKey
object.
Use the various set
methods provided to initialise the CSApiKey
object prior to
invoking any of its query methods.
public CSApiKey(java.lang.String strPropertyFile)
CSApiKey
object, specifying a property file that contains all of the required database
connection details.
Use the various set methods provided to initialise the CSApiKey
object prior to invoking any of its
query manipulation methods.
strPropertyFile
- the property file that contains the connection details.public void setName(java.lang.String name)
setName
followed by a call to get
will return details of the Api Key with the
specified name.
name
- The Api Key name, to be used as key informationpublic java.lang.String getName()
public java.util.UUID getApiKey()
public void setApiKey(java.util.UUID apiKey)
setApiKey
followed by a call to get
will return details of the Api Key with the
specified Api Key value.
apiKey
- The Api Key to set as key informationpublic boolean getEnabled()
public void setEnabled(boolean enabled)
enabled
- Whether the Api Key is enabledpublic boolean getProtected()
public void setProtected(boolean bProtected)
bProtected
- Whether the Api Key is protectedpublic boolean getKeyless()
public void setKeyless(boolean keyless)
keyless
- Whether the Api Key is keylesspublic java.util.Date getCreated()
public java.lang.String getComments()
public void setComments(java.lang.String comments)
comments
- Comments associated with the Api Keypublic java.util.List<CSApiKeyIpRule> getIpRules()
CSApiKeyIpRule
s associated with the Api Key.CSApiKeyIpRule
s associated with the Api Key.public void setIpRules(java.util.List<CSApiKeyIpRule> ipRules)
CSApiKeyIpRule
s to associate with the Api Key.
By default this list is the same as those defaulted to in iCM: 127.0.0.1/32, ::1/128, 172.16.0.0/12,
192.168.0.0/16, and 10.0.0.0/8. Setting a new list of IP rules will override this.ipRules
- A list of CSApiKeyIpRule
s to associate with the Api Key.public java.util.List<CSApiKeyWorker> getWorkers()
CSApiKeyWorker
s to associate with the Api Key.CSApiKeyWorker
s to associate with the Api Key.public void setWorkers(java.util.List<CSApiKeyWorker> workers)
CSApiKeyWorker
s to associate with the Api Key.workers
- A list of CSApiKeyWorker
s to associate with the Api Key.public void setDetailLevel(int nDetailLevel) throws CSParameterException
get
method.
Valid detail levels for a link are :
LEVEL_ID
Retrieves Api Key's (uuid) ApiKey and name only.
setDetailLevel
in class CSDatabaseItem
nDetailLevel
- the detail level to be used.CSParameterException
- if an invalid detail level is specified.public void get() throws CSException
setApiKey(UUID)
), supports resolving that to an
Api Key Name setName(String)
and vice versa at a detail level of
CSDatabaseItem.LEVEL_ID
.get
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified attribute cannot be found on the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
setApiKey(UUID)
), or setName(String)
as key information.delete
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified attributes cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void update() throws CSException
Use update
to store the current contents of this ApiKey
on the database.
If an object with the current Api Key or Name already exists, that Api Key's details will be updated.
Otherwise, a new Api Key will be created on the database.
update
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified attributes cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public java.lang.Object clone() throws java.lang.CloneNotSupportedException, java.lang.OutOfMemoryError
CSDatabaseItem
CSDatabaseItem
object.
clone
in class CSDatabaseItem
CSDatabaseItem
object, distinct from, but identical in every way to the
original.java.lang.CloneNotSupportedException
- thrown if cloning is not supported/allowed.java.lang.OutOfMemoryError
- thrown if there are any problems allocating memory.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.