package org.zstack.storage.backup.sftp;

import org.zstack.header.configuration.PythonClassInventory;
import org.zstack.header.query.Unqueryable;
import org.zstack.header.rest.APINoSee;
import org.zstack.header.search.Inventory;
import org.zstack.header.search.Parent;
import org.zstack.header.storage.backup.BackupStorageInventory;
import org.zstack.header.storage.backup.BackupStorageVO;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@Inventory(mappingVOClass = SftpBackupStorageVO.class, collectionValueOfMethod="valueOf1",
        parent = {@Parent(inventoryClass = BackupStorageInventory.class, type = SftpBackupStorageConstant.SFTP_BACKUP_STORAGE_TYPE)})
@PythonClassInventory
public class SftpBackupStorageInventory extends BackupStorageInventory {
    public String hostname;
    @APINoSee
    @Unqueryable
    public String username;


    public int sshport;

    protected SftpBackupStorageInventory(SftpBackupStorageVO vo) {
        super(vo);
        hostname = vo.getHostname();
        username = vo.getUsername();
        sshport = vo.getPort();
    }

    public SftpBackupStorageInventory() {
    }

    public static SftpBackupStorageInventory valueOf(SftpBackupStorageVO vo) {
        SftpBackupStorageInventory inv = new SftpBackupStorageInventory(vo);
        return inv;
    }

    public static List<SftpBackupStorageInventory> valueOf1(Collection<SftpBackupStorageVO> vos) {
        List<SftpBackupStorageInventory> invs = new ArrayList<SftpBackupStorageInventory>(vos.size());
        for (SftpBackupStorageVO vo : vos) {
            SftpBackupStorageInventory inv = SftpBackupStorageInventory.valueOf(vo);
            invs.add(inv);
        }
        return invs;
    }

    public String getHostname() {
        return hostname;
    }

    public void setHostname(String hostname) {
        this.hostname = hostname;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
    public int getSshport() {
        return sshport;
    }
    public void setSshport(int sshport) {
        this.sshport = sshport;
    }
}

@@ -912,25 +912,25 @@
 blic int ssh
-p
+P
 ort;%0D%0A%0D%0A    
@@ -1100,17 +1100,17 @@
      ssh
-p
+P
 ort = vo
@@ -2144,25 +2144,25 @@
   return ssh
-p
+P
 ort;%0D%0A    %7D%0D
@@ -2196,17 +2196,17 @@
 (int ssh
-p
+P
 ort) %7B%0D%0A
@@ -2221,17 +2221,17 @@
 this.ssh
-p
+P
 ort = ss
@@ -2231,17 +2231,17 @@
 rt = ssh
-p
+P
 ort;%0D%0A  

Align the sshPort name with other backupstorage