public IEnumerable <ExternalInstance> GetInstances(Application argApp) { var r = new VcapRequest(credMgr, Constants.APPS_PATH, argApp.Name, "instances"); var instances = r.Execute <Dictionary <string, ExternalInstance> >(); return(instances.Values.ToArrayOrNull()); }
public byte[] Files(string name, string path, ushort instance) { var r = new VcapRequest(credMgr, Constants.APPS_PATH, name, "instances", instance, "files", path); RestResponse response = r.Execute(); return(response.RawBytes); }
public IEnumerable <Application> GetApplications(string proxy_user = null) { var r = new VcapRequest(credMgr, Constants.APPS_PATH); if (false == proxy_user.IsNullOrWhiteSpace()) { r.ProxyUser = proxy_user; } return(r.Execute <Application[]>()); }
public IEnumerable <ProvisionedService> GetProvisionedServices(string proxy_user = null) { var r = new VcapRequest(credMgr, Constants.SERVICES_PATH); if (false == proxy_user.IsNullOrWhiteSpace()) { r.ProxyUser = proxy_user; } return(r.Execute <ProvisionedService[]>()); }
public void ChangePassword(string user, string newPassword) { VcapRequest request = BuildVcapRequest(Constants.USERS_PATH, user); IRestResponse response = request.Execute(); JObject parsed = JObject.Parse(response.Content); parsed["password"] = newPassword; VcapJsonRequest put = BuildVcapJsonRequest(Method.PUT, Constants.USERS_PATH, user); put.AddBody(parsed); put.Execute(); }
public IEnumerable <SystemService> GetSystemServices() { VcapRequest r = BuildVcapRequest(Constants.GLOBAL_SERVICES_PATH); IRestResponse response = r.Execute(); var list = JsonConvert.DeserializeObject <Dictionary <string, Dictionary <string, Dictionary <string, SystemService> > > >(response.Content); var dataStores = from val in list.Values from val1 in val.Values from val2 in val1.Values select val2; return(dataStores.ToList()); }
public VcapClientResult ChangePassword(string user, string newpassword) { var r = new VcapRequest(credMgr, Constants.USERS_PATH, user); RestResponse response = r.Execute(); JObject parsed = JObject.Parse(response.Content); parsed["password"] = newpassword; var put = new VcapJsonRequest(credMgr, Method.PUT, Constants.USERS_PATH, user); put.AddBody(parsed); response = put.Execute(); return(new VcapClientResult()); }
public IEnumerable <StatInfo> GetStats(Application argApp) { var r = new VcapRequest(credMgr, Constants.APPS_PATH, argApp.Name, "stats"); RestResponse response = r.Execute(); var tmp = JsonConvert.DeserializeObject <SortedDictionary <int, StatInfo> >(response.Content); var rv = new List <StatInfo>(); foreach (KeyValuePair <int, StatInfo> kvp in tmp) { StatInfo si = kvp.Value; si.ID = kvp.Key; rv.Add(si); } return(rv.ToArrayOrNull()); }
public IEnumerable <SystemService> GetSystemServices() { var r = new VcapRequest(credMgr, Constants.GLOBAL_SERVICES_PATH); RestResponse response = r.Execute(); var datastores = new List <SystemService>(); var list = JsonConvert.DeserializeObject <Dictionary <string, Dictionary <string, Dictionary <string, SystemService> > > >(response.Content); foreach (var val in list.Values) { foreach (var val1 in val.Values) { foreach (var val2 in val1.Values) { datastores.Add(val2); } } } return(datastores.ToArrayOrNull()); }
public void Target(Uri uri) { // "target" does the same thing as "info", but not logged in // considered valid if name, build, version and support are all non-null VcapRequest request = BuildVcapRequest(false, uri, Constants.INFO_PATH); Info info = request.Execute <Info>(); var success = info != null && !info.Name.IsNullOrWhiteSpace() && !info.Build.IsNullOrWhiteSpace() && !info.Version.IsNullOrWhiteSpace() && !info.Support.IsNullOrWhiteSpace(); if (success) { CredentialManager.SetTarget(uri); CredentialManager.StoreTarget(); } else { throw new VcapTargetException(request.ErrorMessage); } }
public VcapClientResult Target(Uri argUri = null) { VcapClientResult rv; if (null == argUri) { // Just return current target rv = new VcapClientResult(false, credMgr.CurrentTarget.AbsoluteUriTrimmed()); } else { // "target" does the same thing as "info", but not logged in // considered valid if name, build, version and support are all non-null // without argument, displays current target var r = new VcapRequest(credMgr, false, argUri, Constants.INFO_PATH); Info info = r.Execute <Info>(); bool success = false; if (null != info) { success = false == info.Name.IsNullOrWhiteSpace() && false == info.Build.IsNullOrWhiteSpace() && false == info.Version.IsNullOrWhiteSpace() && false == info.Support.IsNullOrWhiteSpace(); } if (success) { credMgr.SetTarget(argUri); credMgr.StoreTarget(); } rv = new VcapClientResult(success, credMgr.CurrentTarget.AbsoluteUriTrimmed()); } return(rv); }
public IEnumerable <Application> GetApplications(string proxy_user = null) { VcapRequest r = BuildVcapRequest(Constants.APPS_PATH); return(r.Execute <Application[]>()); }
public IEnumerable <Crash> GetAppCrash(Application app) { var r = new VcapRequest(credMgr, Constants.APPS_PATH, app.Name, "crashes"); return(r.Execute <Crash[]>()); }
public string GetAppCrash(string name) { var r = new VcapRequest(credMgr, Constants.APPS_PATH, name, "crashes"); return(r.Execute().Content); }
public IEnumerable <ProvisionedService> GetProvisionedServices() { VcapRequest r = BuildVcapRequest(Constants.SERVICES_PATH); return(r.Execute <ProvisionedService[]>()); }
public string GetApplicationJson(string name) { var r = new VcapRequest(credMgr, Constants.APPS_PATH, name); return(r.Execute().Content); }
public VcapClientResult Info() { var r = new VcapRequest(credMgr, Constants.INFO_PATH); return(new VcapClientResult(true, r.Execute <Info>())); }
public string GetStartupLog(Application argApp, ushort argInstance) { var r = new VcapRequest(credMgr, Constants.APPS_PATH, argApp.Name, argInstance, "files/logs/startup.log"); return(r.Execute().Content); }
public Info GetInfo() { VcapRequest r = BuildVcapRequest(Constants.INFO_PATH); return(r.Execute <Info>()); }
public string GetApplicationJson(string name) { VcapRequest r = BuildVcapRequest(Constants.APPS_PATH, name); return(r.Execute().Content); }