Skip to content

Commit

Permalink
[Az.Resources] Decouple Automapper (Azure#21133)
Browse files Browse the repository at this point in the history
* Decouple automapper from Az.Resources

* Remove unnecessary dependency

* Remove dependency in psd1
  • Loading branch information
NoriZC authored Mar 7, 2023
1 parent 7b87a59 commit fa4b0eb
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/Resources/ResourceManager/ResourceManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.PowerShell.AutoMapper" Version="6.2.2" />

<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.17.3-preview" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.ResourceManager.Models;
using System;
using System.Text;
using ProjectResources = Microsoft.Azure.Commands.ResourceManager.Cmdlets.Properties.Resources;

Expand All @@ -21,6 +22,26 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels
public class PsScriptStatus : ScriptStatus
{
private const char Whitespace = ' ';
public new string ContainerInstanceId { get; private set; }
public new string StorageAccountId { get; private set; }
public new DateTime? StartTime { get; private set; }
public new DateTime? EndTime { get; private set; }
public new DateTime? ExpirationTime { get; private set; }
public new ErrorResponse Error { get; set; }

internal static PsScriptStatus ToPsScriptStatus(ScriptStatus status)
{
return new PsScriptStatus
{
ContainerInstanceId = status.ContainerInstanceId,
StorageAccountId = status.StorageAccountId,
StartTime = status.StartTime,
EndTime = status.EndTime,
ExpirationTime = status.ExpirationTime,
Error = status.Error
};
}


public string GetFormattedErrorString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static PsAzureCliScript ToPsAzureCliScript(AzureCliScript script)
Tags = script.Tags,
CleanupPreference = script.CleanupPreference,
ProvisioningState = script.ProvisioningState,
Status = DeploymentScriptsAutoMapperProfile.Mapper.Map<PsScriptStatus>(script.Status),
Status = PsScriptStatus.ToPsScriptStatus(script.Status),
Outputs = script.Outputs,
PrimaryScriptUri = script.PrimaryScriptUri,
SupportingScriptUris = script.SupportingScriptUris,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static PsAzurePowerShellScript ToPsAzurePowerShellScript(AzurePowerShel
Tags = script.Tags,
CleanupPreference = script.CleanupPreference,
ProvisioningState = script.ProvisioningState,
Status = DeploymentScriptsAutoMapperProfile.Mapper.Map<PsScriptStatus>(script.Status),
Status = PsScriptStatus.ToPsScriptStatus(script.Status),
Outputs = script.Outputs,
PrimaryScriptUri = script.PrimaryScriptUri,
SupportingScriptUris = script.SupportingScriptUris,
Expand Down
1 change: 0 additions & 1 deletion src/Resources/Resources/Az.Resources.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ RequiredAssemblies = 'Microsoft.Azure.Management.Authorization.dll',
'Microsoft.Extensions.Options.dll',
'Microsoft.Extensions.Primitives.dll',
'System.Runtime.CompilerServices.Unsafe.dll',
'Microsoft.Azure.PowerShell.AutoMapper.dll',
'MSGraph.Autorest\bin\Az.MSGraph.private.dll',
'Authorization.Autorest\bin\Az.Authorization.private.dll'

Expand Down

0 comments on commit fa4b0eb

Please sign in to comment.