2021-12-13 07:31:59 -08:00
|
|
|
// <auto-generated>
|
|
|
|
|
// Code generated by https://github.com/kubernetes-client/csharp/tree/master/gen/KubernetesGenerator
|
|
|
|
|
// Changes may cause incorrect behavior and will be lost if the code is
|
|
|
|
|
// regenerated.
|
|
|
|
|
// </auto-generated>
|
|
|
|
|
|
|
|
|
|
namespace k8s
|
|
|
|
|
{
|
2022-02-25 13:33:23 -08:00
|
|
|
using k8s.Autorest;
|
2021-12-13 07:31:59 -08:00
|
|
|
using Models;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2022-02-25 13:33:23 -08:00
|
|
|
public partial class Kubernetes : IKubernetes
|
2021-12-13 07:31:59 -08:00
|
|
|
{
|
|
|
|
|
{{#.}}
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public async Task<HttpOperationResponse{{GetReturnType operation "<>"}}> {{GetMethodName operation "WithHttpMessagesAsync"}}(
|
|
|
|
|
{{#operation.parameters}}
|
|
|
|
|
{{GetDotNetType .}} {{GetDotNetName . "true"}},
|
|
|
|
|
{{/operation.parameters}}
|
|
|
|
|
IDictionary<string, IList<string>> customHeaders = null,
|
|
|
|
|
CancellationToken cancellationToken = default(CancellationToken))
|
|
|
|
|
{
|
|
|
|
|
var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
|
|
|
|
|
cts.CancelAfter(HttpClientTimeout);
|
|
|
|
|
{{#IfParamContains operation "watch"}}
|
|
|
|
|
if (watch == true)
|
|
|
|
|
{
|
|
|
|
|
cts.CancelAfter(Timeout.InfiniteTimeSpan);
|
|
|
|
|
}
|
|
|
|
|
{{/IfParamContains operation "watch"}}
|
|
|
|
|
cancellationToken = cts.Token;
|
|
|
|
|
|
|
|
|
|
{{#operation.parameters}}
|
|
|
|
|
{{#isRequired}}
|
|
|
|
|
if ({{GetDotNetName name}} == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentNullException("{{GetDotNetName name}}");
|
|
|
|
|
}
|
|
|
|
|
{{/isRequired}}
|
|
|
|
|
{{/operation.parameters}}
|
|
|
|
|
|
|
|
|
|
// Construct URL
|
2021-12-19 09:01:26 -08:00
|
|
|
var url = new System.Uri(BaseUri, $"{{ToInterpolationPathString path}}").ToString();
|
|
|
|
|
{{#IfGroupPathParamContainsGroup path}}
|
|
|
|
|
url = url.Replace("/apis//", "/api/");
|
|
|
|
|
{{/IfGroupPathParamContainsGroup}}
|
|
|
|
|
var q = new QueryBuilder();
|
2021-12-13 07:31:59 -08:00
|
|
|
{{#operation.parameters}}
|
|
|
|
|
{{#IfKindIs . "query"}}
|
2021-12-19 09:01:26 -08:00
|
|
|
q.Append("{{name}}", {{GetDotNetName name}});
|
2021-12-13 07:31:59 -08:00
|
|
|
{{/IfKindIs . "query"}}
|
|
|
|
|
{{/operation.parameters}}
|
2021-12-19 09:01:26 -08:00
|
|
|
url += q.ToString();
|
|
|
|
|
|
2021-12-13 07:31:59 -08:00
|
|
|
// Create HTTP transport
|
2021-12-19 09:01:26 -08:00
|
|
|
var httpRequest = CreateRequest(url, HttpMethod.{{Method}}, customHeaders);
|
2021-12-13 07:31:59 -08:00
|
|
|
{{#IfParamContains operation "body"}}
|
2021-12-19 09:01:26 -08:00
|
|
|
var httpResponse = await SendRequest(body, httpRequest, cancellationToken);
|
2021-12-13 07:31:59 -08:00
|
|
|
{{/IfParamContains operation "body"}}
|
|
|
|
|
{{#IfParamDoesNotContain operation "body"}}
|
2021-12-19 09:01:26 -08:00
|
|
|
var httpResponse = await SendRequestRaw("", httpRequest, cancellationToken);
|
2021-12-13 07:31:59 -08:00
|
|
|
{{/IfParamDoesNotContain operation "body"}}
|
|
|
|
|
// Create Result
|
|
|
|
|
{{#IfReturnType operation "void"}}
|
2021-12-19 09:01:26 -08:00
|
|
|
HttpOperationResponse result = new HttpOperationResponse() { Request = httpRequest, Response = httpResponse };
|
2021-12-13 07:31:59 -08:00
|
|
|
{{/IfReturnType operation "void"}}
|
|
|
|
|
{{#IfReturnType operation "obj"}}
|
2021-12-19 09:01:26 -08:00
|
|
|
var result = await CreateResultAsync{{GetReturnType operation "<>"}}(httpRequest,
|
|
|
|
|
httpResponse,
|
2021-12-13 07:31:59 -08:00
|
|
|
{{#IfParamContains operation "watch"}}
|
|
|
|
|
watch,
|
|
|
|
|
{{/IfParamContains operation "watch"}}
|
|
|
|
|
{{#IfParamDoesNotContain operation "watch"}}
|
|
|
|
|
false,
|
|
|
|
|
{{/IfParamDoesNotContain operation "watch"}}
|
|
|
|
|
cancellationToken);
|
|
|
|
|
{{/IfReturnType operation "obj"}}
|
|
|
|
|
{{#IfReturnType operation "stream"}}
|
2021-12-19 09:01:26 -08:00
|
|
|
var result = new HttpOperationResponse{{GetReturnType operation "<>"}}() {
|
|
|
|
|
Request = httpRequest,
|
|
|
|
|
Response = httpResponse,
|
|
|
|
|
Body = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false) };
|
2021-12-13 07:31:59 -08:00
|
|
|
{{/IfReturnType operation "stream"}}
|
2021-12-19 09:01:26 -08:00
|
|
|
return result;
|
2021-12-13 07:31:59 -08:00
|
|
|
}
|
|
|
|
|
{{/.}}
|
|
|
|
|
}
|
|
|
|
|
}
|