Skip to content

ApiManagement - Fix Issues and Add support for AzureMonitor logger #6997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 23, 2018
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
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If this issue is not a bug report, please remove the below template

### Module Version

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

```powershell
Get-Module -ListAvailable
Expand All @@ -44,7 +44,7 @@ $PSVersionTable

### Debug Output

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

```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public IList<PsApiManagementApi> ApiByName(PsApiManagementContext context, strin
context.ServiceName,
new Rest.Azure.OData.ODataQuery<ApiContract>
{
Filter = string.Format("contains('{0}',properties/displayName)", name)
Filter = string.Format("properties/displayName eq '{0}'", name)
}),
nextLink => Client.Api.ListByServiceNext(nextLink));

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

var results = ListPagedAndMap<PsApiManagementProduct, ProductContract>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.3-preview" />
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.4-preview" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.ApiManagement, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.4.0.3-preview\lib\net452\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.4.0.4-preview\lib\net452\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Data.Edm, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@

namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
{
using Models;
using System;
using System.Globalization;
using System.IO;
using System.Management.Automation;
using Management.ApiManagement.Models;
using Models;
using Properties;

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

if (ParameterSetName.Equals(FromLocalFile))
{
FileInfo localFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(this.SpecificationPath));
if (!localFile.Exists)
{
throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.SourceFileNotFound, this.SpecificationPath));
}

Client.ApiImportFromFile(
Context,
apiId,
SpecificationFormat,
SpecificationPath,
localFile.FullName,
Path,
WsdlServiceName,
WsdlEndpointName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
{
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using System;
using System.Globalization;
using System.IO;
using System.Management.Automation;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using Properties;

[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementCertificate", DefaultParameterSetName = FromFile)]
[OutputType(typeof(PsApiManagementCertificate))]
Expand Down Expand Up @@ -67,7 +69,13 @@ public override void ExecuteApiManagementCmdlet()
byte[] rawBytes;
if (ParameterSetName.Equals(FromFile))
{
using (var certStream = File.OpenRead(PfxFilePath))
FileInfo localFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(this.PfxFilePath));
if (!localFile.Exists)
{
throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.SourceFileNotFound, PfxFilePath));
}

using (var certStream = File.OpenRead(localFile.FullName))
{
rawBytes = new byte[certStream.Length];
certStream.Read(rawBytes, 0, rawBytes.Length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
{
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using System;
using System.Globalization;
using System.IO;
using System.Management.Automation;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using Properties;

[Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementCertificate", DefaultParameterSetName = FromFile)]
[OutputType(typeof(PsApiManagementCertificate))]
Expand Down Expand Up @@ -77,7 +79,13 @@ public override void ExecuteApiManagementCmdlet()
byte[] rawBytes;
if (ParameterSetName.Equals(FromFile))
{
using (var certStream = File.OpenRead(PfxFilePath))
FileInfo localFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(this.PfxFilePath));
if (!localFile.Exists)
{
throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.SourceFileNotFound, this.PfxFilePath));
}

using (var certStream = File.OpenRead(localFile.FullName))
{
rawBytes = new byte[certStream.Length];
certStream.Read(rawBytes, 0, rawBytes.Length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models
public enum PsApiManagementLoggerType
{
AzureEventHub = 1,
ApplicationInsights = 2
ApplicationInsights = 2,
AzureMonitor = 3
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@
<value>Confirm</value>
<comment>Process workflow</comment>
</data>
<data name="SourceFileNotFound" xml:space="preserve">
<value>File '{0}' does not exist.</value>
<comment>Process workflow</comment>
</data>
<data name="SubscriptionRemoveDescription" xml:space="preserve">
<value>Removing Subscription "{0}".</value>
<comment>Process workflow</comment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="6.0.2" targetFramework="net452" />
<package id="Microsoft.Azure.Management.ApiManagement" version="4.0.3-preview" targetFramework="net452" />
<package id="Microsoft.Azure.Management.ApiManagement" version="4.0.4-preview" targetFramework="net452" />
<package id="Microsoft.Data.Edm" version="5.8.2" targetFramework="net452" />
<package id="Microsoft.Data.OData" version="5.8.2" targetFramework="net452" />
<package id="Microsoft.Data.OData" version="5.8.2" targetFramework="net452" />
<package id="System.Spatial" version="5.8.2" targetFramework="net452" />
<package id="WindowsAzure.Storage" version="8.1.1" targetFramework="net452" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.3-preview" />
<PackageReference Include="Microsoft.Azure.Management.ApiManagement" Version="4.0.4-preview" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Azure.Management.ApiManagement, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.4.0.3-preview\lib\net452\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.4.0.4-preview\lib\net452\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
Loading