Beispiel #1
0
        public void Push(string name, string deployFQDN, ushort instances,
                         DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.Push(name, deployFQDN, instances, path, memoryMB, provisionedServiceNames);
        }
Beispiel #2
0
        public Application GetApplication(string name)
        {
            var         helper = new AppsHelper(proxyUser, credMgr);
            Application rv     = helper.GetApplication(name);

            return(rv);
        }
Beispiel #3
0
        public IEnumerable <Application> GetApplications()
        {
            var helper = new AppsHelper(proxyUser, credMgr);
            IEnumerable <Application> apps = helper.GetApplications();

            foreach (var app in apps) // TODO not thrilled about this
            {
                app.User = proxyUser;
            }
            return(apps);
        }
Beispiel #4
0
        public void UnbindService(string provisionedServiceName, string appName)
        {
            var    apps      = new AppsHelper(ProxyUser, CredentialManager);
            string appJson   = apps.GetApplicationJson(appName);
            var    appParsed = JObject.Parse(appJson);
            var    services  = (JArray)appParsed["services"];

            appParsed["services"] = new JArray(services.Where(s => ((string)s) != provisionedServiceName));

            var r = BuildVcapJsonRequest(Method.PUT, Constants.AppsResource, appName);

            r.AddBody(appParsed);
            r.Execute();

            apps = new AppsHelper(ProxyUser, CredentialManager);
            apps.Restart(appName);
        }
Beispiel #5
0
        public void BindService(string provisionedServiceName, string appName)
        {
            var apps = new AppsHelper(ProxyUser, CredentialManager);

            Application app = apps.GetApplication(appName);
            app.AddService(provisionedServiceName);

            var request = BuildVcapJsonRequest(Method.PUT, Constants.AppsResource, app.Name);
            request.AddBody(app);
            request.Execute();

            // Ruby code re-gets info
            app = apps.GetApplication(appName);
            if (app.IsStarted)
            {
                apps.Restart(app);
            }
        }
        public void DeleteUser(string email)
        {
            // TODO: doing this causes a "not logged in" failure when the user
            // doesn't exist, which is kind of misleading.
            var appsHelper = new AppsHelper(proxyUser, credentialManager);
            foreach (var a in appsHelper.GetApplications(email))
            {
                appsHelper.Delete(a.Name);
            }

            var servicesHelper = new ServicesHelper(proxyUser, credentialManager);
            foreach (var ps in servicesHelper.GetProvisionedServices())
            {
                servicesHelper.DeleteService(ps.Name);
            }

            VcapJsonRequest r = BuildVcapJsonRequest(Method.DELETE, Constants.UsersResource, email);
            r.Execute();
        }
Beispiel #7
0
        public void BindService(string provisionedServiceName, string appName)
        {
            var apps = new AppsHelper(ProxyUser, CredentialManager);

            Application app = apps.GetApplication(appName);

            app.AddService(provisionedServiceName);

            var request = BuildVcapJsonRequest(Method.PUT, Constants.AppsResource, app.Name);

            request.AddBody(app);
            request.Execute();

            // Ruby code re-gets info
            app = apps.GetApplication(appName);
            if (app.IsStarted)
            {
                apps.Restart(app);
            }
        }
Beispiel #8
0
        public void DeleteUser(string email)
        {
            // TODO: doing this causes a "not logged in" failure when the user
            // doesn't exist, which is kind of misleading.
            var appsHelper = new AppsHelper(ProxyUser, CredentialManager);

            foreach (Application a in appsHelper.GetApplications(email))
            {
                appsHelper.Delete(a.Name);
            }

            var servicesHelper = new ServicesHelper(ProxyUser, CredentialManager);

            foreach (ProvisionedService ps in servicesHelper.GetProvisionedServices())
            {
                servicesHelper.DeleteService(ps.Name);
            }

            VcapJsonRequest r = BuildVcapJsonRequest(Method.DELETE, Constants.UsersResource, email);

            r.Execute();
        }
 public void Delete(Application app)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.Delete(app);
 }
Beispiel #10
0
        public void Update(string name, DirectoryInfo path)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.Update(name, path);
        }
Beispiel #11
0
 public void Delete(string appName)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.Delete(appName);
 }
Beispiel #12
0
        public void Stop(string appName)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.Stop(appName);
        }
Beispiel #13
0
 public void Start(Application app)
 {
     var helper = new AppsHelper(proxyUser, credMgr);
     helper.Start(app);
 }
Beispiel #14
0
 public IEnumerable<Application> GetApplications()
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     IEnumerable<Application> apps = helper.GetApplications();
     foreach (Application app in apps) // TODO not thrilled about this
     {
         app.User = _proxyUser;
     }
     return apps;
 }
Beispiel #15
0
        public void UnbindService(string provisionedServiceName, string appName)
        {
            var apps = new AppsHelper(ProxyUser, CredentialManager);
            string appJson = apps.GetApplicationJson(appName);
            var appParsed = JObject.Parse(appJson);
            var services = (JArray)appParsed["services"];
            appParsed["services"] = new JArray(services.Where(s => ((string)s) != provisionedServiceName));

            var r = BuildVcapJsonRequest(Method.PUT, Constants.AppsResource, appName);
            r.AddBody(appParsed);
            r.Execute();

            apps = new AppsHelper(ProxyUser, CredentialManager);
            apps.Restart(appName);
        }
