Skip to content

Commit

Permalink
Merge pull request #141 from tomsseisums/patch-2
Browse files Browse the repository at this point in the history
Added support for `previous` flag to Pod Logs endpoint
  • Loading branch information
tintoy authored Sep 17, 2021
2 parents aed9334 + c7102f6 commit edf4602
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/KubeClient/ResourceClients/PodClientV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public IObservable<IResourceEventV1<PodV1>> WatchAll(string labelSelector = null
/// <returns>
/// A string containing the logs.
/// </returns>
public async Task<string> Logs(string name, string containerName = null, string kubeNamespace = null, int? limitBytes = null, int? tailLines = null, CancellationToken cancellationToken = default)
public async Task<string> Logs(string name, string containerName = null, string kubeNamespace = null, int? limitBytes = null, int? tailLines = null, bool? previous = null, CancellationToken cancellationToken = default)
{
if (String.IsNullOrWhiteSpace(name))
throw new ArgumentException("Argument cannot be null, empty, or entirely composed of whitespace: 'name'.", nameof(name));
Expand All @@ -156,7 +156,8 @@ public async Task<string> Logs(string name, string containerName = null, string
ContainerName = containerName,
Namespace = kubeNamespace ?? KubeClient.DefaultNamespace,
LimitBytes = limitBytes,
TailLines = tailLines
TailLines = tailLines,
Previous = previous?.ToString().ToLowerInvariant()
}),
cancellationToken
);
Expand Down Expand Up @@ -288,7 +289,7 @@ public static class Requests
/// <summary>
/// A get-logs Pod (v1) request.
/// </summary>
public static readonly HttpRequest Logs = ByName.WithRelativeUri("log?container={ContainerName?}&follow={Follow?}&limitBytes={LimitBytes?}&tailLines={TailLines?}");
public static readonly HttpRequest Logs = ByName.WithRelativeUri("log?container={ContainerName?}&follow={Follow?}&limitBytes={LimitBytes?}&tailLines={TailLines?}&previous={Previous?}");
}
}

Expand Down

0 comments on commit edf4602

Please sign in to comment.