Standardization of using order and object initialization (#1028)
* Code cleanup KubernetesClient * KubernetesClient.Basic code cleanup * KubernetesClient.Models cleanup * LibKubernetesGenerator code cleanup * Improved readability of object initialization * FIx namespace order * Fixed some compilation warning
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
using k8s.Models;
|
||||
using k8s.Autorest;
|
||||
using k8s.Models;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.WebSockets;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
|
||||
namespace k8s
|
||||
{
|
||||
@@ -84,8 +84,10 @@ namespace k8s
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var uriBuilder = new UriBuilder(BaseUri);
|
||||
uriBuilder.Scheme = BaseUri.Scheme == "https" ? "wss" : "ws";
|
||||
var uriBuilder = new UriBuilder(BaseUri)
|
||||
{
|
||||
Scheme = BaseUri.Scheme == "https" ? "wss" : "ws",
|
||||
};
|
||||
|
||||
if (!uriBuilder.Path.EndsWith("/", StringComparison.InvariantCulture))
|
||||
{
|
||||
@@ -143,8 +145,10 @@ namespace k8s
|
||||
|
||||
|
||||
// Construct URL
|
||||
var uriBuilder = new UriBuilder(BaseUri);
|
||||
uriBuilder.Scheme = BaseUri.Scheme == "https" ? "wss" : "ws";
|
||||
var uriBuilder = new UriBuilder(BaseUri)
|
||||
{
|
||||
Scheme = BaseUri.Scheme == "https" ? "wss" : "ws",
|
||||
};
|
||||
|
||||
if (!uriBuilder.Path.EndsWith("/", StringComparison.InvariantCulture))
|
||||
{
|
||||
@@ -187,8 +191,10 @@ namespace k8s
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var uriBuilder = new UriBuilder(BaseUri);
|
||||
uriBuilder.Scheme = BaseUri.Scheme == "https" ? "wss" : "ws";
|
||||
var uriBuilder = new UriBuilder(BaseUri)
|
||||
{
|
||||
Scheme = BaseUri.Scheme == "https" ? "wss" : "ws",
|
||||
};
|
||||
|
||||
if (!uriBuilder.Path.EndsWith("/", StringComparison.InvariantCulture))
|
||||
{
|
||||
@@ -294,8 +300,10 @@ namespace k8s
|
||||
{
|
||||
// This usually indicates the server sent an error message, like 400 Bad Request. Unfortunately, the WebSocket client
|
||||
// class doesn't give us a lot of information about what went wrong. So, retry the connection.
|
||||
var uriBuilder = new UriBuilder(uri);
|
||||
uriBuilder.Scheme = uri.Scheme == "wss" ? "https" : "http";
|
||||
var uriBuilder = new UriBuilder(uri)
|
||||
{
|
||||
Scheme = uri.Scheme == "wss" ? "https" : "http",
|
||||
};
|
||||
|
||||
var response = await HttpClient.GetAsync(uriBuilder.Uri, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -327,7 +335,7 @@ namespace k8s
|
||||
$"The operation returned an invalid status code: {response.StatusCode}", wse)
|
||||
{
|
||||
Response = new HttpResponseMessageWrapper(response, content),
|
||||
Body = status != null ? (object)status : content,
|
||||
Body = status != null ? status : content,
|
||||
};
|
||||
|
||||
response.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user