Files
csharp/gen/KubernetesGenerator/KubernetesExtensions.cs.template
Boshi Lian 07ab21bb98 Fix log return disposed obj (#705)
* generator not to dispose stream

* new generated code

* test to cover log stream
2021-09-17 08:21:00 -07:00

103 lines
3.7 KiB
Plaintext

// <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
{
using Models;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Extension methods for Kubernetes.
/// </summary>
public static partial class KubernetesExtensions
{
{{#.}}
/// <summary>
/// {{ToXmlDoc operation.description}}
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
{{#operation.parameters}}
/// <param name="{{GetDotNetName .}}">
/// {{ToXmlDoc description}}
/// </param>
{{/operation.parameters}}
public static {{GetReturnType operation "void"}} {{GetMethodName operation ""}}(
this IKubernetes operations
{{#operation.parameters}}
,{{GetDotNetType .}} {{GetDotNetName . "true"}}
{{/operation.parameters}}
)
{
{{GetReturnType operation "return"}} operations.{{GetMethodName operation "Async"}}(
{{#operation.parameters}}
{{GetDotNetName .}},
{{/operation.parameters}}
CancellationToken.None
).GetAwaiter().GetResult();
}
/// <summary>
/// {{ToXmlDoc operation.description}}
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
{{#operation.parameters}}
/// <param name="{{GetDotNetName .}}">
/// {{ToXmlDoc description}}
/// </param>
{{/operation.parameters}}
/// <param name="cancellationToken">
/// A <see cref="CancellationToken"/> which can be used to cancel the asynchronous operation.
/// </param>
public static async Task{{GetReturnType operation "<>"}} {{GetMethodName operation "Async"}}(
this IKubernetes operations,
{{#operation.parameters}}
{{GetDotNetType .}} {{GetDotNetName . "true"}},
{{/operation.parameters}}
CancellationToken cancellationToken = default(CancellationToken))
{
{{#IfReturnType operation "stream"}}
var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
{{#operation.parameters}}
{{GetDotNetName .}},
{{/operation.parameters}}
null,
cancellationToken);
_result.Request.Dispose();
{{GetReturnType operation "_result.Body"}};
{{/IfReturnType operation "stream"}}
{{#IfReturnType operation "obj"}}
using (var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
{{#operation.parameters}}
{{GetDotNetName .}},
{{/operation.parameters}}
null,
cancellationToken).ConfigureAwait(false))
{
{{GetReturnType operation "_result.Body"}};
}
{{/IfReturnType operation "obj"}}
{{#IfReturnType operation "void"}}
using (var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
{{#operation.parameters}}
{{GetDotNetName .}},
{{/operation.parameters}}
null,
cancellationToken).ConfigureAwait(false))
{
}
{{/IfReturnType operation "void"}}
}
{{/.}}
}
}