/// <summary> /// Serializes the object to JSON. /// </summary> /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param> /// <param name="obj">The object to serialize to JSON.</param> internal static void Serialize(JsonWriter writer, ContainerLogs obj) { // Required properties are always serialized, optional properties are serialized when not null. writer.WriteStartObject(); if (obj.Content != null) { writer.WriteProperty(obj.Content, "Content", JsonWriterExtensions.WriteStringValue); } writer.WriteEndObject(); }
public async Task <Response <ContainerLogs> > ListLogsAsync(string subscriptionId, string resourceGroupName, string containerGroupName, string containerName, int?tail = null, bool?timestamps = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(containerGroupName, nameof(containerGroupName)); Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); using var message = CreateListLogsRequest(subscriptionId, resourceGroupName, containerGroupName, containerName, tail, timestamps); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { ContainerLogs value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = ContainerLogs.DeserializeContainerLogs(document.RootElement); return(Response.FromValue(value, message.Response)); }