Add some example code.

This commit is contained in:
Brendan Burns
2017-06-12 22:54:30 -07:00
parent d42da04e5d
commit f6433ca252
2 changed files with 35 additions and 0 deletions

21
examples/simple/PodList.cs Executable file
View File

@@ -0,0 +1,21 @@
using System;
using k8s;
namespace simple
{
class PodList
{
static void Main(string[] args)
{
IKubernetes client = new Kubernetes();
client.BaseUri = new Uri("http://localhost:8001");
var listTask = client.ListNamespacedPodWithHttpMessagesAsync("default");
listTask.Wait();
var list = listTask.Result.Body;
foreach (var item in list.Items) {
Console.WriteLine(item.Metadata.Name);
}
}
}
}

14
examples/simple/simple.csproj Executable file
View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="3.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
<ProjectReference Include="..\..\src\csharp.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
</Project>