Exemplo n.º 1
0
 public BitbucketRepository(BitbucketAdapter adapter, string account, string link)
 {
     _adapter = adapter;
     _account = account;
     _link    = link;
 }
        public void AddInfra(string type, string name = null, string url = null)
        {
            if (string.IsNullOrEmpty(type))
            {
                return;
            }
            InfraAdapter ia = null;

            switch (type.ToLower())
            {
            case "server":
                ia = new ComputerAdapter(this);
                break;

            case "sonarqube":
                ia = new SonarAdapter(this);
                break;

            case "sql":
                ia = new SqlAdapter(this);
                break;

            //case "vpn":
            //    ia = _openvpnAdapter;
            //    break;
            //case "docker":
            //    ia = _dockerAdapter;
            //    break;
            case "team city":
                ia = new TeamCityAdapter(this);
                break;

            case "bitbucket":
                ia = new BitbucketAdapter(this);
                break;

            case "postgresql":
                ia = new PostGreAdapter(this);
                break;

            case "syncany":
                ia = new SyncanyAdapter(this);
                break;

            default:
                break;
            }

            if (ia != null)
            {
                try
                {
                    ia.Name = name != null ? name : ia.GetType().ToString().Split('.')[ia.GetType().ToString().Split('.').Length - 1].Replace("Adapter", string.Empty);
                    ia.Url  = url;
                    InfraFarm.Add(ia);
                    //GoAction("Infra_Save");
                }
                catch (Exception e)
                {
                }
            }
        }