Skip to content

Commit a44b3aa

Browse files
committed
Merge branch 'release-1.0.0' of https://github.com/Azure/azure-powershell into release-1.0.0
2 parents 6527d55 + 41e91d9 commit a44b3aa

File tree

44 files changed

+4306
-2596
lines changed

Some content is hidden

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

44 files changed

+4306
-2596
lines changed

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

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ private static void ConfigureSmapiToPowershellMappings()
106106
.CreateMap<ProductContract, PsApiManagementProduct>()
107107
.ForMember(dest => dest.ProductId, opt => opt.MapFrom(src => src.Id))
108108
.ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.Name))
109-
.ForMember(dest => dest.LegalTerms, opt => opt.MapFrom(src => src.Terms))
110-
.ForMember(dest => dest.NotificationPeriod, opt => opt.MapFrom(src => FormatPeriod(src.NotificationPeriod)))
111-
.ForMember(dest => dest.SubscriptionPeriod, opt => opt.MapFrom(src => FormatPeriod(src.SubscriptionPeriod)));
109+
.ForMember(dest => dest.LegalTerms, opt => opt.MapFrom(src => src.Terms));
112110

113111
Mapper
114112
.CreateMap<SubscriptionContract, PsApiManagementSubscription>()
@@ -143,18 +141,6 @@ private static void ConfigureSmapiToPowershellMappings()
143141
: new Hashtable(src.TokenBodyParameters.ToDictionary(key => key.Name, value => value.Value)));
144142
}
145143

146-
private static string FormatPeriod(PeriodContract notificationPeriod)
147-
{
148-
if (notificationPeriod == null)
149-
{
150-
return null;
151-
}
152-
153-
const string format = "{0}{1}";
154-
155-
return string.Format(format, notificationPeriod.Interval.ToString()[0], notificationPeriod.Value);
156-
}
157-
158144
public ApiManagementClient(AzureContext context)
159145
{
160146
if (context == null)
@@ -594,8 +580,6 @@ public PsApiManagementProduct ProductCreate(
594580
bool? subscriptionRequired,
595581
bool? approvalRequired,
596582
int? subscriptionsLimit,
597-
string subscriptionPeriod,
598-
string notificationPeriod,
599583
PsApiManagementProductState? state)
600584
{
601585
var productContract = new ProductContract(title)
@@ -622,16 +606,6 @@ public PsApiManagementProduct ProductCreate(
622606
}
623607
}
624608

625-
if (!string.IsNullOrWhiteSpace(subscriptionPeriod))
626-
{
627-
productContract.SubscriptionPeriod = ParsePeriod(subscriptionPeriod);
628-
}
629-
630-
if (!string.IsNullOrWhiteSpace(notificationPeriod))
631-
{
632-
productContract.NotificationPeriod = ParsePeriod(notificationPeriod);
633-
}
634-
635609
Client.Products.Create(context.ResourceGroupName, context.ServiceName, productId, new ProductCreateParameters(productContract));
636610
var response = Client.Products.Get(context.ResourceGroupName, context.ServiceName, productId);
637611

@@ -647,8 +621,6 @@ public void ProductSet(
647621
bool? subscriptionRequired,
648622
bool? approvalRequired,
649623
int? subscriptionsLimit,
650-
string subscriptionPeriod,
651-
string notificationPeriod,
652624
PsApiManagementProductState? state)
653625
{
654626
var productUpdateParameters = new ProductUpdateParameters
@@ -676,43 +648,9 @@ public void ProductSet(
676648
}
677649
}
678650

679-
if (!string.IsNullOrWhiteSpace(subscriptionPeriod))
680-
{
681-
productUpdateParameters.SubscriptionPeriod = ParsePeriod(subscriptionPeriod);
682-
}
683-
684-
if (!string.IsNullOrWhiteSpace(notificationPeriod))
685-
{
686-
productUpdateParameters.NotificationPeriod = ParsePeriod(notificationPeriod);
687-
}
688-
689651
Client.Products.Update(context.ResourceGroupName, context.ServiceName, productId, productUpdateParameters, "*");
690652
}
691653

