Files
csharp/gen/KubernetesGenerator/KubernetesExtensions.cs.template
Boshi Lian b8f78e4641 port autorest2 template to local generate tools (#669)
* port autorest to watch generator

* rename KubernetesWatchGenerator -> KubernetesGenerator

* add validate

* fix format

* fix generate code warnings

* fix line ending

* fix missing property found by comp check

* do not new http method
2021-08-09 07:27:32 -07:00

81 lines
2.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))
{
using (var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
{{#operation.parameters}}
{{GetDotNetName .}},
{{/operation.parameters}}
null,
cancellationToken).ConfigureAwait(false))
{
{{GetReturnType operation "_result.Body"}};
}
}
{{/.}}
}
}