Skip to content

Commit 01b2aa8

Browse files
authored
cleanup folders (#792)
* unify folders * move dep and target outside
1 parent c11e205 commit 01b2aa8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+98
-132
lines changed

examples/Directory.Build.props

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<TargetFramework>net6</TargetFramework>
5+
</PropertyGroup>
6+
</Project>

examples/Directory.Build.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<ItemGroup>
3+
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\src\KubernetesClient\KubernetesClient.csproj" />
4+
</ItemGroup>
5+
</Project>

examples/GenericKubernetesApi/GenericKubernetesApi.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
65
</PropertyGroup>
76

8-
<ItemGroup>
9-
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
10-
</ItemGroup>
11-
127
</Project>

examples/attach/attach.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<ItemGroup>
4-
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
5-
</ItemGroup>
6-
73
<PropertyGroup>
84
<OutputType>Exe</OutputType>
9-
<TargetFramework>net5</TargetFramework>
105
</PropertyGroup>
116

127
</Project>

examples/customResource/CustomResourceDefinition.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using k8s;
22
using k8s.Models;
3-
using Newtonsoft.Json;
43
using System.Collections.Generic;
4+
using System.Text.Json.Serialization;
55

66
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "CA1724:TypeNamesShouldNotMatchNamespaces", Justification = "This is just an example.")]
77
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "This is just an example.")]
@@ -23,16 +23,16 @@ public class CustomResourceDefinition
2323

2424
public abstract class CustomResource : KubernetesObject
2525
{
26-
[JsonProperty(PropertyName = "metadata")]
26+
[JsonPropertyName("metadata")]
2727
public V1ObjectMeta Metadata { get; set; }
2828
}
2929

3030
public abstract class CustomResource<TSpec, TStatus> : CustomResource
3131
{
32-
[JsonProperty(PropertyName = "spec")]
32+
[JsonPropertyName("spec")]
3333
public TSpec Spec { get; set; }
3434

35-
[JsonProperty(PropertyName = "CStatus")]
35+
[JsonPropertyName("CStatus")]
3636
public TStatus CStatus { get; set; }
3737
}
3838

examples/customResource/Program.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
using Json.Patch;
12
using k8s;
23
using k8s.Autorest;
34
using k8s.Models;
4-
using Microsoft.AspNetCore.JsonPatch;
55
using System;
66
using System.Collections.Generic;
7+
using System.Text.Json;
78
using System.Threading.Tasks;
89

910

@@ -55,11 +56,13 @@ private static async Task Main(string[] args)
5556
Console.WriteLine("- CR Item {0} = {1}", crs.Items.IndexOf(cr), cr.Metadata.Name);
5657
}
5758

58-
// updating the custom resource
59+
var old = JsonSerializer.SerializeToDocument(myCr);
5960
myCr.Metadata.Labels.TryAdd("newKey", "newValue");
60-
var patch = new JsonPatchDocument<CResource>();
61-
patch.Replace(x => x.Metadata.Labels, myCr.Metadata.Labels);
62-
patch.Operations.ForEach(x => x.path = x.path.ToLower());
61+
62+
var expected = JsonSerializer.SerializeToDocument(myCr);
63+
var patch = old.CreatePatch(expected);
64+
65+
// updating the custom resource
6366
var crPatch = new V1Patch(patch, V1Patch.PatchType.JsonPatch);
6467
try
6568
{

examples/customResource/cResource.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using k8s.Models;
2-
using Newtonsoft.Json;
2+
using System.Text.Json.Serialization;
33

44
namespace customResource
55
{
@@ -21,13 +21,13 @@ public override string ToString()
2121

2222
public class CResourceSpec
2323
{
24-
[JsonProperty(PropertyName = "cityName")]
24+
[JsonPropertyName("cityName")]
2525
public string CityName { get; set; }
2626
}
2727

2828
public class CResourceStatus : V1Status
2929
{
30-
[JsonProperty(PropertyName = "temperature", NullValueHandling = NullValueHandling.Ignore)]
30+
[JsonPropertyName("temperature")]
3131
public string Temperature { get; set; }
3232
}
3333
}

examples/customResource/customResource.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
65
</PropertyGroup>
76

87
<ItemGroup>
9-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
10-
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
11-
<PackageReference Include="Microsoft.Build" Version="16.11.0" />
12-
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.10" />
8+
<PackageReference Include="JsonPatch.Net" Version="1.1.2" />
139
</ItemGroup>
1410

1511
</Project>

examples/exec/exec.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<ItemGroup>
4-
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
5-
</ItemGroup>
6-
73
<PropertyGroup>
84
<OutputType>Exe</OutputType>
9-
<TargetFramework>net5</TargetFramework>
105
</PropertyGroup>
116

127
</Project>

examples/generic/generic.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<ItemGroup>
4-
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
5-
</ItemGroup>
6-
73
<PropertyGroup>
84
<OutputType>Exe</OutputType>
9-
<TargetFramework>net5</TargetFramework>
10-
<LangVersion>7.1</LangVersion>
115
</PropertyGroup>
126

137
</Project>

0 commit comments

Comments
 (0)