diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj
index 04ce7ff14949..e0fe16144eb5 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj
@@ -120,7 +120,6 @@
-
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/ResourceObjectFormat.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/ResourceObjectFormat.cs
deleted file mode 100644
index 6666e2b4c5b1..000000000000
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Entities/Resources/ResourceObjectFormat.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// ----------------------------------------------------------------------------------
-//
-// Copyright Microsoft Corporation
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ----------------------------------------------------------------------------------
-
-namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.Resources
-{
- ///
- /// The resource object format
- ///
- public enum ResourceObjectFormat
- {
- ///
- /// The legacy format.
- ///
- Legacy = 0,
-
- ///
- /// The new format.
- ///
- New = 1
- }
-}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/JTokenExtensions.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/JTokenExtensions.cs
index 6e6d7229ba17..133dbe03e07a 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/JTokenExtensions.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/JTokenExtensions.cs
@@ -49,9 +49,8 @@ internal static class JTokenExtensions
/// Converts a to a
///
/// The
- /// The
/// The type of the object.
- internal static PSObject ToPsObject(this JToken jtoken, ResourceObjectFormat objectFormat, string objectType = null)
+ internal static PSObject ToPsObject(this JToken jtoken, string objectType = null)
{
if (jtoken == null)
{
@@ -60,7 +59,7 @@ internal static PSObject ToPsObject(this JToken jtoken, ResourceObjectFormat obj
if (jtoken.Type != JTokenType.Object)
{
- return new PSObject(JTokenExtensions.ConvertPropertyValueForPsObject(propertyValue: jtoken, objectFormat: objectFormat));
+ return new PSObject(JTokenExtensions.ConvertPropertyValueForPsObject(propertyValue: jtoken));
}
var jobject = (JObject)jtoken;
@@ -75,7 +74,7 @@ internal static PSObject ToPsObject(this JToken jtoken, ResourceObjectFormat obj
{
psObject.Properties.Add(new PSNoteProperty(
name: JTokenExtensions.ConvertToPascalCase(propertyName: property.Name),
- value: JTokenExtensions.ConvertPropertyValueForPsObject(propertyValue: property.Value, objectFormat: objectFormat)));
+ value: JTokenExtensions.ConvertPropertyValueForPsObject(propertyValue: property.Value)));
}
return psObject;
@@ -86,12 +85,11 @@ internal static PSObject ToPsObject(this JToken jtoken, ResourceObjectFormat obj
/// used as the value of a .
///
/// The value.
- /// The
- internal static object ConvertPropertyValueForPsObject(JToken propertyValue, ResourceObjectFormat objectFormat)
+ internal static object ConvertPropertyValueForPsObject(JToken propertyValue)
{
if (propertyValue.Type == JTokenType.Object)
{
- return propertyValue.ToPsObject(objectFormat);
+ return propertyValue.ToPsObject();
}
if (propertyValue.Type == JTokenType.Array)
@@ -102,7 +100,7 @@ internal static object ConvertPropertyValueForPsObject(JToken propertyValue, Res
for (int i = 0; i < array.Length; ++i)
{
- array[i] = JTokenExtensions.ConvertPropertyValueForPsObject(jArray[i], objectFormat);
+ array[i] = JTokenExtensions.ConvertPropertyValueForPsObject(jArray[i]);
}
return array;
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs
index 0c33817f4946..e8b9a7797aa1 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs
@@ -32,8 +32,7 @@ internal static class ResourceExtensions
/// Converts a object into a object.
///
/// The object.
- /// The
- internal static PSObject ToPsObject(this Resource resource, ResourceObjectFormat objectFormat)
+ internal static PSObject ToPsObject(this Resource resource)
{
var resourceType = string.IsNullOrEmpty(resource.Id)
? null
@@ -56,12 +55,12 @@ internal static PSObject ToPsObject(this Resource resource, ResourceObje
{ "Location", resource.Location },
{ "SubscriptionId", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetSubscriptionId(resource.Id) },
{ "Tags", TagsHelper.GetTagsHashtables(resource.Tags) },
- { "Plan", resource.Plan.ToJToken().ToPsObject(objectFormat) },
- { "Properties", ResourceExtensions.GetProperties(resource, objectFormat) },
+ { "Plan", resource.Plan.ToJToken().ToPsObject() },
+ { "Properties", ResourceExtensions.GetProperties(resource) },
{ "CreatedTime", resource.CreatedTime },
{ "ChangedTime", resource.ChangedTime },
{ "ETag", resource.ETag },
- { "Sku", resource.Sku.ToJToken().ToPsObject(objectFormat) },
+ { "Sku", resource.Sku.ToJToken().ToPsObject() },
};
var resourceTypeName = resourceType == null && extensionResourceType == null
@@ -81,17 +80,14 @@ internal static PSObject ToPsObject(this Resource resource, ResourceObje
/// Gets the properties object
///
/// The object.
- /// The
- private static object GetProperties(Resource resource, ResourceObjectFormat objectFormat)
+ private static object GetProperties(Resource resource)
{
if (resource.Properties == null)
{
return null;
}
- return objectFormat == ResourceObjectFormat.Legacy
- ? JsonUtilities.DeserializeJson(resource.Properties.ToString())
- : (object)resource.Properties.ToPsObject(objectFormat);
+ return (object)resource.Properties.ToPsObject();
}
///
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/FindAzureResourceGroupCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/FindAzureResourceGroupCmdlet.cs
index 7769128dabe3..fe6cf998b8ec 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/FindAzureResourceGroupCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/FindAzureResourceGroupCmdlet.cs
@@ -52,7 +52,7 @@ private void RunCmdlet()
getFirstPage: () => this.GetResourceGroups(),
getNextPage: nextLink => this.GetNextLink(nextLink),
cancellationToken: this.CancellationToken,
- action: resourceGroups => this.WriteObject(sendToPipeline: resourceGroups.CoalesceEnumerable().SelectArray(resourceGroup => resourceGroup.ToPsObject(ResourceObjectFormat.New)), enumerateCollection: true));
+ action: resourceGroups => this.WriteObject(sendToPipeline: resourceGroups.CoalesceEnumerable().SelectArray(resourceGroup => resourceGroup.ToPsObject()), enumerateCollection: true));
}
///
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs
index 7f651538a2c8..50869b58266e 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/GetAzureResourceGroupDeploymentOperationCmdlet.cs
@@ -79,7 +79,7 @@ private void RunCmdlet()
getFirstPage: () => this.GetResources(),
getNextPage: nextLink => this.GetNextLink(nextLink),
cancellationToken: this.CancellationToken,
- action: resources => this.WriteObject(sendToPipeline: resources.CoalesceEnumerable().SelectArray(resource => resource.ToPsObject(ResourceObjectFormat.New)), enumerateCollection: true));
+ action: resources => this.WriteObject(sendToPipeline: resources.CoalesceEnumerable().SelectArray(resource => resource.ToPsObject()), enumerateCollection: true));
}
///
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/InvokeAzureResourceActionCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/InvokeAzureResourceActionCmdlet.cs
index 1da27845b24e..4da02ad00e87 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/InvokeAzureResourceActionCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/InvokeAzureResourceActionCmdlet.cs
@@ -83,7 +83,7 @@ protected override void OnProcessRecord()
var resultString = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: false)
.WaitOnOperation(operationResult: operationResult);
- this.TryConvertAndWriteObject(resultString, ResourceObjectFormat.New);
+ this.TryConvertAndWriteObject(resultString);
});
}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Lock/ResourceLockManagementCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Lock/ResourceLockManagementCmdletBase.cs
index 7a5e2da39c56..c97a3e405c0b 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Lock/ResourceLockManagementCmdletBase.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Lock/ResourceLockManagementCmdletBase.cs
@@ -155,7 +155,7 @@ protected PSObject[] GetOutputObjects(params JToken[] resources)
.Where(resource => resource != null)
.SelectArray(resource =>
{
- var psobject = resource.ToResource().ToPsObject(ResourceObjectFormat.New);
+ var psobject = resource.ToResource().ToPsObject();
psobject.Properties.Add(new PSNoteProperty("LockId", psobject.Properties["ResourceId"].Value));
return psobject;
});
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyAssignmentCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyAssignmentCmdletBase.cs
index daf0c8232874..ba523ad3b9d4 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyAssignmentCmdletBase.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyAssignmentCmdletBase.cs
@@ -49,7 +49,7 @@ protected PSObject[] GetOutputObjects(params JToken[] resources)
.Where(resource => resource != null)
.SelectArray(resource =>
{
- var psobject = resource.ToResource().ToPsObject(ResourceObjectFormat.New);
+ var psobject = resource.ToResource().ToPsObject();
psobject.Properties.Add(new PSNoteProperty("PolicyAssignmentId", psobject.Properties["ResourceId"].Value));
return psobject;
});
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyDefinitionCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyDefinitionCmdletBase.cs
index ffc80a68199a..799c7751ee73 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyDefinitionCmdletBase.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Policy/PolicyDefinitionCmdletBase.cs
@@ -49,7 +49,7 @@ protected PSObject[] GetOutputObjects(params JToken[] resources)
.Where(resource => resource != null)
.SelectArray(resource =>
{
- var psobject = resource.ToResource().ToPsObject(ResourceObjectFormat.New);
+ var psobject = resource.ToResource().ToPsObject();
psobject.Properties.Add(new PSNoteProperty("PolicyDefinitionId", psobject.Properties["ResourceId"].Value));
return psobject;
});
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/FindAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/FindAzureResourceCmdlet.cs
index d4c419529285..e01a3fb96c61 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/FindAzureResourceCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/FindAzureResourceCmdlet.cs
@@ -122,25 +122,11 @@ public sealed class FindAzureResourceCmdlet : ResourceManagerCmdletBase
[Parameter(ParameterSetName = FindAzureResourceCmdlet.ListTenantResourcesParameterSet, Mandatory = true, HelpMessage = "Indicates that this is a tenant level operation.")]
public SwitchParameter TenantLevel { get; set; }
- ///
- /// Gets or sets the resource property object format.
- ///
- [Parameter(Mandatory = false, HelpMessage = "The output format of the resource properties.")]
- public ResourceObjectFormat OutputObjectFormat { get; set; }
-
///
/// Gets or sets the subscription id.
///
public Guid? SubscriptionId { get; set; }
- ///
- /// Initializes a new instance of the class.
- ///
- public FindAzureResourceCmdlet()
- {
- this.OutputObjectFormat = ResourceObjectFormat.Legacy;
- }
-
///
/// Collects subscription ids from the pipeline.
///
@@ -164,11 +150,6 @@ protected override void OnEndProcessing()
///
private void RunCmdlet()
{
- if(this.OutputObjectFormat == ResourceObjectFormat.Legacy)
- {
- this.WriteWarning("This cmdlet is using the legacy properties object format. This format is being deprecated. Please use '-OutputObjectFormat New' and update your scripts.");
- }
-
if (!this.TenantLevel)
{
this.SubscriptionId = DefaultContext.Subscription.Id;
@@ -193,14 +174,14 @@ private void RunCmdlet()
items = this.GetPopulatedResource(batch).Result;
}
- var powerShellObjects = items.SelectArray(genericResource => genericResource.ToPsObject(this.OutputObjectFormat));
+ var powerShellObjects = items.SelectArray(genericResource => genericResource.ToPsObject());
this.WriteObject(sendToPipeline: powerShellObjects, enumerateCollection: true);
}
}
else
{
- this.WriteObject(sendToPipeline: resources.CoalesceEnumerable().SelectArray(res => res.ToPsObject(this.OutputObjectFormat)), enumerateCollection: true);
+ this.WriteObject(sendToPipeline: resources.CoalesceEnumerable().SelectArray(res => res.ToPsObject()), enumerateCollection: true);
}
});
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/GetAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/GetAzureResourceCmdlet.cs
index e6b985bc519b..0345481a2d55 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/GetAzureResourceCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/GetAzureResourceCmdlet.cs
@@ -173,25 +173,11 @@ public sealed class GetAzureResourceCmdlet : ResourceManagerCmdletBase
[Parameter(ParameterSetName = GetAzureResourceCmdlet.ListTenantResourcesParameterSet, Mandatory = true, HelpMessage = "Indicates that this is a tenant level operation.")]
public SwitchParameter TenantLevel { get; set; }
- ///
- /// Gets or sets the resource property object format.
- ///
- [Parameter(Mandatory = false, HelpMessage = "The output format of the resource properties.")]
- public ResourceObjectFormat OutputObjectFormat { get; set; }
-
///
/// Gets or sets the subscription id.
///
public Guid? SubscriptionId { get; set; }
- ///
- /// Initializes a new instance of the class.
- ///
- public GetAzureResourceCmdlet()
- {
- this.OutputObjectFormat = ResourceObjectFormat.Legacy;
- }
-
///
/// Collects subscription ids from the pipeline.
///
@@ -215,11 +201,6 @@ protected override void OnEndProcessing()
///
private void RunCmdlet()
{
- if(this.OutputObjectFormat == ResourceObjectFormat.Legacy)
- {
- this.WriteWarning("This cmdlet is using the legacy properties object format. This format is being deprecated. Please use '-OutputObjectFormat New' and update your scripts.");
- }
-
if (string.IsNullOrEmpty(this.ResourceId) && !this.TenantLevel)
{
this.SubscriptionId = DefaultContext.Subscription.Id;
@@ -244,14 +225,14 @@ private void RunCmdlet()
items = this.GetPopulatedResource(batch).Result;
}
- var powerShellObjects = items.SelectArray(genericResource => genericResource.ToPsObject(this.OutputObjectFormat));
+ var powerShellObjects = items.SelectArray(genericResource => genericResource.ToPsObject());
this.WriteObject(sendToPipeline: powerShellObjects, enumerateCollection: true);
}
}
else
{
- this.WriteObject(sendToPipeline: resources.CoalesceEnumerable().SelectArray(res => res.ToPsObject(this.OutputObjectFormat)), enumerateCollection: true);
+ this.WriteObject(sendToPipeline: resources.CoalesceEnumerable().SelectArray(res => res.ToPsObject()), enumerateCollection: true);
}
});
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/MoveAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/MoveAzureResourceCmdlet.cs
index 8607250c6ce1..2864b81cb992 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/MoveAzureResourceCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/MoveAzureResourceCmdlet.cs
@@ -165,7 +165,7 @@ private void RunCmdlet()
isResourceCreateOrUpdate: false)
.WaitOnOperation(operationResult: operationResult);
- this.TryConvertAndWriteObject(result, ResourceObjectFormat.New);
+ this.TryConvertAndWriteObject(result);
});
}
}
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/NewAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/NewAzureResourceCmdlet.cs
index ab8ce0bf43c1..5e714d70c870 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/NewAzureResourceCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/NewAzureResourceCmdlet.cs
@@ -81,36 +81,16 @@ public sealed class NewAzureResourceCmdlet : ResourceManipulationCmdletBase
[Parameter(Mandatory = false, HelpMessage = "When set indicates that the full object is passed in to the -PropertyObject parameter.")]
public SwitchParameter IsFullObject { get; set; }
- ///
- /// Gets or sets the resource property object format.
- ///
- [Parameter(Mandatory = false, HelpMessage = "The output format of the resource properties.")]
- [ValidateNotNull]
- public ResourceObjectFormat? OutputObjectFormat { get; set; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public NewAzureResourceCmdlet()
- {
- this.OutputObjectFormat = ResourceObjectFormat.Legacy;
- }
-
///
/// Executes the cmdlet.
///
protected override void OnProcessRecord()
{
base.OnProcessRecord();
- this.DetermineOutputObjectFormat();
if(this.IsFullObject.IsPresent)
{
this.WriteWarning("The IsFullObject parameter is obsolete and will be removed in future releases.");
}
- if (this.OutputObjectFormat == ResourceObjectFormat.Legacy)
- {
- this.WriteWarning("This cmdlet is using the legacy properties object format. This format is being deprecated. Please use '-OutputObjectFormat New' and update your scripts.");
- }
var resourceId = this.GetResourceId();
this.ConfirmAction(
@@ -142,26 +122,10 @@ protected override void OnProcessRecord()
var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true)
.WaitOnOperation(operationResult: operationResult);
- this.TryConvertToResourceAndWriteObject(result, this.OutputObjectFormat.Value);
+ this.TryConvertToResourceAndWriteObject(result);
});
}
- ///
- /// Determines the output object format.
- ///
- private void DetermineOutputObjectFormat()
- {
- if (this.Properties != null && this.OutputObjectFormat == null && this.Properties.TypeNames.Any(typeName => typeName.EqualsInsensitively(Constants.MicrosoftAzureResource)))
- {
- this.OutputObjectFormat = ResourceObjectFormat.New;
- }
-
- if (this.OutputObjectFormat == null)
- {
- this.OutputObjectFormat = ResourceObjectFormat.Legacy;
- }
- }
-
///
/// Gets the resource body from the parameters.
///
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/SetAzureResourceCmdlet.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/SetAzureResourceCmdlet.cs
index cdb94e6ff6dd..a1ac909a9f6d 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/SetAzureResourceCmdlet.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/Resource/SetAzureResourceCmdlet.cs
@@ -75,24 +75,12 @@ public sealed class SetAzureResourceCmdlet : ResourceManipulationCmdletBase
[Parameter(Mandatory = false, HelpMessage = "When set indicates if an HTTP PATCH should be used to update the object instead of PUT.")]
public SwitchParameter UsePatchSemantics { get; set; }
- ///
- /// Gets or sets the resource property object format.
- ///
- [Parameter(Mandatory = false, HelpMessage = "The output format of the resource properties.")]
- [ValidateNotNull]
- public ResourceObjectFormat? OutputObjectFormat { get; set; }
-
///
/// Executes the cmdlet.
///
protected override void OnProcessRecord()
{
base.OnProcessRecord();
- this.DetermineOutputObjectFormat();
- if (this.OutputObjectFormat == ResourceObjectFormat.Legacy)
- {
- this.WriteWarning("This cmdlet is using the legacy properties object format. This format is being deprecated. Please use '-OutputObjectFormat New' and update your scripts.");
- }
if(!string.IsNullOrEmpty(this.ODataQuery))
{
@@ -138,26 +126,10 @@ protected override void OnProcessRecord()
var result = this.GetLongRunningOperationTracker(activityName: activity, isResourceCreateOrUpdate: true)
.WaitOnOperation(operationResult: operationResult);
- this.TryConvertToResourceAndWriteObject(result, this.OutputObjectFormat.Value);
+ this.TryConvertToResourceAndWriteObject(result);
});
}
- ///
- /// Determines the output object format.
- ///
- private void DetermineOutputObjectFormat()
- {
- if (this.Properties != null && this.OutputObjectFormat == null && this.Properties.TypeNames.Any(typeName => typeName.EqualsInsensitively(Constants.MicrosoftAzureResource)))
- {
- this.OutputObjectFormat = ResourceObjectFormat.New;
- }
-
- if (this.OutputObjectFormat == null)
- {
- this.OutputObjectFormat = ResourceObjectFormat.Legacy;
- }
- }
-
///
/// Gets the resource body.
///
diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManagerCmdletBase.cs b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManagerCmdletBase.cs
index 8413f672cbe5..3844b525bc1e 100644
--- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManagerCmdletBase.cs
+++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Implementation/ResourceManagerCmdletBase.cs
@@ -276,13 +276,12 @@ private Dictionary GetCmdletHeaders()
/// Writes the object
///
/// The result as a string
- /// The
- protected void TryConvertAndWriteObject(string resultString, ResourceObjectFormat objectFormat)
+ protected void TryConvertAndWriteObject(string resultString)
{
JToken resultJToken;
if (resultString.TryConvertTo(out resultJToken))
{
- this.WriteObject(resultJToken, objectFormat);
+ this.WriteObject(resultJToken);
}
else
{
@@ -294,13 +293,12 @@ protected void TryConvertAndWriteObject(string resultString, ResourceObjectForma
/// Writes the object
///
/// The result as a string
- /// The
- protected void TryConvertToResourceAndWriteObject(string resultString, ResourceObjectFormat objectFormat)
+ protected void TryConvertToResourceAndWriteObject(string resultString)
{
Resource resultResource;
if (resultString.TryConvertTo>(out resultResource))
{
- this.WriteObject(resultResource.ToPsObject(objectFormat));
+ this.WriteObject(resultResource.ToPsObject());
}
else
{
@@ -312,10 +310,9 @@ protected void TryConvertToResourceAndWriteObject(string resultString, ResourceO
/// Writes a object as a .
///
/// The result of the action.
- /// The
- protected void WriteObject(JToken result, ResourceObjectFormat objectFormat)
+ protected void WriteObject(JToken result)
{
- this.WriteObject(sendToPipeline: result.ToPsObject(objectFormat), enumerateCollection: true);
+ this.WriteObject(sendToPipeline: result.ToPsObject(), enumerateCollection: true);
}
///