Skip to content

Commit 1ced9ac

Browse files
chore: cleanup (#86)
1 parent c4edcb2 commit 1ced9ac

File tree

24 files changed

+2072
-2861
lines changed

24 files changed

+2072
-2861
lines changed

.editorconfig

Lines changed: 475 additions & 0 deletions
Large diffs are not rendered by default.

Function.SDK.CSharp.sln

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,60 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.11.35017.193
5-
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Function.SDK.CSharp", "src\Function.SDK.CSharp\Function.SDK.CSharp.csproj", "{D69DA423-50E2-404F-8E5F-2D011CAB7C08}"
7-
EndProject
8-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
9-
ProjectSection(SolutionItems) = preProject
10-
.github\workflows\cicd.yml = .github\workflows\cicd.yml
11-
example\composition.yaml = example\composition.yaml
12-
example\functions.yaml = example\functions.yaml
13-
global.json = global.json
14-
README.md = README.md
15-
example\xr.yaml = example\xr.yaml
16-
EndProjectSection
17-
EndProject
18-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function.SDK.CSharp.SourceGenerator", "src\Function.SDK.CSharp.SourceGenerator\Function.SDK.CSharp.SourceGenerator.csproj", "{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}"
19-
EndProject
20-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function.SDK.CSharp.Sample", "src\Function.SDK.CSharp.Sample\Function.SDK.CSharp.Sample.csproj", "{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}"
21-
EndProject
22-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function.SDK.CSharp.Tests", "tests\Function.SDK.CSharp.Tests\Function.SDK.CSharp.Tests.csproj", "{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}"
23-
EndProject
24-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function.SDK.CSharp.Sample.Tests", "tests\Function.SDK.CSharp.Sample.Tests\Function.SDK.CSharp.Sample.Tests.csproj", "{43BACAF0-F142-312C-E41C-D31724947C67}"
25-
EndProject
26-
Global
27-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
28-
Debug|Any CPU = Debug|Any CPU
29-
Release|Any CPU = Release|Any CPU
30-
EndGlobalSection
31-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
32-
{D69DA423-50E2-404F-8E5F-2D011CAB7C08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33-
{D69DA423-50E2-404F-8E5F-2D011CAB7C08}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{D69DA423-50E2-404F-8E5F-2D011CAB7C08}.Release|Any CPU.ActiveCfg = Release|Any CPU
35-
{D69DA423-50E2-404F-8E5F-2D011CAB7C08}.Release|Any CPU.Build.0 = Release|Any CPU
36-
{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37-
{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
38-
{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
39-
{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}.Release|Any CPU.Build.0 = Release|Any CPU
40-
{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41-
{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}.Debug|Any CPU.Build.0 = Debug|Any CPU
42-
{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}.Release|Any CPU.ActiveCfg = Release|Any CPU
43-
{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}.Release|Any CPU.Build.0 = Release|Any CPU
44-
{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45-
{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}.Debug|Any CPU.Build.0 = Debug|Any CPU
46-
{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}.Release|Any CPU.ActiveCfg = Release|Any CPU
47-
{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}.Release|Any CPU.Build.0 = Release|Any CPU
48-
{43BACAF0-F142-312C-E41C-D31724947C67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49-
{43BACAF0-F142-312C-E41C-D31724947C67}.Debug|Any CPU.Build.0 = Debug|Any CPU
50-
{43BACAF0-F142-312C-E41C-D31724947C67}.Release|Any CPU.ActiveCfg = Release|Any CPU
51-
{43BACAF0-F142-312C-E41C-D31724947C67}.Release|Any CPU.Build.0 = Release|Any CPU
52-
EndGlobalSection
53-
GlobalSection(SolutionProperties) = preSolution
54-
HideSolutionNode = FALSE
55-
EndGlobalSection
56-
GlobalSection(ExtensibilityGlobals) = postSolution
57-
SolutionGuid = {591FD27B-E8D0-4608-89A6-F39E4EEEF489}
58-
EndGlobalSection
59-
EndGlobal
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.11.35017.193
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Function.SDK.CSharp", "src\Function.SDK.CSharp\Function.SDK.CSharp.csproj", "{D69DA423-50E2-404F-8E5F-2D011CAB7C08}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
9+
ProjectSection(SolutionItems) = preProject
10+
.editorconfig = .editorconfig
11+
.github\workflows\cicd.yml = .github\workflows\cicd.yml
12+
example\composition.yaml = example\composition.yaml
13+
example\functions.yaml = example\functions.yaml
14+
global.json = global.json
15+
README.md = README.md
16+
example\xr.yaml = example\xr.yaml
17+
EndProjectSection
18+
EndProject
19+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function.SDK.CSharp.SourceGenerator", "src\Function.SDK.CSharp.SourceGenerator\Function.SDK.CSharp.SourceGenerator.csproj", "{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}"
20+
EndProject
21+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function.SDK.CSharp.Sample", "src\Function.SDK.CSharp.Sample\Function.SDK.CSharp.Sample.csproj", "{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}"
22+
EndProject
23+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function.SDK.CSharp.Tests", "tests\Function.SDK.CSharp.Tests\Function.SDK.CSharp.Tests.csproj", "{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}"
24+
EndProject
25+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function.SDK.CSharp.Sample.Tests", "tests\Function.SDK.CSharp.Sample.Tests\Function.SDK.CSharp.Sample.Tests.csproj", "{43BACAF0-F142-312C-E41C-D31724947C67}"
26+
EndProject
27+
Global
28+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
29+
Debug|Any CPU = Debug|Any CPU
30+
Release|Any CPU = Release|Any CPU
31+
EndGlobalSection
32+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
33+
{D69DA423-50E2-404F-8E5F-2D011CAB7C08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34+
{D69DA423-50E2-404F-8E5F-2D011CAB7C08}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{D69DA423-50E2-404F-8E5F-2D011CAB7C08}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{D69DA423-50E2-404F-8E5F-2D011CAB7C08}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{78CA6808-7D0E-09E1-E1A2-7F22CB63C5EC}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{FF67A964-B6B3-ECE8-39BE-40E9DB0DE130}.Release|Any CPU.Build.0 = Release|Any CPU
45+
{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46+
{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}.Debug|Any CPU.Build.0 = Debug|Any CPU
47+
{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}.Release|Any CPU.ActiveCfg = Release|Any CPU
48+
{A10CEF3D-9AB6-B90A-4CE0-253C7B6A8298}.Release|Any CPU.Build.0 = Release|Any CPU
49+
{43BACAF0-F142-312C-E41C-D31724947C67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50+
{43BACAF0-F142-312C-E41C-D31724947C67}.Debug|Any CPU.Build.0 = Debug|Any CPU
51+
{43BACAF0-F142-312C-E41C-D31724947C67}.Release|Any CPU.ActiveCfg = Release|Any CPU
52+
{43BACAF0-F142-312C-E41C-D31724947C67}.Release|Any CPU.Build.0 = Release|Any CPU
53+
EndGlobalSection
54+
GlobalSection(SolutionProperties) = preSolution
55+
HideSolutionNode = FALSE
56+
EndGlobalSection
57+
GlobalSection(ExtensibilityGlobals) = postSolution
58+
SolutionGuid = {591FD27B-E8D0-4608-89A6-F39E4EEEF489}
59+
EndGlobalSection
60+
EndGlobal
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
1-
using Function.SDK.CSharp.Models;
1+
using System.Text.Json;
2+
using Function.SDK.CSharp.Models;
23
using Function.SDK.CSharp.SourceGenerator.Models.platform.example.com;
34
using k8s;
4-
using System.Text.Json;
55

6-
namespace Function.SDK.CSharp.Sample
6+
namespace Function.SDK.CSharp.Sample;
7+
8+
public static class ConversionWebhook
79
{
8-
public static class ConversionWebhook
10+
public static V1ConversionReview Convert(V1ConversionReview conversion)
911
{
10-
public static V1ConversionReview Convert(V1ConversionReview conversion)
12+
if (conversion.Kind == V1ConversionReview.KubeKind
13+
&& conversion.ApiVersion == V1ConversionReview.KubeGroup + "/" + V1ConversionReview.KubeApiVersion
14+
&& conversion.Request?.DesiredApiVersion == V1alpha1XStorageBucket.KubeApiVersion
15+
)
1116
{
12-
if (conversion.Kind == V1ConversionReview.KubeKind
13-
&& conversion.ApiVersion == V1ConversionReview.KubeGroup + "/" + V1ConversionReview.KubeApiVersion
14-
&& conversion.Request?.DesiredApiVersion == V1alpha1XStorageBucket.KubeApiVersion
15-
)
17+
foreach (var item in conversion.Request.Objects)
1618
{
17-
foreach (var item in conversion.Request.Objects)
18-
{
19-
var source = KubernetesJson.Deserialize<V1alpha2XStorageBucket>(item);
20-
source.ApiVersion = V1alpha1XStorageBucket.KubeApiVersion;
19+
var source = KubernetesJson.Deserialize<V1alpha2XStorageBucket>(item);
20+
source.ApiVersion = V1alpha1XStorageBucket.KubeApiVersion;
2121

22-
var converted = KubernetesJson.Deserialize<JsonElement>(KubernetesJson.Serialize(source));
22+
var converted = KubernetesJson.Deserialize<JsonElement>(KubernetesJson.Serialize(source));
2323

24-
conversion.Response.ConvertedObjects.Add(converted);
25-
}
26-
27-
conversion.Response.Uid = conversion.Request.Uid;
28-
}
29-
else
30-
{
31-
conversion.Response.Uid = conversion.Request.Uid;
32-
conversion.Response.Result.Status = V1ConversionReviewResponseStatusEnum.Failure;
33-
conversion.Response.Result.Message = "Unknown Version";
24+
conversion.Response.ConvertedObjects.Add(converted);
3425
}
3526

36-
return conversion;
27+
conversion.Response.Uid = conversion.Request.Uid;
28+
}
29+
else
30+
{
31+
conversion.Response.Uid = conversion.Request.Uid;
32+
conversion.Response.Result.Status = V1ConversionReviewResponseStatusEnum.Failure;
33+
conversion.Response.Result.Message = "Unknown Version";
3734
}
35+
36+
return conversion;
3837
}
39-
}
38+
}

src/Function.SDK.CSharp.Sample/Function.SDK.CSharp.Sample.csproj

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,8 @@
1010
<IsPackable>false</IsPackable>
1111
<DockerfileRunArguments>-p 9443:9443</DockerfileRunArguments>
1212
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
13-
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
1413
</PropertyGroup>
1514

16-
<ItemGroup>
17-
<!-- Exclude the output of source generators from the compilation, show it in the IDE -->
18-
<Compile Remove="$(CompilerGeneratedFilesOutputPath)/**/*.cs" />
19-
<None Include="$(CompilerGeneratedFilesOutputPath)/**/*.cs" />
20-
</ItemGroup>
21-
2215
<ItemGroup>
2316
<AdditionalFiles Include="*.yaml" />
2417
<Content Remove="apiextensions.schema.json" />
@@ -37,8 +30,4 @@
3730
<ProjectReference Include="..\Function.SDK.CSharp\Function.SDK.CSharp.csproj" />
3831
</ItemGroup>
3932

40-
<ItemGroup>
41-
<Folder Include="Generated\Function.SDK.CSharp.SourceGenerator\Function.SDK.CSharp.SourceGenerator.SourceGenerator\" />
42-
</ItemGroup>
43-
4433
</Project>

0 commit comments

Comments
 (0)