Skip to content

AzureApiManagement breaking changes for api version 2019-12-01 #11618

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 11 commits into from
May 2, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -11,7 +11,7 @@
</PropertyGroup>

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

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void ApiCrudTest()

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ApiCloneCrudTest()
public void ApiCloneCrudTest()
{
RunPowerShellTest("ApiClone-Test");
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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 @@ -13,7 +13,7 @@

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

<ItemGroup>
Expand Down
167 changes: 131 additions & 36 deletions src/ApiManagement/ApiManagement.ServiceManagement/ApiManagementClient.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
using System;
using System.Management.Automation;
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;

[GenericBreakingChange("Output changed: ClientSecret will not be returned anymore. Additional cmdlet will be added to retrieve ClientSecret.")]
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementAuthorizationServer", DefaultParameterSetName = ContextParameterSet)]
[OutputType(typeof(PsApiManagementOAuth2AuthorizationServer))]
public class GetAzureApiManagementAuthorizationServer : AzureApiManagementCmdletBase
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

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

[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementAuthorizationServerClientSecret", DefaultParameterSetName = ContextParameterSet)]
[OutputType(typeof(PsApiManagementClientSecret))]
public class GetAzureApiManagementAuthorizationServerClientSecret : AzureApiManagementCmdletBase
{
#region ParameterSet
private const string ContextParameterSet = "ContextParameterSet";
private const string ResourceIdParameterSet = "ResourceIdParameterSet";
#endregion

[Parameter(
ParameterSetName = ContextParameterSet,
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
Mandatory = true,
HelpMessage = "Instance of PsApiManagementContext. This parameter is required.")]
[ValidateNotNullOrEmpty]
public PsApiManagementContext Context { get; set; }

[Parameter(
ValueFromPipelineByPropertyName = true,
Mandatory = false,
HelpMessage = "Identifier of the authorization server. If specified will find authorization server by the identifier." +
" This parameter is optional. ")]
public String ServerId { get; set; }

[Parameter(
ParameterSetName = ResourceIdParameterSet,
ValueFromPipelineByPropertyName = true,
Mandatory = true,
HelpMessage = "Arm Resource Identifier of the authorization server." +
" If specified will try to find authorization server by the identifier. This parameter is required.")]
public String ResourceId { get; set; }

public override void ExecuteApiManagementCmdlet()
{
string resourceGroupName;
string serviceName;
string authorizationserverId;

if (ParameterSetName.Equals(ResourceIdParameterSet))
{
var authorizationServer = new PsApiManagementOAuth2AuthorizationServer(ResourceId);
resourceGroupName = authorizationServer.ResourceGroupName;
serviceName = authorizationServer.ServiceName;
authorizationserverId = authorizationServer.ServerId;
}
else
{
resourceGroupName = Context.ResourceGroupName;
serviceName = Context.ServiceName;
authorizationserverId = ServerId;
}

if (string.IsNullOrEmpty(authorizationserverId))
{
throw new InvalidOperationException("Authorization Server identifier not provided.");
}
else
{
var server = Client.AuthorizationServerClientSecretById(resourceGroupName, serviceName, authorizationserverId);
WriteObject(server);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
using System;
using System.Management.Automation;
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;

[GenericBreakingChange("Output changed: ClientSecret will not be returned anymore. Additional cmdlet will be added to retrieve ClientSecret.")]
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementIdentityProvider", DefaultParameterSetName = AllIdentityProviders)]
[OutputType(typeof(PsApiManagementIdentityProvider))]
public class GetAzureApiManagementIdentityProvider : AzureApiManagementCmdletBase
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

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

[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementIdentityProviderClientSecret", DefaultParameterSetName = IdentityProviderByType)]
[OutputType(typeof(PsApiManagementClientSecret))]
public class GetAzureApiManagementIdentityProviderClientSecret : AzureApiManagementCmdletBase
{
private const string IdentityProviderByType = "IdentityProviderByType";

[Parameter(
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
Mandatory = true,
HelpMessage = "Instance of PsApiManagementContext. This parameter is required.")]
[ValidateNotNullOrEmpty]
public PsApiManagementContext Context { get; set; }

[Parameter(
ParameterSetName = IdentityProviderByType,
ValueFromPipelineByPropertyName = true,
Mandatory = true,
HelpMessage = "Identifier of a Identity Provider. This parameter is required.")]
public PsApiManagementIdentityProviderType Type { get; set; }

public override void ExecuteApiManagementCmdlet()
{
if (ParameterSetName.Equals(IdentityProviderByType))
{
var identityProvider = Client.IdentityProviderClientSecretByName(Context.ResourceGroupName, Context.ServiceName, Type.ToString("g"));
WriteObject(identityProvider);
}
else
{
throw new InvalidOperationException(string.Format("Parameter set name '{0}' is not supported.", ParameterSetName));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
{
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using System;
using System.Collections.Generic;
using System.Management.Automation;

[CmdletDeprecation(ReplacementCmdletName = "Get-AzureApiManagementNamedValue")]
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementProperty", DefaultParameterSetName = GetAll)]
[OutputType(typeof(PsApiManagementProperty))]
public class GetAzureApiManagementProperty : AzureApiManagementCmdletBase
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementNamedValue", DefaultParameterSetName = GetAll)]
[OutputType(typeof(PsApiManagementNamedValue))]
public class GetAzureApiManagementNamedValue : AzureApiManagementCmdletBase
{
private const string GetAll = "GetAllProperties";
private const string GetById = "GetByPropertyId";
private const string GetAll = "GetAllNamedValues";
private const string GetById = "GetByNamedValueId";
private const string FindByName = "GetByName";
private const string FindByTag = "GetByTag";

Expand All @@ -42,43 +39,43 @@ public class GetAzureApiManagementProperty : AzureApiManagementCmdletBase
ParameterSetName = GetById,
ValueFromPipelineByPropertyName = true,
Mandatory = false,
HelpMessage = "Identifier of a property. If specified will try to find property by the identifier. This parameter is optional.")]
public String PropertyId { get; set; }
HelpMessage = "Identifier of the named value. If specified will try to find named value by the identifier. This parameter is optional.")]
public String NamedValueId { get; set; }

[Parameter(
ParameterSetName = FindByName,
ValueFromPipelineByPropertyName = true,
Mandatory = false,
HelpMessage = "Finds Properties with names containing the string Name. This parameter is optional.")]
HelpMessage = "Finds named values with names containing the string Name. This parameter is optional.")]
public String Name { get; set; }

[Parameter(
ParameterSetName = FindByTag,
ValueFromPipelineByPropertyName = true,
Mandatory = false,
HelpMessage = "Finds Properties associated with a Tag. If specified will return all properties associated with a tag. This parameter is optional.")]
HelpMessage = "Finds named values associated with a Tag. If specified will return all properties associated with a tag. This parameter is optional.")]
public String Tag { get; set; }

public override void ExecuteApiManagementCmdlet()
{
if (ParameterSetName.Equals(GetAll))
{
var properties = Client.PropertiesList(Context);
var properties = Client.NamedValuesList(Context);
WriteObject(properties, true);
}
else if (ParameterSetName.Equals(GetById))
{
var property = Client.PropertyById(Context, PropertyId);
var property = Client.NamedValueById(Context, NamedValueId);
WriteObject(property);
}
else if (ParameterSetName.Equals(FindByName))
{
var properties = Client.PropertyByName(Context, Name);
var properties = Client.NamedValueByName(Context, Name);
WriteObject(properties, true);
}
else if (ParameterSetName.Equals(FindByTag))
{
var properties = Client.PropertyByTag(Context, Tag);
var properties = Client.NamedValueByTag(Context, Tag);
WriteObject(properties, true);
}
else
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
{
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using System;
using System.Collections.Generic;
using System.Management.Automation;

[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementNamedValueSecretValue", DefaultParameterSetName = Default)]
[OutputType(typeof(PsApiManagementNamedValueSecretValue))]
public class GetAzureApiManagementNamedValueSecretValue : AzureApiManagementCmdletBase
{
private const string Default = "Default";
private const string GetById = "GetByNamedValueId";

[Parameter(
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
Mandatory = true,
HelpMessage = "Instance of PsApiManagementContext. This parameter is required.")]
[ValidateNotNullOrEmpty]
public PsApiManagementContext Context { get; set; }

[Parameter(
ParameterSetName = GetById,
ValueFromPipelineByPropertyName = true,
Mandatory = true,
HelpMessage = "Identifier of a the named value. This parameter is required.")]
public String NamedValueId { get; set; }

public override void ExecuteApiManagementCmdlet()
{
if (!string.IsNullOrEmpty(NamedValueId))
{
var property = Client.NamedValueSecretValueById(Context, NamedValueId);
WriteObject(property);
}
else
{
throw new InvalidOperationException("Named Value Id not provided");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@
namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
{
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using System;
using System.Collections.Generic;
using System.Management.Automation;

[GenericBreakingChange("Output changed: ClientSecret will not be returned anymore. Additional cmdlet will be added to retrieve ClientSecret.")]
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementOpenIdConnectProvider", DefaultParameterSetName = GetAll)]
[OutputType(typeof(PsApiManagementOpenIdConnectProvider))]
public class GetAzureApiManagementOpenIdConnectProvider : AzureApiManagementCmdletBase
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
{
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
using System;
using System.Collections.Generic;
using System.Management.Automation;

[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ApiManagementOpenIdConnectProviderClientSecret", DefaultParameterSetName = GetById)]
[OutputType(typeof(PsApiManagementClientSecret))]
public class GetAzureApiManagementOpenIdConnectProviderClientSecret : AzureApiManagementCmdletBase
{
private const string GetById = "GetByOpenIdConnectProviderId";

[Parameter(
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = true,
Mandatory = true,
HelpMessage = "Instance of PsApiManagementContext. This parameter is required.")]
[ValidateNotNullOrEmpty]
public PsApiManagementContext Context { get; set; }

[Parameter(
ParameterSetName = GetById,
ValueFromPipelineByPropertyName = true,
Mandatory = true,
HelpMessage = "Identifier of a OpenID Connect Provider. " +
"This parameter is required.")]
public String OpenIdConnectProviderId { get; set; }

public override void ExecuteApiManagementCmdlet()
{
if (!string.IsNullOrEmpty(OpenIdConnectProviderId))
{
var openIdConnectProvider = Client.OpenIdConnectProviderClientSecretById(Context, OpenIdConnectProviderId);
WriteObject(openIdConnectProvider);
}
else
{
throw new InvalidOperationException("OpenIdConnectProvider Id not provided");
}
}
}
}
Loading