Search in sources :

Example 1 with SSHAccountProvisionerConfigParam

use of org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam 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;
}
Also used : SSHAccountProvisionerConfigParam(org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam) SSHAccountProvisionerConfigParam(org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam) SSHAccountProvisioner(org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisioner) SecurityCheck(org.apache.airavata.service.security.interceptor.SecurityCheck)

Aggregations

SSHAccountProvisioner (org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisioner)1 SSHAccountProvisionerConfigParam (org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam)1 SecurityCheck (org.apache.airavata.service.security.interceptor.SecurityCheck)1