public VcapClientResult DeleteUser(string email) { var appsHelper = new AppsHelper(proxyUser, credMgr); foreach (Application a in appsHelper.GetApplications(email)) { appsHelper.Delete(a.Name); } var servicesHelper = new ServicesHelper(proxyUser, credMgr); foreach (ProvisionedService ps in servicesHelper.GetProvisionedServices(email)) { servicesHelper.DeleteService(ps.Name); } VcapJsonRequest r = base.BuildVcapJsonRequest(Method.DELETE, Constants.USERS_PATH, email); IRestResponse response = r.Execute(); return new VcapClientResult(); }
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, credMgr); foreach (Application a in appsHelper.GetApplications(email)) { appsHelper.Delete(a.Name); } var servicesHelper = new ServicesHelper(proxyUser, credMgr); foreach (ProvisionedService ps in servicesHelper.GetProvisionedServices()) { servicesHelper.DeleteService(ps.Name); } VcapJsonRequest r = BuildVcapJsonRequest(Method.DELETE, Constants.USERS_PATH, email); r.Execute(); }
public IEnumerable<ProvisionedService> GetProvisionedServices() { CheckLoginStatus(); var services = new ServicesHelper(proxyUser, credMgr); return services.GetProvisionedServices(); }
public VcapClientResult DeleteService(string provisionedServiceName) { checkLoginStatus(); var services = new ServicesHelper(credMgr); return services.DeleteService(provisionedServiceName); }
public VcapClientResult Push(string name, string deployFQDN, ushort instances, DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames, string framework, string runtime) { VcapClientResult rv; if (path == null) { rv = new VcapClientResult(false, "Application local location is needed"); } else if (deployFQDN == null) { rv = new VcapClientResult(false, "Please specify the url to deploy as."); } else if (framework == null) { rv = new VcapClientResult(false, "Please specify application framework"); } else { if (AppExists(name)) { rv = new VcapClientResult(false, String.Format(Resources.AppsHelper_PushApplicationExists_Fmt, name)); } else { /* * Before creating the app, ensure we can build resource list */ var resources = new List<Resource>(); ulong totalSize = addDirectoryToResources(resources, path, path.FullName); var manifest = new AppManifest { Name = name, Staging = new Staging { Framework = framework, Runtime = runtime }, Uris = new string[] { deployFQDN }, Instances = instances, Resources = new AppResources { Memory = memoryMB }, }; var r = new VcapJsonRequest(credMgr, Method.POST, Constants.APPS_PATH); r.AddBody(manifest); RestResponse response = r.Execute(); uploadAppBits(name, path); Application app = GetApplication(name); app.Start(); r = new VcapJsonRequest(credMgr, Method.PUT, Constants.APPS_PATH, name); r.AddBody(app); response = r.Execute(); bool started = isStarted(app.Name); if (started && false == provisionedServiceNames.IsNullOrEmpty()) { foreach (string svcName in provisionedServiceNames) { var servicesHelper = new ServicesHelper(credMgr); servicesHelper.BindService(svcName, app.Name); } } rv = new VcapClientResult(started); } } return rv; }
public void Push(string name, string deployFQDN, ushort instances, DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames) { if (path == null) { throw new ArgumentException("Application local location is needed"); } if (deployFQDN == null) { throw new ArgumentException("Please specify the url to deploy as."); } DetetectedFramework framework = FrameworkDetetctor.Detect(path); if (framework == null) { throw new InvalidOperationException("Please specify application framework"); } else { if (AppExists(name)) { throw new VcapException(String.Format(Resources.AppsHelper_PushApplicationExists_Fmt, name)); } else { /* * Before creating the app, ensure we can build resource list */ var resources = new List<Resource>(); AddDirectoryToResources(resources, path, path.FullName); var manifest = new AppManifest { Name = name, Staging = new Staging { Framework = framework.Framework, Runtime = framework.Runtime }, Uris = new [] { deployFQDN }, Instances = instances, Resources = new AppResources { Memory = memoryMB }, }; var r = BuildVcapJsonRequest(Method.POST, Constants.APPS_PATH); r.AddBody(manifest); r.Execute(); UploadAppBits(name, path); Application app = GetApplication(name); app.Start(); r = BuildVcapJsonRequest(Method.PUT, Constants.APPS_PATH, name); r.AddBody(app); r.Execute(); bool started = IsStarted(app.Name, timeoutSeconds); if (started && !provisionedServiceNames.IsNullOrEmpty()) { foreach (string serviceName in provisionedServiceNames) { var servicesHelper = new ServicesHelper(ProxyUser, CredentialManager); servicesHelper.BindService(serviceName, app.Name); } } } } }
public IEnumerable <SystemService> GetSystemServices() { var services = new ServicesHelper(proxyUser, credMgr); return(services.GetSystemServices()); }
public void CreateService(string serviceName, string provisionedServiceName) { var services = new ServicesHelper(proxyUser, credMgr); services.CreateService(serviceName, provisionedServiceName); }
public void CreateService(string serviceName, string provisionedServiceName) { var services = new ServicesHelper(proxyUser, credMgr); services.CreateService(serviceName, provisionedServiceName); }
public void DeleteService(string provisionedServiceName) { var services = new ServicesHelper(proxyUser, credMgr); services.DeleteService(provisionedServiceName); }
public void UnbindService(string provisionedServiceName, string appName) { var services = new ServicesHelper(proxyUser, credMgr); services.UnbindService(provisionedServiceName, appName); }
public void BindService(string provisionedServiceName, string appName) { var services = new ServicesHelper(proxyUser, credMgr); services.BindService(provisionedServiceName, appName); }
public void DeleteService(string provisionedServiceName) { var services = new ServicesHelper(proxyUser, credMgr); services.DeleteService(provisionedServiceName); }
public IEnumerable<SystemService> GetSystemServices() { CheckLoginStatus(); var services = new ServicesHelper(proxyUser, credMgr); return services.GetSystemServices(); }
public IEnumerable <ProvisionedService> GetProvisionedServices() { var services = new ServicesHelper(proxyUser, credMgr); return(services.GetProvisionedServices()); }
public VcapClientResult BindService(string provisionedServiceName, string appName) { CheckLoginStatus(); var services = new ServicesHelper(proxyUser, credMgr); return services.BindService(provisionedServiceName, appName); }
public void Push(string name, string deployFQDN, ushort instances, DirectoryInfo path, uint memoryMB, string[] provisionedServiceNames) { if (path == null) { throw new ArgumentException("Application local location is needed"); } if (deployFQDN == null) { throw new ArgumentException("Please specify the url to deploy as."); } DetetectedFramework framework = FrameworkDetetctor.Detect(path); if (framework == null) { throw new InvalidOperationException("Please specify application framework"); } else { if (AppExists(name)) { throw new VcapException(String.Format(Resources.AppsHelper_PushApplicationExists_Fmt, name)); } else { /* * Before creating the app, ensure we can build resource list */ var resources = new List <Resource>(); AddDirectoryToResources(resources, path, path.FullName); var manifest = new AppManifest { Name = name, Staging = new Staging { Framework = framework.Framework, Runtime = framework.Runtime }, Uris = new [] { deployFQDN }, Instances = instances, Resources = new AppResources { Memory = memoryMB }, }; var r = BuildVcapJsonRequest(Method.POST, Constants.APPS_PATH); r.AddBody(manifest); r.Execute(); UploadAppBits(name, path); Application app = GetApplication(name); app.Start(); r = BuildVcapJsonRequest(Method.PUT, Constants.APPS_PATH, name); r.AddBody(app); r.Execute(); bool started = IsStarted(app.Name); if (started && !provisionedServiceNames.IsNullOrEmpty()) { foreach (string serviceName in provisionedServiceNames) { var servicesHelper = new ServicesHelper(proxyUser, credMgr); servicesHelper.BindService(serviceName, app.Name); } } } } }