/// <inheritdoc/> protected override void ProcessRecordInternal() { RepairTargetDescriptionBase repairTargetDescriptionBase = null; if (this.Node.IsPresent) { repairTargetDescriptionBase = new NodeRepairTargetDescription( nodeNames: this.NodeNames); } RepairImpactDescriptionBase repairImpactDescriptionBase = null; if (this.Node.IsPresent) { repairImpactDescriptionBase = new NodeRepairImpactDescription( nodeImpactList: this.NodeImpactList); } var repairTaskHistory = new RepairTaskHistory( createdUtcTimestamp: this.CreatedUtcTimestamp, claimedUtcTimestamp: this.ClaimedUtcTimestamp, preparingUtcTimestamp: this.PreparingUtcTimestamp, approvedUtcTimestamp: this.ApprovedUtcTimestamp, executingUtcTimestamp: this.ExecutingUtcTimestamp, restoringUtcTimestamp: this.RestoringUtcTimestamp, completedUtcTimestamp: this.CompletedUtcTimestamp, preparingHealthCheckStartUtcTimestamp: this.PreparingHealthCheckStartUtcTimestamp, preparingHealthCheckEndUtcTimestamp: this.PreparingHealthCheckEndUtcTimestamp, restoringHealthCheckStartUtcTimestamp: this.RestoringHealthCheckStartUtcTimestamp, restoringHealthCheckEndUtcTimestamp: this.RestoringHealthCheckEndUtcTimestamp); var repairTask = new RepairTask( taskId: this.TaskId, state: this.State, action: this.Action, version: this.Version, description: this.Description, flags: this.Flags, target: repairTargetDescriptionBase, executor: this.Executor, executorData: this.ExecutorData, impact: repairImpactDescriptionBase, resultStatus: this.ResultStatus, resultCode: this.ResultCode, resultDetails: this.ResultDetails, history: repairTaskHistory, preparingHealthCheckState: this.PreparingHealthCheckState, restoringHealthCheckState: this.RestoringHealthCheckState, performPreparingHealthCheck: this.PerformPreparingHealthCheck, performRestoringHealthCheck: this.PerformRestoringHealthCheck); var result = this.ServiceFabricClient.Repairs.UpdateRepairExecutionStateAsync( repairTask: repairTask, cancellationToken: this.CancellationToken).GetAwaiter().GetResult(); if (result != null) { this.WriteObject(this.FormatOutput(result)); } }
/// <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, RepairTaskHistory obj) { // Required properties are always serialized, optional properties are serialized when not null. writer.WriteStartObject(); if (obj.CreatedUtcTimestamp != null) { writer.WriteProperty(obj.CreatedUtcTimestamp, "CreatedUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.ClaimedUtcTimestamp != null) { writer.WriteProperty(obj.ClaimedUtcTimestamp, "ClaimedUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.PreparingUtcTimestamp != null) { writer.WriteProperty(obj.PreparingUtcTimestamp, "PreparingUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.ApprovedUtcTimestamp != null) { writer.WriteProperty(obj.ApprovedUtcTimestamp, "ApprovedUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.ExecutingUtcTimestamp != null) { writer.WriteProperty(obj.ExecutingUtcTimestamp, "ExecutingUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.RestoringUtcTimestamp != null) { writer.WriteProperty(obj.RestoringUtcTimestamp, "RestoringUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.CompletedUtcTimestamp != null) { writer.WriteProperty(obj.CompletedUtcTimestamp, "CompletedUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.PreparingHealthCheckStartUtcTimestamp != null) { writer.WriteProperty(obj.PreparingHealthCheckStartUtcTimestamp, "PreparingHealthCheckStartUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.PreparingHealthCheckEndUtcTimestamp != null) { writer.WriteProperty(obj.PreparingHealthCheckEndUtcTimestamp, "PreparingHealthCheckEndUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.RestoringHealthCheckStartUtcTimestamp != null) { writer.WriteProperty(obj.RestoringHealthCheckStartUtcTimestamp, "RestoringHealthCheckStartUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } if (obj.RestoringHealthCheckEndUtcTimestamp != null) { writer.WriteProperty(obj.RestoringHealthCheckEndUtcTimestamp, "RestoringHealthCheckEndUtcTimestamp", JsonWriterExtensions.WriteDateTimeValue); } writer.WriteEndObject(); }