public IOpenShiftSSHKey putSSHKey(String name, ISSHPublicKey key) throws OpenShiftException {
Assert.notNull(name);
Assert.notNull(key);
if (hasSSHKeyName(name)) {
throw new OpenShiftSSHKeyException(
"Could not add new key {0} with the name {1}. There already is a key for this name, key names must be unique.",
key.getPublicKey(), name);
}
if (hasSSHPublicKey(name)) {
throw new OpenShiftSSHKeyException(
"Could not add new key {0} with the name {1}. The key is already stored with a different name. Public key have to be unique.",
key.getPublicKey(), name);
}
KeyResourceDTO keyDTO = new AddSShKeyRequest().execute(key.getKeyType(), name, key.getPublicKey());
return put(keyDTO);