Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected override void OnProcessRecord()
var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true)
.WaitOnOperation(operationResult: operationResult);

this.TryConvertAndWriteObject(result, this.OutputObjectFormat.Value);
this.TryConvertToResourceAndWriteObject(result, this.OutputObjectFormat.Value);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,24 @@ protected void TryConvertAndWriteObject(string resultString, ResourceObjectForma
}
}

/// <summary>
/// Writes the object
/// </summary>
/// <param name="resultString">The result as a string</param>
/// <param name="objectFormat">The <see cref="ResourceObjectFormat"/></param>
protected void TryConvertToResourceAndWriteObject(string resultString, ResourceObjectFormat objectFormat)
{
Resource<JToken> resultResource;
if (resultString.TryConvertTo<Resource<JToken>>(out resultResource))
{
this.WriteObject(resultResource.ToPsObject(objectFormat));
}
else
{
this.WriteObject(resultString);
}
}

/// <summary>
/// Writes a <see cref="JToken"/> object as a <see cref="PSObject"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ protected override void OnProcessRecord()
var activity = string.Format("{0} {1}", this.ShouldUsePatchSemantics() ? "PATCH" : "PUT", managementUri.PathAndQuery);
var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true)
.WaitOnOperation(operationResult: operationResult);
this.TryConvertAndWriteObject(result, this.OutputObjectFormat.Value);

this.TryConvertToResourceAndWriteObject(result, this.OutputObjectFormat.Value);
});
}

Expand Down