public VcapClientResult Update(string name, DirectoryInfo path) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return(hlpr.Update(name, path)); }
public void Stop(Application app) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); hlpr.Stop(app); }
public void Delete(string name) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); hlpr.Delete(name); }
public byte[] FilesSimple(string appName, string path, ushort instance) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return(hlpr.Files(appName, path, instance)); }
public VcapResponse UpdateApplication(Application app) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return(hlpr.UpdateApplication(app)); }
public void Restart(Application app) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); hlpr.Restart(app); }
public IEnumerable <Crash> GetAppCrash(Application app) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return(hlpr.GetAppCrash(app)); }
public Application GetApplication(string name) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); Application rv = hlpr.GetApplication(name); rv.Parent = cloud; // TODO not thrilled about this return(rv); }
public VcapClientResult Push( string name, string deployFQDN, ushort instances, DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return(hlpr.Push(name, deployFQDN, instances, path, memoryMB, provisionedServiceNames, "aspdotnet", "aspdotnet40")); }
public IEnumerable <Application> GetApplications() { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); IEnumerable <Application> apps = hlpr.GetApplications(); foreach (var a in apps) { a.Parent = cloud; } // TODO not thrilled about this return(apps); }
public VcapClientResult DeleteUser(string email) { var appsHelper = new AppsHelper(credMgr); foreach (Application a in appsHelper.GetApplications(email)) { appsHelper.Delete(a.Name); } var servicesHelper = new ServicesHelper(credMgr); foreach (ProvisionedService ps in servicesHelper.GetProvisionedServices(email)) { servicesHelper.DeleteService(ps.Name); } var r = new VcapJsonRequest(credMgr, Method.DELETE, Constants.USERS_PATH, email); RestResponse response = r.Execute(); return new VcapClientResult(); }
public VcapClientResult BindService(string argProvisionedServiceName, string argAppName) { var apps = new AppsHelper(credMgr); Application app = apps.GetApplication(argAppName); app.Services.Add(argProvisionedServiceName); var request = new VcapJsonRequest(credMgr, Method.PUT, Constants.APPS_PATH, app.Name); request.AddBody(app); RestResponse response = request.Execute(); // Ruby code re-gets info app = apps.GetApplication(argAppName); if (app.IsStarted) { apps.Restart(app); } return new VcapClientResult(); }
public VcapClientResult UnbindService(string argProvisionedServiceName, string argAppName) { var apps = new AppsHelper(credMgr); string appJson = apps.GetApplicationJson(argAppName); var appParsed = JObject.Parse(appJson); var services = (JArray)appParsed["services"]; appParsed["services"] = new JArray(services.Where(s => ((string)s) != argProvisionedServiceName)); var r = new VcapJsonRequest(credMgr, Method.PUT, Constants.APPS_PATH, argAppName); r.AddBody(appParsed); RestResponse response = r.Execute(); apps = new AppsHelper(credMgr); apps.Restart(argAppName); return(new VcapClientResult()); }
public VcapClientResult BindService(string argProvisionedServiceName, string argAppName) { var apps = new AppsHelper(credMgr); Application app = apps.GetApplication(argAppName); app.Services.Add(argProvisionedServiceName); var request = new VcapJsonRequest(credMgr, Method.PUT, Constants.APPS_PATH, app.Name); request.AddBody(app); RestResponse response = request.Execute(); // Ruby code re-gets info app = apps.GetApplication(argAppName); if (app.IsStarted) { apps.Restart(app); } return(new VcapClientResult()); }
public VcapClientResult DeleteUser(string email) { var appsHelper = new AppsHelper(credMgr); foreach (Application a in appsHelper.GetApplications(email)) { appsHelper.Delete(a.Name); } var servicesHelper = new ServicesHelper(credMgr); foreach (ProvisionedService ps in servicesHelper.GetProvisionedServices(email)) { servicesHelper.DeleteService(ps.Name); } var r = new VcapJsonRequest(credMgr, Method.DELETE, Constants.USERS_PATH, email); RestResponse response = r.Execute(); return(new VcapClientResult()); }
public VcapFilesResult Files(string appName, string path, ushort instance) { checkLoginStatus(); VcapFilesResult rv; var hlpr = new AppsHelper(credMgr); byte[] content = hlpr.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 (file_re.IsMatch(firstLine) || dir_re.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 = file_re.Match(item); if (null != fileMatch && 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 = dir_re.Match(item); if (null != dirMatch && dirMatch.Success) { string dirName = dirMatch.Groups[1].Value; rv.AddDirectory(dirName); continue; } throw new InvalidOperationException("Match failed."); } } else { rv = new VcapFilesResult(content); } } return rv; }
public IEnumerable<Crash> GetAppCrash(Application app) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return hlpr.GetAppCrash(app); }
public Application GetApplication(string name) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); Application rv = hlpr.GetApplication(name); rv.Parent = cloud; // TODO not thrilled about this return rv; }
public VcapFilesResult Files(string appName, string path, ushort instance) { checkLoginStatus(); VcapFilesResult rv; var hlpr = new AppsHelper(credMgr); byte[] content = hlpr.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 (file_re.IsMatch(firstLine) || dir_re.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 = file_re.Match(item); if (null != fileMatch && 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 = dir_re.Match(item); if (null != dirMatch && dirMatch.Success) { string dirName = dirMatch.Groups[1].Value; rv.AddDirectory(dirName); continue; } throw new InvalidOperationException("Match failed."); } } else { rv = new VcapFilesResult(content); } } return(rv); }
public IEnumerable<Application> GetApplications() { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); IEnumerable<Application> apps = hlpr.GetApplications(); foreach (var a in apps) { a.Parent = cloud; } // TODO not thrilled about this return apps; }
public VcapClientResult Push( string name, string deployFQDN, ushort instances, DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return hlpr.Push(name, deployFQDN, instances, path, memoryMB, provisionedServiceNames, "aspdotnet", "aspdotnet40"); }
public void Restart(Application app) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); hlpr.Restart(app); }
public void Stop(Application app) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); hlpr.Stop(app); }
public VcapClientResult Update(string name, DirectoryInfo path) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return hlpr.Update(name, path); }
public VcapResponse UpdateApplication(Application app) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return hlpr.UpdateApplication(app); }
public void Delete(string name) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); hlpr.Delete(name); }
public VcapClientResult UnbindService(string argProvisionedServiceName, string argAppName) { var apps = new AppsHelper(credMgr); string appJson = apps.GetApplicationJson(argAppName); var appParsed = JObject.Parse(appJson); var services = (JArray)appParsed["services"]; appParsed["services"] = new JArray(services.Where(s => ((string)s) != argProvisionedServiceName)); var r = new VcapJsonRequest(credMgr, Method.PUT, Constants.APPS_PATH, argAppName); r.AddBody(appParsed); RestResponse response = r.Execute(); apps = new AppsHelper(credMgr); apps.Restart(argAppName); return new VcapClientResult(); }
public byte[] FilesSimple(string appName, string path, ushort instance) { checkLoginStatus(); var hlpr = new AppsHelper(credMgr); return hlpr.Files(appName, path, instance); }