use of org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisioner in project airavata by apache.
the class AiravataServerHandler method getSSHAccountProvisioners.
@Override
@SecurityCheck
public List<SSHAccountProvisioner> getSSHAccountProvisioners(AuthzToken authzToken) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
List<SSHAccountProvisioner> sshAccountProvisioners = new ArrayList<>();
List<SSHAccountProvisionerProvider> sshAccountProvisionerProviders = SSHAccountProvisionerFactory.getSSHAccountProvisionerProviders();
for (SSHAccountProvisionerProvider provider : sshAccountProvisionerProviders) {
// TODO: Move this Thrift conversion to utility class
SSHAccountProvisioner sshAccountProvisioner = new SSHAccountProvisioner();
sshAccountProvisioner.setCanCreateAccount(provider.canCreateAccount());
sshAccountProvisioner.setCanInstallSSHKey(provider.canInstallSSHKey());
sshAccountProvisioner.setName(provider.getName());
List<SSHAccountProvisionerConfigParam> sshAccountProvisionerConfigParams = new ArrayList<>();
for (ConfigParam configParam : provider.getConfigParams()) {
SSHAccountProvisionerConfigParam sshAccountProvisionerConfigParam = new SSHAccountProvisionerConfigParam();
sshAccountProvisionerConfigParam.setName(configParam.getName());
sshAccountProvisionerConfigParam.setDescription(configParam.getDescription());
sshAccountProvisionerConfigParam.setIsOptional(configParam.isOptional());
switch(configParam.getType()) {
case STRING:
sshAccountProvisionerConfigParam.setType(SSHAccountProvisionerConfigParamType.STRING);
break;
case CRED_STORE_PASSWORD_TOKEN:
sshAccountProvisionerConfigParam.setType(SSHAccountProvisionerConfigParamType.CRED_STORE_PASSWORD_TOKEN);
break;
}
sshAccountProvisionerConfigParams.add(sshAccountProvisionerConfigParam);
}
sshAccountProvisioner.setConfigParams(sshAccountProvisionerConfigParams);
sshAccountProvisioners.add(sshAccountProvisioner);
}
return sshAccountProvisioners;
}
Aggregations