Skip to content

Commit e9b3bb9

Browse files
author
Radhika Kashyap
committed
Fix incorrect merge
1 parent 50b6c9c commit e9b3bb9

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.ResourceManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ public virtual List<PSResourceGroupDeployment> FilterResourceGroupDeployments(Fi
475475

476476
if (!string.IsNullOrEmpty(resourceGroup) && !string.IsNullOrEmpty(name))
477477
{
478-
deployments.Add(ResourceManagementClient.Deployments.Get(resourceGroup, name).Deployment.ToPSResourceGroupDeployment(options.ResourceGroupName));
478+
deployments.Add(ResourceManagementClient.Deployments.Get(resourceGroup, name).ToPSResourceGroupDeployment(options.ResourceGroupName));
479479
}
480480
else if (!string.IsNullOrEmpty(resourceGroup))
481481
{

src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourcesExtensions.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ public static PSResourceGroup ToPSResourceGroup(this ResourceGroupExtended resou
5252
return result;
5353
}
5454

55+
public static PSResourceGroupDeployment ToPSResourceGroupDeployment(this DeploymentGetResult result, string resourceGroup)
56+
{
57+
PSResourceGroupDeployment deployment = new PSResourceGroupDeployment();
58+
59+
if (result != null)
60+
{
61+
deployment = CreatePSResourceGroupDeployment(result.Deployment.Name, resourceGroup, result.Deployment.Properties);
62+
}
63+
64+
return deployment;
65+
}
66+
67+
5568
public static PSResourceGroupDeployment ToPSResourceGroupDeployment(this DeploymentExtended result, string resourceGroup)
5669
{
5770
PSResourceGroupDeployment deployment = new PSResourceGroupDeployment();
@@ -75,7 +88,20 @@ public static PSResourceManagerError ToPSResourceManagerError(this ResourceManag
7588

7689
public static PSResource ToPSResource(this GenericResourceExtended resource, ResourcesClient client, bool minimal)
7790
{
78-
return resource.ToPSResource(client, minimal);
91+
ResourceIdentifier identifier = new ResourceIdentifier(resource.Id);
92+
return new PSResource
93+
{
94+
Name = identifier.ResourceName,
95+
Location = resource.Location,
96+
ResourceType = identifier.ResourceType,
97+
ResourceGroupName = identifier.ResourceGroupName,
98+
ParentResource = identifier.ParentResource,
99+
Properties = JsonUtilities.DeserializeJson(resource.Properties),
100+
PropertiesText = resource.Properties,
101+
Tags = TagsConversionHelper.CreateTagHashtable(resource.Tags),
102+
Permissions = minimal ? null : client.GetResourcePermissions(identifier),
103+
ResourceId = identifier.ToString()
104+
};
79105
}
80106

81107
public static PSResourceProvider ToPSResourceProvider(this Provider provider)

0 commit comments

Comments
 (0)