Skip to content
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

Fix for not setting apirevisiondescription #9756

Merged
merged 2 commits into from
Aug 7, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -3051,6 +3051,7 @@ function ApiRevision-CrudTest {
$swaggerApiId1 = getAssetName
$apiRevisionId = "2"
$apiReleaseId = getAssetName
$apiRevisionDescription = getAssetName

try {
# import api from file
Expand Down Expand Up @@ -3079,9 +3080,11 @@ function ApiRevision-CrudTest {

# now lets create an api revision
$expectedApiId = [string]::Format("{0};rev={1}", $swaggerApiId1, $apiRevisionId)
$apiRevision = New-AzApiManagementApiRevision -Context $context -ApiId $swaggerApiId1 -ApiRevision $apiRevisionId -SourceApiRevision "1"
$apiRevision = New-AzApiManagementApiRevision -Context $context -ApiId $swaggerApiId1 -ApiRevision $apiRevisionId -SourceApiRevision "1" -ApiRevisionDescription $apiRevisionDescription
Assert-AreEqual $expectedApiId $apiRevision.ApiId
Assert-AreEqual $apiRevisionId $apiRevision.ApiRevision
Assert-NotNull $apiRevision.ApiRevisionDescription
Assert-AreEqual $apiRevisionDescription $apiRevision.ApiRevisionDescription
Assert-AreEqual $path1 $apiRevision.Path
Assert-False { $apiRevision.IsCurrent }

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private static void ConfigureMappings()
.ForMember(dest => dest.CertificateId, opt => opt.MapFrom(src => src.Name));

cfg
.CreateMap<AuthorizationServerContract, PsApiManagementOAuth2AuthrozationServer>()
.CreateMap<AuthorizationServerContract, PsApiManagementOAuth2AuthorizationServer>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.ServerId, opt => opt.MapFrom(src => src.Name))
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.DisplayName))
Expand Down Expand Up @@ -1165,7 +1165,8 @@ public PsApiManagementApi ApiCreateRevision(
string apiId,
string revisionId,
string sourceRevisionId,
string serviceUrl)
string serviceUrl,
string apiRevisiondescription)
{
var api = Client.Api.Get(context.ResourceGroupName, context.ServiceName, apiId);
ApiCreateOrUpdateParameter apiCreateParams;
Expand All @@ -1185,6 +1186,11 @@ public PsApiManagementApi ApiCreateRevision(
apiCreateParams.ServiceUrl = serviceUrl;
}

if (!string.IsNullOrEmpty(apiRevisiondescription))
{
apiCreateParams.ApiRevisionDescription = apiRevisiondescription;
}

var getResponse = Client.Api.CreateOrUpdate(
context.ResourceGroupName,
context.ServiceName,
Expand Down Expand Up @@ -2404,25 +2410,25 @@ public void CertificateRemove(PsApiManagementContext context, string certificate

#region Authorization Servers

public IList<PsApiManagementOAuth2AuthrozationServer> AuthorizationServerList(string resourceGroupName, string serviceName)
public IList<PsApiManagementOAuth2AuthorizationServer> AuthorizationServerList(string resourceGroupName, string serviceName)
{
var results = ListPagedAndMap<PsApiManagementOAuth2AuthrozationServer, AuthorizationServerContract>(
var results = ListPagedAndMap<PsApiManagementOAuth2AuthorizationServer, AuthorizationServerContract>(
() => Client.AuthorizationServer.ListByService(resourceGroupName, serviceName, null),
nextLink => Client.AuthorizationServer.ListByServiceNext(nextLink));

return results;
}

public PsApiManagementOAuth2AuthrozationServer AuthorizationServerById(
public PsApiManagementOAuth2AuthorizationServer AuthorizationServerById(
string resourceGroupName, string serviceName, string serverId)
{
var response = Client.AuthorizationServer.Get(resourceGroupName, serviceName, serverId);

var server = Mapper.Map<PsApiManagementOAuth2AuthrozationServer>(response);
var server = Mapper.Map<PsApiManagementOAuth2AuthorizationServer>(response);
return server;
}

public PsApiManagementOAuth2AuthrozationServer AuthorizationServerCreate(
public PsApiManagementOAuth2AuthorizationServer AuthorizationServerCreate(
PsApiManagementContext context,
string serverId,
string name,
Expand Down Expand Up @@ -2481,7 +2487,7 @@ public PsApiManagementOAuth2AuthrozationServer AuthorizationServerCreate(
serverId,
serverContract);

var server = Mapper.Map<PsApiManagementOAuth2AuthrozationServer>(response);
var server = Mapper.Map<PsApiManagementOAuth2AuthorizationServer>(response);

return server;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;

[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementAuthorizationServer", DefaultParameterSetName = ContextParameterSet)]
[OutputType(typeof(PsApiManagementOAuth2AuthrozationServer))]
[OutputType(typeof(PsApiManagementOAuth2AuthorizationServer))]
public class GetAzureApiManagementAuthorizationServer : AzureApiManagementCmdletBase
{
#region ParameterSet
Expand Down Expand Up @@ -59,7 +59,7 @@ public override void ExecuteApiManagementCmdlet()

if (ParameterSetName.Equals(ResourceIdParameterSet))
{
var authorizationServer = new PsApiManagementOAuth2AuthrozationServer(ResourceId);
var authorizationServer = new PsApiManagementOAuth2AuthorizationServer(ResourceId);
resourceGroupName = authorizationServer.ResourceGroupName;
serviceName = authorizationServer.ServiceName;
authorizationserverId = authorizationServer.ServerId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public override void ExecuteApiManagementCmdlet()
ApiId,
ApiRevision,
SourceApiRevision,
ServiceUrl);
ServiceUrl,
ApiRevisionDescription);
WriteObject(newApi);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
using System.Management.Automation;

[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementAuthorizationServer")]
[OutputType(typeof(PsApiManagementOAuth2AuthrozationServer))]
[OutputType(typeof(PsApiManagementOAuth2AuthorizationServer))]
public class NewAzureApiManagementAuthorizationServer : AzureApiManagementCmdletBase
{
[Parameter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
using System.Management.Automation;

[Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementAuthorizationServer")]
[OutputType(typeof(PsApiManagementOAuth2AuthrozationServer))]
[OutputType(typeof(PsApiManagementOAuth2AuthorizationServer))]
public class SetAzureApiManagementAuthorizationServer : AzureApiManagementCmdletBase
{
[Parameter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models
using System.Collections;
using System.Text.RegularExpressions;

public class PsApiManagementOAuth2AuthrozationServer : PsApiManagementArmResource
public class PsApiManagementOAuth2AuthorizationServer : PsApiManagementArmResource
{
static readonly Regex AuthorizationServerIdRegex = new Regex(@"(.*?)/providers/microsoft.apimanagement/service/(?<serviceName>[^/]+)/authorizationServers/(?<authorizationServerId>[^/]+)", RegexOptions.IgnoreCase);

Expand Down Expand Up @@ -57,9 +57,9 @@ public class PsApiManagementOAuth2AuthrozationServer : PsApiManagementArmResourc

public string ResourceOwnerPassword { get; set; }

public PsApiManagementOAuth2AuthrozationServer() { }
public PsApiManagementOAuth2AuthorizationServer() { }

public PsApiManagementOAuth2AuthrozationServer(string armResourceId)
public PsApiManagementOAuth2AuthorizationServer(string armResourceId)
{
this.Id = armResourceId;
var match = AuthorizationServerIdRegex.Match(Id);
Expand Down
8 changes: 7 additions & 1 deletion src/ApiManagement/ApiManagement/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@
-->
## Upcoming Release
* Fixed miscellaneous typos across module

* Fix for issue https://github.com/Azure/azure-powershell/issues/9351
- Update .net nuget version, which does not enforce restrictions on productId, apiId, groupId and userId

* Added support for querying products using Api
* **Get-AzApiManagementProduct** - Added support for querying products using Api.
https://github.com/Azure/azure-powershell/issues/9482

* **New-AzApiManagementApiRevision** - Fix for issue where ApiRevisionDescription was not being set when creating new api revision
https://github.com/Azure/azure-powershell/issues/9752

* Fixed typo in model `PsApiManagementOAuth2AuthrozationServer` to `PsApiManagementOAuth2AuthorizationServer`

## Version 1.2.0

* Fix for issue https://github.com/Azure/azure-powershell/issues/8671
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOAuth2AuthrozationServer
### Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOAuth2AuthorizationServer

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOAuth2AuthrozationServer
### Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOAuth2AuthorizationServer

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOAuth2AuthrozationServer
### Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOAuth2AuthorizationServer

## NOTES

Expand Down