Skip to content

Commit 125812d

Browse files
authored
Merge pull request #6997 from solankisamir/sasolank/setazumrmfix
ApiManagement - Fix Issues and Add support for AzureMonitor logger
2 parents 2755242 + 345d0ff commit 125812d

File tree

54 files changed

+9865
-8246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+9865
-8246
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If this issue is not a bug report, please remove the below template
2828

2929
### Module Version
3030

31-
<!-- Please run (Get-Module -Name AzureRM -ListAvailable) to get the version(s) of AzureRM installed on your machine -->
31+
<!-- Please run (Get-Module -ListAvailable) to get the version(s) of all modules, including Azure installed on your machine -->
3232

3333
```powershell
3434
Get-Module -ListAvailable
@@ -44,7 +44,7 @@ $PSVersionTable
4444

4545
### Debug Output
4646

47-
<!-- Please run the above script with $DebugPreference = "Continue" and paste the resulting debug stream in the below code block -->
47+
<!-- Please run the above script with $DebugPreference='Continue' and paste the resulting debug stream in the below code block -->
4848

4949
```
5050

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/ApiManagementClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ public IList<PsApiManagementApi> ApiByName(PsApiManagementContext context, strin
529529
context.ServiceName,
530530
new Rest.Azure.OData.ODataQuery<ApiContract>
531531
{
532-
Filter = string.Format("contains('{0}',properties/displayName)", name)
532+
Filter = string.Format("properties/displayName eq '{0}'", name)
533533
}),
534534
nextLink => Client.Api.ListByServiceNext(nextLink));
535535

