Exemplo n.º 1
0
        /// <summary>
        /// Load up the access. NOTE: your api key should be in the windows credential store for this server!!!
        /// Initialize Jenkin's library access for everything.
        /// </summary>
        /// <remarks>
        /// To put the username and password in, open the "Credential Manager" control panel.
        /// Then for window's credentials, under "Generic credentials" make an entry with:
        /// Internet or network address: jenks-higgs.phys.washington.edu:8080
        /// Username: your username
        /// Password: the api key from the jenkins server.
        /// </remarks>
        public TDTJobAccess()
        {
            var factory = new JenkinsRestFactory();
            var cred    = WebGenericCredentialsLib.CredAccess.LookupUserPass("jenks-higgs.phys.washington.edu:8080");

            if (cred != null)
            {
                _webClient = new BasicAuthJenkinsClient(cred.Item1, cred.Item2);
                factory.SetRestClient(_webClient);
            }

            _client = factory.GetClient();
        }
        public IJenkinService Create(string serverUrl, IList <JenkinsViewModel> jenkinsViewModels, string userName, string apiToken)
        {
            var jenkinsRestFactory = new JenkinsRestFactory(userName, apiToken);

            return(new JenkinsService(jenkinsRestFactory.GetClient(), serverUrl, jenkinsViewModels));
        }