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
2 changes: 1 addition & 1 deletion src/Resources/ResourceManager/ResourceManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.9.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.10.0-preview" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Resources.Test/Resources.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.Azure.Management.ResourceManager" Version="3.9.0-preview" />
<PackageReference Update="Microsoft.Azure.Management.ResourceManager" Version="3.10.0-preview" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.9.0" />
Expand Down
27 changes: 27 additions & 0 deletions src/Resources/Resources.Test/ScenarioTests/PolicyAliasTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,27 @@ public void TestGetAzureRmPolicyAliasAllParameters()
this.VerifyListCallPatternAndReset();
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetAzureRmPolicyAliasWithPathMetadata()
{
var providers = new ProviderListBuilder();
var provider = providers.AddProvider("Provider1");
var resourceTypes = provider.AddResourceType("ResourceType1");
var alias = resourceTypes.AddAlias("Alias1");
alias.AddDefaultAliasPathMetadata(AliasPathAttributes.Modifiable, AliasPathTokenType.String);
alias.AddAliasPath("properties.alias1", new List<string> { "2020-01-01" }, new AliasPathMetadata(AliasPathAttributes.Modifiable, AliasPathTokenType.Object));

var listResult = providers.List;
this.SetupAliasListResult(listResult);

this.commandRuntimeMock
.Setup(m => m.WriteObject(It.IsAny<object>(), It.IsAny<bool>()))
.Callback((object obj, bool listAll) => { this.AssertResult(obj, listResult, 1); });

this.cmdlet.ExecuteCmdlet();
this.VerifyListCallPatternAndReset();
}
/// <summary>
/// Helper method that sets up the expected result of the alias list cmdlet
/// </summary>
Expand Down Expand Up @@ -497,6 +518,9 @@ private void AssertResult(object resultObject, IEnumerable<Provider> expectedPro
var expectedAlias = expectedResourceType.Aliases.SingleOrDefault(item => item.Name.EqualsInsensitively(actualAlias.Name));
Assert.NotNull(expectedAlias);

Assert.Equal(expectedAlias.DefaultMetadata?.Attributes, actualAlias.DefaultMetadata?.Attributes);
Assert.Equal(expectedAlias.DefaultMetadata?.Type, actualAlias.DefaultMetadata?.Type);

// verify paths collection
if (actualAlias.Paths == null)
{
Expand All @@ -509,6 +533,9 @@ private void AssertResult(object resultObject, IEnumerable<Provider> expectedPro
var expectedPath = expectedAlias.Paths.SingleOrDefault(item => item.Path.EqualsInsensitively(actualPath.Path));
Assert.NotNull(expectedPath);

Assert.Equal(actualPath.Metadata?.Attributes, expectedPath.Metadata?.Attributes);
Assert.Equal(actualPath.Metadata?.Type, expectedPath.Metadata?.Type);

// verify API version collection
if (actualPath.ApiVersions == null)
{
Expand Down
13 changes: 10 additions & 3 deletions src/Resources/Resources.Test/ScenarioTests/ProviderListBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,28 @@ public class AliasBuilder
public static IList<string> DefaultApiVersions { get; } = new List<string> { "2018-01-01", "2016-01-01" };
private string Name { get; }
private List<AliasPath> Paths { get; } = new List<AliasPath>();
private AliasPathMetadata DefaultAliasPathMetadata { get; set; }

public AliasBuilder(string name)
{
this.Name = name;
}

public Alias Alias => new Alias
public Alias Alias => new Alias(defaultMetadata: this.DefaultAliasPathMetadata)
{
Name = this.Name,
Paths = this.Paths
};

public AliasPath AddAliasPath(string path, IEnumerable<string> apiVersions = null)
public AliasPathMetadata AddDefaultAliasPathMetadata(string attributes, string type)
{
var rv = new AliasPath
this.DefaultAliasPathMetadata = new AliasPathMetadata(attributes, type);
return this.DefaultAliasPathMetadata;
}

public AliasPath AddAliasPath(string path, IEnumerable<string> apiVersions = null, AliasPathMetadata metadata= null)
{
var rv = new AliasPath(metadata: metadata)
{
Path = path,
ApiVersions = apiVersions?.ToList() ?? AliasBuilder.DefaultApiVersions
Expand Down
1 change: 1 addition & 0 deletions src/Resources/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Updated `Get-AzPolicyAlias` response to include information indicating whether the alias is modifiable by Azure Policy.
* Created new cmdlet `Set-AzRoleAssignment`
* Added `Get-AzDeploymentManagementGroupWhatIfResult` for getting ARM template What-If results at management Group scope
* Added `Get-AzTenantWhatIfResult` new cmdlet for getting ARM template What-If results at tenant scope
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Tags/Tags.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.9.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.10.0-preview" />
</ItemGroup>

</Project>