692-
private static PeriodContract ParsePeriod(string period)
693-
{
694-
var match = PeriodRegex.Match(period);
695-
if (!match.Success)
696-
{
697-
throw new ArgumentException(string.Format("Invalid period format: {0}", period), "period");
698-
}
699-
700-
var periodStr = match.Groups[PeriodGroupName].Value;
701-
var valueStr = match.Groups[ValueGroupName].Value;
702-
703-
var contract = new PeriodContract
704-
{
705-
Value = Int32.Parse(valueStr),
706-
Interval = "d".Equals(periodStr, StringComparison.OrdinalIgnoreCase)
707-
? PeriodIntervalContract.Day
708-
: "m".Equals(periodStr, StringComparison.OrdinalIgnoreCase)
709-
? PeriodIntervalContract.Month
710-
: PeriodIntervalContract.Year
711-
};
712-
713-
return contract;
714-
}
715-
716654
public void ProductAddToGroup(PsApiManagementContext context, string groupId, string productId)
717655
{
718656
Client.ProductGroups.Add(context.ResourceGroupName, context.ServiceName, productId, groupId);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@
7070
<HintPath>..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
7171
<Private>True</Private>
7272
</Reference>
73-
<Reference Include="Microsoft.Azure.Management.ApiManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
73+
<Reference Include="Microsoft.Azure.Management.ApiManagement, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7474
<SpecificVersion>False</SpecificVersion>
75-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.1.0.2-preview\lib\net40\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
75+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ApiManagement.2.0.0-preview\lib\net40\Microsoft.Azure.Management.ApiManagement.dll</HintPath>
76+
<Private>True</Private>
7677
</Reference>
7778
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7879
<SpecificVersion>False</SpecificVersion>

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Commands
1616
{
1717
using System;
1818
using System.Management.Automation;
19-
using System.Text.RegularExpressions;
2019
using Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models;
2120

2221
[Cmdlet(VerbsCommon.New, "AzureRmApiManagementProduct")]
@@ -73,20 +72,6 @@ public class NewAzureApiManagementProduct : AzureApiManagementCmdletBase
7372
HelpMessage = "Maximum number of simultaneous subscriptions. This parameter is optional. Default value is 1.")]
7473
public Int32? SubscriptionsLimit { get; set; }
7574

76-
[Parameter(
77-
ValueFromPipelineByPropertyName = false,
78-
Mandatory = false,
79-
HelpMessage = "The period user subscriptions stays active once approved. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).")]
80-
[ValidatePattern(ApiManagementClient.PeriodPattern, Options = RegexOptions.Compiled)]
81-
public String SubscriptionPeriod { get; set; }
82-
83-
[Parameter(
84-
ValueFromPipelineByPropertyName = false,
85-
Mandatory = false,
86-
HelpMessage = "Specifies upcoming subscription expiration notification period. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).")]
87-
[ValidatePattern(ApiManagementClient.PeriodPattern, Options = RegexOptions.Compiled)]
88-
public String NotificationPeriod { get; set; }
89-
9075
[Parameter(
9176
ValueFromPipelineByPropertyName = true,
9277
Mandatory = false,
@@ -106,8 +91,6 @@ public override void ExecuteApiManagementCmdlet()
10691
SubscriptionRequired ?? true,
10792
ApprovalRequired ?? false,
10893
SubscriptionsLimit,
109-
SubscriptionPeriod,
110-
NotificationPeriod,
11194
State);
11295

11396
WriteObject(product);

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,6 @@ public class SetAzureApiManagementProduct : AzureApiManagementCmdletBase
7272
HelpMessage = "Maximum number of simultaneous subscriptions. This parameter is optional. Default value is 1.")]
7373
public Int32? SubscriptionsLimit { get; set; }
7474

