Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
solankisamir committed Aug 21, 2018
1 parent 138b837 commit e0f5eb7
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 15 deletions.
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 @@ -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.Name))
{
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.Name))
{
rawBytes = new byte[certStream.Length];
certStream.Read(rawBytes, 0, rawBytes.Length);
Expand Down

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
Expand Up @@ -14,12 +14,14 @@

namespace Microsoft.Azure.Commands.ApiManagement.Commands
{
using Microsoft.Azure.Commands.ApiManagement.Models;
using ResourceManager.Common;
using System;
using System.Globalization;
using System.IO;
using System.Management.Automation;
using System.Security;
using Microsoft.Azure.Commands.ApiManagement.Models;
using Properties;
using ResourceManager.Common;
using WindowsAzure.Commands.Common;

[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementCustomHostnameConfiguration", DefaultParameterSetName = "NoChangeCertificate")]
Expand Down Expand Up @@ -99,8 +101,14 @@ public override void ExecuteCmdlet()
}
else if (!string.IsNullOrWhiteSpace(PfxPath))
{
FileInfo localFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(this.PfxPath));
if (!localFile.Exists)
{
throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.SourceFileNotFound, this.PfxPath));
}

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

namespace Microsoft.Azure.Commands.ApiManagement.Commands
{
using Microsoft.Azure.Commands.ApiManagement.Models;
using ResourceManager.Common;
using System;
using System.Globalization;
using System.IO;
using System.Management.Automation;
using System.Security;
using Microsoft.Azure.Commands.ApiManagement.Models;
using Properties;
using ResourceManager.Common;
using WindowsAzure.Commands.Common;

[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementSystemCertificate")]
Expand Down Expand Up @@ -48,9 +50,15 @@ public override void ExecuteCmdlet()
{
var systemCertificate = new PsApiManagementSystemCertificate();
systemCertificate.StoreName = StoreName;

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

byte[] certificate;
using (var certStream = File.OpenRead(PfxPath))
using (var certStream = File.OpenRead(localFile.Name))
{
certificate = new byte[certStream.Length];
certStream.Read(certificate, 0, certificate.Length);
Expand Down

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 @@ -145,6 +145,10 @@
<value>Confirm</value>
<comment>Process workflow</comment>
</data>
<data name="SourceFileNotFound" xml:space="preserve">
<value>File at path '{0}' does not exist</value>
<comment>Process workflow</comment>
</data>
<data name="UpdateApiManagementService" xml:space="preserve">
<value>Update an Api Management Service.</value>
<comment>Process workflow</comment>
Expand Down

0 comments on commit e0f5eb7

Please sign in to comment.