Name: cf-dotnet-sdk
Owner: Cloud Foundry
Description: Cloud Foundry .NET SDK
Created: 2015-02-07 23:54:46.0
Updated: 2017-09-03 12:45:19.0
Pushed: 2017-10-16 16:21:30.0
Homepage: null
Size: 6809
Language: C#
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The CloudFoundry .NET SDK allows you to easily access the the CloudController API from within your .NET Application
The full CF API Documentation is available at http://apidocs.cloudfoundry.org/
git clone https://github.com/hpcloud/cf-dotnet-sdk
Run all tests inside the CloudFoundry.CloudController.V2.Client.Test project
If you have a working CloundFoundry environment you can run the integration tests within the CloudFoundry.CloudController.Test.Integration project.
Before running the integration tests, make sure you set you connection info in the app.config
We are looking forward to contributions from the community.
Feel free to open an pull request or create an issue.
Install-Package CloudFoundry.CloudController.V2.Client
se this only if your api is using an unsigned certificate
em.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
dFoundryClient client = new CloudFoundryClient(new Uri("https://api.domain"), new System.Threading.CancellationToken());
enticationContext refreshToken = null;
dCredentials credentials = new CloudCredentials();
entials.User = "user";
entials.Password = "password";
refreshToken = client.Login(credentials).Result;
h (Exception ex)
Console.WriteLine(ex.ToString());
dResponseCollection<ListAllAppsResponse> apps = client.Apps.ListAllApps().Result;
e (apps != null && apps.Properties.TotalResults != 0)
foreach (var app in apps)
{
Console.WriteLine("Application {0}, guid {1}, state {2}", app.Name, app.EntityMetadata.Guid, app.State);
}
apps = apps.GetNextPage().Result;
appGuid = new Guid("52b6b758-848b-4b8d-b3f2-83736b5fae68");
teAppRequest updateApp = new UpdateAppRequest();
teApp.State = "STOPPED";
teAppResponse response = client.Apps.UpdateApp(appGuid, updateApp).Result;
ole.WriteLine("App {0} state is {1}", response.Name, response.State);
g CloudFoundry.CloudController.V2;
target = new Uri("https://api.domain");
httpProxy = null;
authEndpoint = new Uri("https://uaa.domain");
skipSsl = true;
dFoundryClient v3client = new CloudFoundryClient(target, new System.Threading.CancellationToken(), httpProxy, skipSsl, authEndpoint);
enticationContext refreshToken = null;
dCredentials credentials = new CloudCredentials();
entials.User = "user";
entials.Password = "password";
refreshToken = v3client.Login(credentials).Result;
h (Exception ex)
Console.WriteLine(ex.ToString());
dResponseCollection<ListAllAppsResponse> apps = v3client.Apps.ListAllApps().Result;
ach (ListAllAppsResponse app in apps)
Console.WriteLine(app.Name);
g CloudFoundry.Manifests;
fest manifest = ManifestDiskRepository.ReadManifest(@"path\to\manifest");
apps = manifest.Applications();
ach(var app in apps)
Console.WriteLine("Application {0}, Memory {1}, Instances {2}", app.Name, app.Memory, app.InstanceCount);