Skip to content

generate with stream support #75

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 1 commit into from
Jan 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/generated/IKubernetes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace k8s
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -2742,7 +2743,7 @@ public partial interface IKubernetes : System.IDisposable
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<HttpOperationResponse<string>> ReadNamespacedPodLogWithHttpMessagesAsync(string name, string namespaceParameter, string container = default(string), bool? follow = default(bool?), int? limitBytes = default(int?), string pretty = default(string), bool? previous = default(bool?), int? sinceSeconds = default(int?), int? tailLines = default(int?), bool? timestamps = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
Task<HttpOperationResponse<Stream>> ReadNamespacedPodLogWithHttpMessagesAsync(string name, string namespaceParameter, string container = default(string), bool? follow = default(bool?), int? limitBytes = default(int?), string pretty = default(string), bool? previous = default(bool?), int? sinceSeconds = default(int?), int? tailLines = default(int?), bool? timestamps = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
/// connect GET requests to portforward of Pod
Expand Down
23 changes: 6 additions & 17 deletions src/generated/Kubernetes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace k8s
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading;
Expand Down Expand Up @@ -240,6 +241,7 @@ public Kubernetes(System.Uri baseUri, ServiceClientCredentials credentials, Http
/// </summary>
private void Initialize()
{
BaseUri = new System.Uri("http://localhost");
SerializationSettings = new JsonSerializerSettings
{
Formatting = Newtonsoft.Json.Formatting.Indented,
Expand Down Expand Up @@ -12794,7 +12796,7 @@ private void Initialize()
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<HttpOperationResponse<string>> ReadNamespacedPodLogWithHttpMessagesAsync(string name, string namespaceParameter, string container = default(string), bool? follow = default(bool?), int? limitBytes = default(int?), string pretty = default(string), bool? previous = default(bool?), int? sinceSeconds = default(int?), int? tailLines = default(int?), bool? timestamps = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<HttpOperationResponse<Stream>> ReadNamespacedPodLogWithHttpMessagesAsync(string name, string namespaceParameter, string container = default(string), bool? follow = default(bool?), int? limitBytes = default(int?), string pretty = default(string), bool? previous = default(bool?), int? sinceSeconds = default(int?), int? tailLines = default(int?), bool? timestamps = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (name == null)
{
Expand Down Expand Up @@ -12900,7 +12902,7 @@ private void Initialize()
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
_httpResponse = await HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
Expand Down Expand Up @@ -12931,26 +12933,13 @@ private void Initialize()
throw ex;
}
// Create Result
var _result = new HttpOperationResponse<string>();
var _result = new HttpOperationResponse<Stream>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = SafeJsonConvert.DeserializeObject<string>(_responseContent, DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
_result.Body = await _httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
}
if (_shouldTrace)
{
Expand Down
12 changes: 6 additions & 6 deletions src/generated/KubernetesExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace k8s
{
using Models;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -5504,7 +5505,7 @@ public static V1APIResourceList GetAPIResources(this IKubernetes operations)
/// If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every
/// line of log output. Defaults to false.
/// </param>
public static string ReadNamespacedPodLog(this IKubernetes operations, string name, string namespaceParameter, string container = default(string), bool? follow = default(bool?), int? limitBytes = default(int?), string pretty = default(string), bool? previous = default(bool?), int? sinceSeconds = default(int?), int? tailLines = default(int?), bool? timestamps = default(bool?))
public static Stream ReadNamespacedPodLog(this IKubernetes operations, string name, string namespaceParameter, string container = default(string), bool? follow = default(bool?), int? limitBytes = default(int?), string pretty = default(string), bool? previous = default(bool?), int? sinceSeconds = default(int?), int? tailLines = default(int?), bool? timestamps = default(bool?))
{
return operations.ReadNamespacedPodLogAsync(name, namespaceParameter, container, follow, limitBytes, pretty, previous, sinceSeconds, tailLines, timestamps).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -5557,12 +5558,11 @@ public static V1APIResourceList GetAPIResources(this IKubernetes operations)
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<string> ReadNamespacedPodLogAsync(this IKubernetes operations, string name, string namespaceParameter, string container = default(string), bool? follow = default(bool?), int? limitBytes = default(int?), string pretty = default(string), bool? previous = default(bool?), int? sinceSeconds = default(int?), int? tailLines = default(int?), bool? timestamps = default(bool?), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<Stream> ReadNamespacedPodLogAsync(this IKubernetes operations, string name, string namespaceParameter, string container = default(string), bool? follow = default(bool?), int? limitBytes = default(int?), string pretty = default(string), bool? previous = default(bool?), int? sinceSeconds = default(int?), int? tailLines = default(int?), bool? timestamps = default(bool?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ReadNamespacedPodLogWithHttpMessagesAsync(name, namespaceParameter, container, follow, limitBytes, pretty, previous, sinceSeconds, tailLines, timestamps, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
var _result = await operations.ReadNamespacedPodLogWithHttpMessagesAsync(name, namespaceParameter, container, follow, limitBytes, pretty, previous, sinceSeconds, tailLines, timestamps, null, cancellationToken).ConfigureAwait(false);
_result.Request.Dispose();
return _result.Body;
}

/// <summary>
Expand Down