-
Notifications
You must be signed in to change notification settings - Fork 305
netstandard2 extendable lib model, basic rest #793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f613e1e
first lib model
tg123 73bbfad
add missing files
tg123 a8aa025
happy test
tg123 005cb11
add vanilla rest for extend
tg123 965c07f
fix new url pattern
tg123 bd442d2
Merge remote-tracking branch 'origin/master' into model
tg123 72603ca
address comments
tg123 47465ea
add v to tag
tg123 99de4c1
Merge branch 'tagname' into model
tg123 54da6ec
bump ver
tg123 aab8a49
add missing file when ren
tg123 75174f5
support multi pkg
tg123 c3d6443
fix gh action
tg123 566277b
fix env var
tg123 9a39f38
ren title
tg123 da2913b
use gh action to set ver
tg123 c22e584
Merge branch 'master' into model
tg123 3253148
Merge remote-tracking branch 'origin/master' into model
tg123 44aed96
remove unused
tg123 af0f7bd
remove unused
tg123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
| using System.Threading.Tasks; | ||
| using k8s; | ||
| using k8s.Models; | ||
| using k8s.Autorest; | ||
|
|
||
| namespace attach | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,6 @@ | |
| using System.Threading.Tasks; | ||
| using k8s; | ||
| using k8s.Models; | ||
| using k8s.Autorest; | ||
|
|
||
| namespace watch | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| using System.Net.Http; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using k8s.Autorest; | ||
| using System.Net.Http.Headers; | ||
|
|
||
|
|
||
| namespace k8s | ||
| { | ||
| public abstract partial class AbstractKubernetes | ||
| { | ||
| private sealed class QueryBuilder | ||
| { | ||
| private List<string> parameters = new List<string>(); | ||
|
|
||
| public void Append(string key, params object[] values) | ||
| { | ||
| foreach (var value in values) | ||
| { | ||
| switch (value) | ||
| { | ||
| case int intval: | ||
| parameters.Add($"{key}={intval}"); | ||
| break; | ||
| case string strval: | ||
| parameters.Add($"{key}={Uri.EscapeDataString(strval)}"); | ||
| break; | ||
| case bool boolval: | ||
| parameters.Add($"{key}={(boolval ? "true" : "false")}"); | ||
| break; | ||
| default: | ||
| // null | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| if (parameters.Count > 0) | ||
| { | ||
| return "?" + string.Join("&", parameters); | ||
| } | ||
|
|
||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| private Task<HttpResponseMessage> SendRequest<T>(T body, HttpRequestMessage httpRequest, CancellationToken cancellationToken) | ||
| { | ||
| if (body != null) | ||
| { | ||
| var requestContent = KubernetesJson.Serialize(body); | ||
| httpRequest.Content = new StringContent(requestContent, System.Text.Encoding.UTF8); | ||
| httpRequest.Content.Headers.ContentType = GetHeader(body); | ||
| return SendRequestRaw(requestContent, httpRequest, cancellationToken); | ||
| } | ||
|
|
||
| return SendRequestRaw("", httpRequest, cancellationToken); | ||
| } | ||
|
|
||
| public virtual TimeSpan HttpClientTimeout { get; set; } = TimeSpan.FromSeconds(100); | ||
|
|
||
| protected abstract Task<HttpOperationResponse<T>> CreateResultAsync<T>(HttpRequestMessage httpRequest, HttpResponseMessage httpResponse, bool? watch, CancellationToken cancellationToken); | ||
|
|
||
| protected abstract HttpRequestMessage CreateRequest(string relativeUri, string method, IDictionary<string, IList<string>> customHeaders); | ||
|
|
||
| protected abstract MediaTypeHeaderValue GetHeader(object body); | ||
|
|
||
| protected abstract Task<HttpResponseMessage> SendRequestRaw(string requestContent, HttpRequestMessage httpRequest, CancellationToken cancellationToken); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| using System.Runtime.CompilerServices; | ||
|
|
||
| [assembly: InternalsVisibleTo("KubernetesClient")] | ||
| [assembly: InternalsVisibleTo("KubernetesClient.VanillaRest")] | ||
| [assembly: InternalsVisibleTo("KubernetesClient.Tests")] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| global using System; | ||
| global using System.Collections.Generic; | ||
| global using System.Linq; | ||
| global using System.Text.Json; | ||
| global using System.Text.Json.Serialization; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>netstandard2.0</TargetFrameworks> | ||
| <RootNamespace>k8s</RootNamespace> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="Generator" /> | ||
| <AdditionalFiles Include="..\..\swagger.json" Generator="api" /> | ||
| <ProjectReference Include="..\KubernetesClient.Models\KubernetesClient.Models.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\LibKubernetesGenerator\LibKubernetesGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| using System.Runtime.CompilerServices; | ||
|
|
||
| [assembly: InternalsVisibleTo("KubernetesClient")] | ||
| [assembly: InternalsVisibleTo("KubernetesClient.Basic")] | ||
| [assembly: InternalsVisibleTo("KubernetesClient.Tests")] |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| global using System; | ||
| global using System.Collections.Generic; | ||
| global using System.Linq; | ||
| global using System.Text.Json; | ||
| global using System.Text.Json.Serialization; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
src/KubernetesClient.Models/KubernetesClient.Models.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFrameworks>netstandard2.0</TargetFrameworks> | ||
| <RootNamespace>k8s.Models</RootNamespace> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="Generator" /> | ||
| <AdditionalFiles Include="..\..\swagger.json" Generator="model,modelext,versionconverter" /> | ||
| <ProjectReference Include="..\LibKubernetesGenerator\LibKubernetesGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="System.Text.Json" Version="6.0.0" /> | ||
| <PackageReference Include="AutoMapper" Version="10.1.1" /> | ||
| <PackageReference Include="Fractions" Version="7.0.0" /> | ||
| </ItemGroup> | ||
| </Project> |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.