Exemple #1
0
        public bool CheckParameters(out string explanation)
        {
            if (!parameters.ValidateValues(out explanation))
            {
                return(false);
            }

            if (!parameters.ArtifactName.EndsWith(".zip"))
            {
                explanation = "zip archives supported only";
                return(false);
            }
            using (ServiceStack.JsonServiceClient client = new ServiceStack.JsonServiceClient(parameters.Host))
            {
                client.SetCredentials(parameters.User, parameters.Password);
                client.AlwaysSendBasicAuthHeader = true;
                try
                {
                    client.Get("httpAuth/app/rest/projects");
                    explanation = "";
                    return(true);
                }
                catch (Exception e)
                {
                    explanation = e.Message;
                }
                return(false);
            }
        }
Exemple #2
0
        public bool CheckParameters(out string explanation)
        {
            if(!parameters.ValidateValues(out explanation))
                return false;

            if (!parameters.ArtifactName.EndsWith(".zip"))
            {
                explanation = "zip archives supported only";
                return false;
            }
            using (ServiceStack.JsonServiceClient client = new ServiceStack.JsonServiceClient(parameters.Host))
            {
                client.SetCredentials(parameters.User, parameters.Password);
                client.AlwaysSendBasicAuthHeader = true;
                try
                {
                    client.Get("httpAuth/app/rest/projects");
                    explanation = "";
                    return true;
                }
                catch (Exception e)
                {
                    explanation = e.Message;
                }
                return false;
            }
        }
Exemple #3
0
 private ChangeRootObject GetChange(TeamCity.BuildRootObject id)
 {
     try
     {
         using (ServiceStack.JsonServiceClient client = new ServiceStack.JsonServiceClient(parameters.Host))
         {
             client.SetCredentials(parameters.User, parameters.Password);
             client.AlwaysSendBasicAuthHeader = true;
             ChangeRootObject b = client.Get <ChangeRootObject>(id.changes.href);
             return(b);
         }
     }
     catch (Exception e)
     {
         logger.Exception(e, "GetChange", "");
         return(null);
     }
 }
Exemple #4
0
 private BuildsRootObject GetBuilds()
 {
     try
     {
         using (ServiceStack.JsonServiceClient client = new ServiceStack.JsonServiceClient(parameters.Host))
         {
             client.SetCredentials(parameters.User, parameters.Password);
             client.AlwaysSendBasicAuthHeader = true;
             BuildsRootObject b = client.Get <BuildsRootObject>(new BuildsRequest
             {
                 buildType = parameters.BuildType,
                 status    = "SUCCESS"
             });
             return(b);
         }
     }
     catch (Exception e)
     {
         logger.Exception(e, "GetBuilds", "");
         return(null);
     }
 }
Exemple #5
0
 private ChangesRootObject GetChanges(TeamCity.ChangeRootObject id)
 {
     try
     {
         using (ServiceStack.JsonServiceClient client = new ServiceStack.JsonServiceClient(parameters.Host))
         {
             client.SetCredentials(parameters.User, parameters.Password);
             client.AlwaysSendBasicAuthHeader = true;
             ChangesRootObject b = client.Get<ChangesRootObject>(id.change[0].href);
             return b;
         }
     }
     catch (Exception e)
     {
         logger.Exception(e, "GetChanges", "");
         return null;
     }
 }
Exemple #6
0
 private BuildsRootObject GetBuilds()
 {
     try
     {
         using (ServiceStack.JsonServiceClient client = new ServiceStack.JsonServiceClient(parameters.Host))
         {
             client.SetCredentials(parameters.User, parameters.Password);
             client.AlwaysSendBasicAuthHeader = true;
             BuildsRootObject b = client.Get<BuildsRootObject>(new BuildsRequest
             {
                 buildType = parameters.BuildType,
                 status = "SUCCESS"
             });
             return b;
         }
     }
     catch (Exception e)
     {
         logger.Exception(e, "GetBuilds", "");
         return null;
     }
 }
Exemple #7
0
 private ArtifcatsRootObject GetArtifact(TeamCity.BuildRootObject id)
 {
     try
     {
         using (ServiceStack.JsonServiceClient client = new ServiceStack.JsonServiceClient(parameters.Host))
         {
             client.SetCredentials(parameters.User, parameters.Password);
             client.AlwaysSendBasicAuthHeader = true;
             ArtifcatsRootObject b = client.Get<ArtifcatsRootObject>(id.artifacts.href);
             return b;
         }
     }
     catch (Exception e)
     {
         logger.Exception(e, "GetArtifact", "");
         return null;
     }
 }