Beispiel #16
0
        public VcapFilesResult Files(string appName, string path, ushort instance)
        {
            VcapFilesResult rv;

            var helper = new AppsHelper(_proxyUser, _credMgr);
            byte[] content = helper.Files(appName, path, instance);
            if (null == content)
            {
                rv = new VcapFilesResult(false);
            }
            else if (content.Length == 0)
            {
                rv = new VcapFilesResult(content);
            }
            else
            {
                int i;
                for (i = 0; i < content.Length; ++i)
                {
                    if (content[i] == '\n')
                    {
                        break;
                    }
                }
                string firstLine = Encoding.ASCII.GetString(content, 0, i);
                if (FileRe.IsMatch(firstLine) || DirRe.IsMatch(firstLine))
                {
                    // Probably looking at a listing, not a file
                    string contentAscii = Encoding.ASCII.GetString(content);
                    string[] contentAry = contentAscii.Split(new[] {'\n'}, StringSplitOptions.RemoveEmptyEntries);
                    rv = new VcapFilesResult();
                    foreach (string item in contentAry)
                    {
                        Match fileMatch = FileRe.Match(item);
                        if (fileMatch.Success)
                        {
                            string fileName = fileMatch.Groups[1].Value; // NB: 0 is the entire matched string
                            string fileSize = fileMatch.Groups[2].Value;
                            rv.AddFile(fileName, fileSize);
                            continue;
                        }

                        Match dirMatch = DirRe.Match(item);
                        if (dirMatch.Success)
                        {
                            string dirName = dirMatch.Groups[1].Value;
                            rv.AddDirectory(dirName);
                            continue;
                        }

                        throw new InvalidOperationException("Match failed.");
                    }
                }
                else
                {
                    rv = new VcapFilesResult(content);
                }
            }

            return rv;
        }
Beispiel #17
0
 public IEnumerable<Crash> GetAppCrash(Application app)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     return helper.GetAppCrash(app);
 }
Beispiel #18
0
        public void Delete(Application app)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.Delete(app);
        }
Beispiel #19
0
        public void Delete(string appName)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.Delete(appName);
        }
Beispiel #20
0
        public void Restart(Application app)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.Restart(app);
        }
Beispiel #21
0
        public void Restart(string appName)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.Restart(appName);
        }
Beispiel #22
0
        public void Stop(Application app)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.Stop(app);
        }
Beispiel #23
0
 public byte[] FilesSimple(string appName, string path, ushort instance)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     return helper.Files(appName, path, instance);
 }
Beispiel #24
0
 public void Restart(string appName)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.Restart(appName);
 }
Beispiel #25
0
 public Application GetApplication(string name)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     Application rv = helper.GetApplication(name);
     return rv;
 }
Beispiel #26
0
 public void Stop(string appName)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.Stop(appName);
 }
Beispiel #27
0
 public void Push(string name, string deployFQDN, ushort instances,
                  DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.Push(name, deployFQDN, instances, path, memoryMB, provisionedServiceNames);
 }
Beispiel #28
0
 public void Update(string name, DirectoryInfo path)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.Update(name, path);
 }
Beispiel #29
0
 public void Restart(Application app)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.Restart(app);
 }
Beispiel #30
0
        public byte[] FilesSimple(string appName, string path, ushort instance)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            return(helper.Files(appName, path, instance));
        }
Beispiel #31
0
 public void Stop(Application app)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.Stop(app);
 }
Beispiel #32
0
        public VcapFilesResult Files(string appName, string path, ushort instance)
        {
            VcapFilesResult rv;

            var helper = new AppsHelper(proxyUser, credMgr);

            byte[] content = helper.Files(appName, path, instance);
            if (null == content)
            {
                rv = new VcapFilesResult(false);
            }
            else if (content.Length == 0)
            {
                rv = new VcapFilesResult(content);
            }
            else
            {
                int i = 0;
                for (i = 0; i < content.Length; ++i)
                {
                    if (content[i] == '\n')
                    {
                        break;
                    }
                }
                string firstLine = Encoding.ASCII.GetString(content, 0, i);
                if (FileRe.IsMatch(firstLine) || DirRe.IsMatch(firstLine))
                {
                    // Probably looking at a listing, not a file
                    string   contentAscii = Encoding.ASCII.GetString(content);
                    string[] contentAry   = contentAscii.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    rv = new VcapFilesResult();
                    foreach (string item in contentAry)
                    {
                        Match fileMatch = FileRe.Match(item);
                        if (fileMatch.Success)
                        {
                            string fileName = fileMatch.Groups[1].Value; // NB: 0 is the entire matched string
                            string fileSize = fileMatch.Groups[2].Value;
                            rv.AddFile(fileName, fileSize);
                            continue;
                        }

                        Match dirMatch = DirRe.Match(item);
                        if (dirMatch.Success)
                        {
                            string dirName = dirMatch.Groups[1].Value;
                            rv.AddDirectory(dirName);
                            continue;
                        }

                        throw new InvalidOperationException("Match failed.");
                    }
                }
                else
                {
                    rv = new VcapFilesResult(content);
                }
            }

            return(rv);
        }
Beispiel #33
0
 public void UpdateApplication(Application app)
 {
     var helper = new AppsHelper(_proxyUser, _credMgr);
     helper.UpdateApplication(app);
 }
Beispiel #34
0
        public void UpdateApplication(Application app)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            helper.UpdateApplication(app);
        }
Beispiel #35
0
        public IEnumerable <Crash> GetAppCrash(Application app)
        {
            var helper = new AppsHelper(proxyUser, credMgr);

            return(helper.GetAppCrash(app));
        }
Beispiel #36
0
 public void Start(string appName)
 {
     var helper = new AppsHelper(proxyUser, credMgr);
     helper.Start(appName);
 }