75-
[Parameter(
76-
ValueFromPipelineByPropertyName = true,
77-
Mandatory = false,
78-
HelpMessage = "The period user subscriptions stays active once approved. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).")]
79-
public String SubscriptionPeriod { get; set; }
80-
81-
[Parameter(
82-
ValueFromPipelineByPropertyName = true,
83-
Mandatory = false,
84-
HelpMessage = "Specifies upcoming subscription expiration notification period. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).")]
85-
public String NotificationPeriod { get; set; }
86-
8775
[Parameter(
8876
ValueFromPipelineByPropertyName = true,
8977
Mandatory = false,
@@ -107,8 +95,6 @@ public override void ExecuteApiManagementCmdlet()
10795
SubscriptionRequired,
10896
ApprovalRequired,
10997
SubscriptionsLimit,
110-
SubscriptionPeriod,
111-
NotificationPeriod,
11298
State);
11399

114100
if (PassThru)

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Microsoft.Azure.Commands.ApiManagement.ServiceManagement.dll-help.xml

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -5772,20 +5772,6 @@ New-AzureRmApiManagementOperation –Context $apimContext –ApiId $apiId –Ope
57725772
</maml:description>
57735773
<command:parameterValue required="true" variableLength="true">Nullable`1[Int32]</command:parameterValue>
57745774
</command:parameter>
5775-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
5776-
<maml:name>SubscriptionPeriod</maml:name>
5777-
<maml:description>
5778-
<maml:para>The period user subscriptions stays active once approved. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).</maml:para>
5779-
</maml:description>
5780-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
5781-
</command:parameter>
5782-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
5783-
<maml:name>NotificationPeriod</maml:name>
5784-
<maml:description>
5785-
<maml:para>Specifies upcoming subscription expiration notification period. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).</maml:para>
5786-
</maml:description>
5787-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
5788-
</command:parameter>
57895775
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
57905776
<maml:name>State</maml:name>
57915777
<maml:description>
@@ -5907,32 +5893,6 @@ New-AzureRmApiManagementOperation –Context $apimContext –ApiId $apiId –Ope
59075893
<dev:defaultValue>
59085894
</dev:defaultValue>
59095895
</command:parameter>
5910-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
5911-
<maml:name>SubscriptionPeriod</maml:name>
5912-
<maml:description>
5913-
<maml:para>The period user subscriptions stays active once approved. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).</maml:para>
5914-
</maml:description>
5915-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
5916-
<dev:type>
5917-
<maml:name>String</maml:name>
5918-
<maml:uri />
5919-
</dev:type>
5920-
<dev:defaultValue>
5921-
</dev:defaultValue>
5922-
</command:parameter>
5923-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
5924-
<maml:name>NotificationPeriod</maml:name>
5925-
<maml:description>
5926-
<maml:para>Specifies upcoming subscription expiration notification period. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).</maml:para>
5927-
</maml:description>
5928-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
5929-
<dev:type>
5930-
<maml:name>String</maml:name>
5931-
<maml:uri />
5932-
</dev:type>
5933-
<dev:defaultValue>
5934-
</dev:defaultValue>
5935-
</command:parameter>
59365896
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
59375897
<maml:name>State</maml:name>
59385898
<maml:description>
@@ -6028,9 +5988,9 @@ New-AzureRmApiManagementOperation –Context $apimContext –ApiId $apiId –Ope
60285988
<maml:introduction>
60295989
<maml:paragraph>PS C:\&gt;</maml:paragraph>
60305990
</maml:introduction>
6031-
<dev:code>New-AzureRmApiManagementProduct –Context $apimContext –ProductId 9876543210 –Title Unlimited –Description 'Subscribers have completely unlimited access to the API. Administrator approval is required.' –LegalTerms 'Free for all' –ApprovalRequired $true –State Published –NotificationPeriod 'D10' –SubscriptionPeriod 'Y1'</dev:code>
5991+
<dev:code>New-AzureRmApiManagementProduct –Context $apimContext –ProductId 9876543210 –Title Unlimited –Description 'Subscribers have completely unlimited access to the API. Administrator approval is required.' –LegalTerms 'Free for all' –ApprovalRequired $true –State Published</dev:code>
60325992
<dev:remarks>
6033-
<maml:para>Crete new product. Subscription and approval required. Notification period – 10 days. Subscription period – 1 year.</maml:para>
5993+
<maml:para>Crete new product. Subscription and approval required.</maml:para>
60345994
<maml:para />
60355995
<maml:para />
60365996
<maml:para>
@@ -11353,20 +11313,6 @@ New-AzureRmApiManagementOperation –Context $apimContext –ApiId $apiId –Ope
1135311313
</maml:description>
1135411314
<command:parameterValue required="true" variableLength="true">Nullable`1[Int32]</command:parameterValue>
1135511315
</command:parameter>
11356-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
11357-
<maml:name>SubscriptionPeriod</maml:name>
11358-
<maml:description>
11359-
<maml:para>The period user subscriptions stays active once approved. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).</maml:para>
11360-
</maml:description>
11361-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
11362-
</command:parameter>
11363-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
11364-
<maml:name>NotificationPeriod</maml:name>
11365-
<maml:description>
11366-
<maml:para>Specifies upcoming subscription expiration notification period. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).</maml:para>
11367-
</maml:description>
11368-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
11369-
</command:parameter>
1137011316
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
1137111317
<maml:name>State</maml:name>
1137211318
<maml:description>
@@ -11495,32 +11441,6 @@ New-AzureRmApiManagementOperation –Context $apimContext –ApiId $apiId –Ope
1149511441
<dev:defaultValue>
1149611442
</dev:defaultValue>
1149711443
</command:parameter>
11498-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
11499-
<maml:name>SubscriptionPeriod</maml:name>
11500-
<maml:description>
11501-
<maml:para>The period user subscriptions stays active once approved. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).</maml:para>
11502-
</maml:description>
11503-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
11504-
<dev:type>
11505-
<maml:name>String</maml:name>
11506-
<maml:uri />
11507-
</dev:type>
11508-
<dev:defaultValue>
11509-
</dev:defaultValue>
11510-
</command:parameter>
11511-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
11512-
<maml:name>NotificationPeriod</maml:name>
11513-
<maml:description>
11514-
<maml:para>Specifies upcoming subscription expiration notification period. This parameter is optional. Default value is $null. The format is: {period}{value}. Examples: D2 (two days), M6 (six months), Y1(one year).</maml:para>
11515-
</maml:description>
11516-
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
11517-
<dev:type>
11518-
<maml:name>String</maml:name>
11519-
<maml:uri />
11520-
</dev:type>
11521-
<dev:defaultValue>
11522-
</dev:defaultValue>
11523-
</command:parameter>
1152411444
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="named">
1152511445
<maml:name>State</maml:name>
1152611446
<maml:description>

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// limitations under the License.
1414
namespace Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models
1515
{
16-
using System;
17-
1816
public class PsApiManagementProduct
1917
{
2018
public string ProductId { get; set; }
@@ -33,12 +31,6 @@ public class PsApiManagementProduct
3331

3432
public int? SubscriptionsLimit { get; set; }
3533

36-
// maps from period contract
37-
public string SubscriptionPeriod { get; set; }
38-
39-
// maps from period contract
40-
public string NotificationPeriod { get; set; }
41-
4234
public PsApiManagementProductState State { get; set; }
4335
}
4436
}

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Common.Authentication" version="1.4.0-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.ApiManagement" version="1.0.2-preview" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Management.ApiManagement" version="2.0.0-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
1111
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
1212
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />

0 commit comments

Comments
 (0)