public final class SSHKey
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SSHKey.KeyType
Specify and set appropriate key type in setKeyType function of
SSHKeyModel class |
| Constructor and Description |
|---|
SSHKey(PAMService service,
APIRequestHandler rest,
java.util.Map<java.lang.String,java.lang.String> connectionParams) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
associate(java.lang.String keyName,
java.lang.String resourceName,
java.lang.String accountName)
Associate a key to an account under a resource
|
boolean |
create(SSHKeyModel sshKeyModel)
Create a new SSH key
|
boolean |
delete(java.lang.String keyName,
boolean withoutDisassociation)
Delete an SSH Key
|
boolean |
disassociate(java.lang.String keyName,
java.lang.String resourceName,
java.lang.String accountName)
Disassociate the key associated to an account under a resource
|
java.lang.String |
exportKey(java.lang.String keyName)
Get the contents of a key
|
java.util.List<AssociatedUser> |
fetchAssociatedUsers()
Fetch the list of users (accounts under resource) and their associated key
|
java.util.List<SSHKeyDetails> |
getAllKeys()
Get all ssh keys added by the user
|
java.util.List<java.lang.String> |
getKeyForUser(java.lang.String resourceName,
java.lang.String userName)
Get the keys associated to users (accounts) under a resource
|
SSHKeyDetails |
getParticularKey(java.lang.String keyName)
Fetch a particular key by its name
|
boolean |
importKey(java.lang.String keyName,
java.lang.String passPhrase,
java.lang.String filePath)
Import a key file
|
public SSHKey(PAMService service, APIRequestHandler rest, java.util.Map<java.lang.String,java.lang.String> connectionParams) throws SDKRegistrationException
SDKRegistrationExceptionpublic boolean create(SSHKeyModel sshKeyModel) throws SDKInvalidArgumentException, SDKConnectionException, SDKOperationFailedException
sshKeyModel - an instance of SSHKeyModel with all fields setSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messagepublic boolean delete(java.lang.String keyName,
boolean withoutDisassociation)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
keyName - not null, non empty unique name for the SSH keywithoutDisassociation - set as true, if key is to be deleted without disassociationSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request, or if action fails. The reason for failure will be provided as a part of the exception's messagepublic java.util.List<SSHKeyDetails> getAllKeys() throws SDKConnectionException, SDKOperationFailedException
SSHKeyDetails containing details of all SSH keysSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the requestpublic SSHKeyDetails getParticularKey(java.lang.String keyName) throws SDKInvalidArgumentException, SDKConnectionException, SDKOperationFailedException
keyName - not null, non empty name of the key to be fetchedSSHKeyDetails containing details of the keySDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the requestpublic java.lang.String exportKey(java.lang.String keyName)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
keyName - not null, not empty name of key whose content is to be fetchedSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the requestpublic java.util.List<java.lang.String> getKeyForUser(java.lang.String resourceName,
java.lang.String userName)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
resourceName - not null, non empty name of resource under which account is presentuserName - not null, non empty username (account name) under a resourceSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the requestpublic boolean associate(java.lang.String keyName,
java.lang.String resourceName,
java.lang.String accountName)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
keyName - not null, non empty name of the key to be associatedresourceName - not null, non empty name of resource under which account is presentaccountName - not null, non empty name of the account under a resourceSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the requestpublic boolean disassociate(java.lang.String keyName,
java.lang.String resourceName,
java.lang.String accountName)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
keyName - not null, non empty name of the key to be disassociatedresourceName - not null, non empty name of resourceaccountName - not null, non empty name of the account under a resourceSDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the requestpublic java.util.List<AssociatedUser> fetchAssociatedUsers() throws SDKConnectionException, SDKOperationFailedException
AssociatedUser instanceSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the requestpublic boolean importKey(java.lang.String keyName,
java.lang.String passPhrase,
java.lang.String filePath)
throws SDKInvalidArgumentException,
SDKConnectionException,
SDKOperationFailedException
keyName - not null, non empty name of the key should be imported aspassPhrase - passphrase of the key to be importedfilePath - system path of the key file (also specify the file extension. eg: C:/user/admin/Testkey.ppk)SDKInvalidArgumentException - if any of the mandatory field's values are invalid or not providedSDKConnectionException - if unable to connect to the serverSDKOperationFailedException - if server did not provide a proper response for the request