@@ -1269,7 +1269,7 @@ public IList<PsApiManagementProduct> ProductList (PsApiManagementContext context
12691269
var query = new Rest.Azure.OData.ODataQuery<ProductContract>();
12701270
if (!string.IsNullOrWhiteSpace(title))
12711271
{
1272-
query.Filter = string.Format("contains('{0}',properties/displayName)", title);
1272+
query.Filter = string.Format("properties/displayName eq '{0}'", title);
12731273
}
12741274

12751275
var results = ListPagedAndMap<PsApiManagementProduct, ProductContract>(

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.Netcore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<ItemGroup>
3131
<PackageReference Include="AutoMapper" Version="6.2.2" />
32-
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.3-preview" />
32+
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.4-preview" />
3333
</ItemGroup>
3434

3535
<ItemGroup>

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands.ApiManagement.ServiceManagement.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<Private>True</Private>
5454
</Reference>
5555
<Reference Include="Microsoft.Azure.Management.ApiManagement, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
56-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.4.0.3-preview\lib\net452\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
56+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.4.0.4-preview\lib\net452\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
5757
<Private>True</Private>
5858
</Reference>
5959
<Reference Include="Microsoft.Data.Edm, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/ImportAzureApiManagementApi.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414

1515
namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
1616
{
17-
using Models;
1817
using System;
18+
using System.Globalization;
19+
using System.IO;
1920
using System.Management.Automation;
2021
using Management.ApiManagement.Models;
22+
using Models;
23+
using Properties;
2124

2225
[Cmdlet("Import", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementApi", DefaultParameterSetName = FromLocalFile)]
2326
[OutputType(typeof(PsApiManagementApi))]
@@ -109,15 +112,21 @@ public override void ExecuteApiManagementCmdlet()
109112
else
110113
{
111114
apiId = Guid.NewGuid().ToString("N");
112-
}
115+
}
113116

114117
if (ParameterSetName.Equals(FromLocalFile))
115118
{
119+
FileInfo localFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(this.SpecificationPath));
120+
if (!localFile.Exists)
121+
{
122+
throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.SourceFileNotFound, this.SpecificationPath));
123+
}
124+
116125
Client.ApiImportFromFile(
117126
Context,
118127
apiId,
119128
SpecificationFormat,
120-
SpecificationPath,
129+
localFile.FullName,
121130
Path,
122131
WsdlServiceName,
123132
WsdlEndpointName,

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/NewAzureApiManagementCertificate.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414

1515
namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
1616
{
17-
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
1817
using System;
18+
using System.Globalization;
1919
using System.IO;
2020
using System.Management.Automation;
2121
using System.Security.Cryptography.X509Certificates;
22+
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
23+
using Properties;
2224

2325
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementCertificate", DefaultParameterSetName = FromFile)]
2426
[OutputType(typeof(PsApiManagementCertificate))]
@@ -67,7 +69,13 @@ public override void ExecuteApiManagementCmdlet()
6769
byte[] rawBytes;
6870
if (ParameterSetName.Equals(FromFile))
6971
{
70-
using (var certStream = File.OpenRead(PfxFilePath))
72+
FileInfo localFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(this.PfxFilePath));
73+
if (!localFile.Exists)
74+
{
75+
throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.SourceFileNotFound, PfxFilePath));
76+
}
77+
78+
using (var certStream = File.OpenRead(localFile.FullName))
7179
{
7280
rawBytes = new byte[certStream.Length];
7381
certStream.Read(rawBytes, 0, rawBytes.Length);

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/SetAzureApiManagementCertificate.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414

1515
namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
1616
{
17-
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
1817
using System;
18+
using System.Globalization;
1919
using System.IO;
2020
using System.Management.Automation;
2121
using System.Security.Cryptography.X509Certificates;
22+
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
23+
using Properties;
2224

2325
[Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementCertificate", DefaultParameterSetName = FromFile)]
2426
[OutputType(typeof(PsApiManagementCertificate))]
@@ -77,7 +79,13 @@ public override void ExecuteApiManagementCmdlet()
7779
byte[] rawBytes;
7880
if (ParameterSetName.Equals(FromFile))
7981
{
80-
using (var certStream = File.OpenRead(PfxFilePath))
82+
FileInfo localFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(this.PfxFilePath));
83+
if (!localFile.Exists)
84+
{
85+
throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.SourceFileNotFound, this.PfxFilePath));
86+
}
87+
88+
using (var certStream = File.OpenRead(localFile.FullName))
8189
{
8290
rawBytes = new byte[certStream.Length];
8391
certStream.Read(rawBytes, 0, rawBytes.Length);

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Models/PsApiManagementLoggerType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models
1717
public enum PsApiManagementLoggerType
1818
{
1919
AzureEventHub = 1,
20-
ApplicationInsights = 2
20+
ApplicationInsights = 2,
21+
AzureMonitor = 3
2122
}
2223
}

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Properties/Resources.resx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@
299299
<value>Confirm</value>
300300
<comment>Process workflow</comment>
301301
</data>
302+
<data name="SourceFileNotFound" xml:space="preserve">
303+
<value>File '{0}' does not exist.</value>
304+
<comment>Process workflow</comment>
305+
</data>
302306
<data name="SubscriptionRemoveDescription" xml:space="preserve">
303307
<value>Removing Subscription "{0}".</value>
304308
<comment>Process workflow</comment>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="AutoMapper" version="6.0.2" targetFramework="net452" />
4-
<package id="Microsoft.Azure.Management.ApiManagement" version="4.0.3-preview" targetFramework="net452" />
4+
<package id="Microsoft.Azure.Management.ApiManagement" version="4.0.4-preview" targetFramework="net452" />
55
<package id="Microsoft.Data.Edm" version="5.8.2" targetFramework="net452" />
6-
<package id="Microsoft.Data.OData" version="5.8.2" targetFramework="net452" />
6+
<package id="Microsoft.Data.OData" version="5.8.2" targetFramework="net452" />
77
<package id="System.Spatial" version="5.8.2" targetFramework="net452" />
88
<package id="WindowsAzure.Storage" version="8.1.1" targetFramework="net452" />
99
</packages>

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.Netcore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</PropertyGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.3-preview" />
28+
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.4-preview" />
2929
</ItemGroup>
3030

3131
<ItemGroup>

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</PropertyGroup>
3636
<ItemGroup>
3737
<Reference Include="Microsoft.Azure.Management.ApiManagement, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
38-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.4.0.3-preview\lib\net452\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
38+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.4.0.4-preview\lib\net452\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
3939
<Private>True</Private>
4040
</Reference>
4141
<Reference Include="Microsoft.Azure.Management.Storage, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

0 commit comments

Comments
 (0)