Skip to content

Commit 2b49aed

Browse files
matthew-rollittmatthchr
authored andcommitted
Added ApplicationLicenses to NewBatchPoolCommand with added in memory test and docs
1 parent 0bebb1f commit 2b49aed

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

src/ResourceManager/AzureBatch/Commands.Batch.Test/Pools/NewBatchPoolCommandTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
7878
cmdlet.BatchContext = context;
7979

8080
cmdlet.Id = "testPool";
81+
cmdlet.ApplicationLicenses = new List<string>() { "foo", "bar"};
8182
cmdlet.CertificateReferences = new PSCertificateReference[]
8283
{
8384
new PSCertificateReference()
@@ -118,6 +119,8 @@ public void NewBatchPoolParametersGetPassedToRequestTest()
118119
cmdlet.ExecuteCmdlet();
119120

120121
// Verify the request parameters match the cmdlet parameters
122+
Assert.Equal(cmdlet.ApplicationLicenses[0], requestParameters.ApplicationLicenses[0]);
123+
Assert.Equal(cmdlet.ApplicationLicenses[1], requestParameters.ApplicationLicenses[1]);
121124
Assert.Equal(cmdlet.CertificateReferences.Length, requestParameters.CertificateReferences.Count);
122125
Assert.Equal(cmdlet.CertificateReferences[0].StoreName, requestParameters.CertificateReferences[0].StoreName);
123126
Assert.Equal(cmdlet.CertificateReferences[0].Thumbprint, requestParameters.CertificateReferences[0].Thumbprint);

src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchClient.Pools.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ public void CreatePool(NewPoolParameters parameters)
172172
pool.UserAccounts = parameters.UserAccounts.ToList().ConvertAll(user => user.omObject);
173173
}
174174

175+
if (parameters.ApplicationLicenses != null)
176+
{
177+
pool.ApplicationLicenses = parameters.ApplicationLicenses;
178+
}
179+
175180
WriteVerbose(string.Format(Resources.CreatingPool, parameters.PoolId));
176181
pool.Commit(parameters.AdditionalBehaviors);
177182
}

src/ResourceManager/AzureBatch/Commands.Batch/Models/NewPoolParameters.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,10 @@ public NewPoolParameters(BatchAccountContext context, string poolId, IEnumerable
126126
/// The user accounts to be created on each node in the pool.
127127
/// </summary>
128128
public PSUserAccount[] UserAccounts { get; set; }
129+
130+
/// <summary>
131+
/// The list of application licenses the Batch service will make available on each compute node in the pool.
132+
/// </summary>
133+
public List<string> ApplicationLicenses { get; set; }
129134
}
130135
}

src/ResourceManager/AzureBatch/Commands.Batch/Pools/NewBatchPoolCommand.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Microsoft.Azure.Commands.Batch.Models;
1717
using System;
1818
using System.Collections;
19+
using System.Collections.Generic;
1920
using System.Management.Automation;
2021
using Constants = Microsoft.Azure.Commands.Batch.Utils.Constants;
2122

@@ -94,6 +95,10 @@ public class NewBatchPoolCommand : BatchObjectModelCmdletBase
9495
[ValidateNotNullOrEmpty]
9596
public PSApplicationPackageReference[] ApplicationPackageReferences { get; set; }
9697

98+
[Parameter]
99+
[ValidateNotNullOrEmpty]
100+
public List<string> ApplicationLicenses { get; set; }
101+
97102
[Parameter(ParameterSetName = VirtualMachineAutoScaleParameterSet)]
98103
[Parameter(ParameterSetName = VirtualMachineTargetDedicatedParameterSet)]
99104
[ValidateNotNullOrEmpty]
@@ -133,7 +138,8 @@ public override void ExecuteCmdlet()
133138
VirtualMachineConfiguration = this.VirtualMachineConfiguration,
134139
CloudServiceConfiguration = this.CloudServiceConfiguration,
135140
NetworkConfiguration = this.NetworkConfiguration,
136-
UserAccounts = this.UserAccounts
141+
UserAccounts = this.UserAccounts,
142+
ApplicationLicenses = this.ApplicationLicenses
137143
};
138144

139145
if (ShouldProcess("AzureBatchPool"))

src/ResourceManager/AzureBatch/Commands.Batch/help/New-AzureBatchPool.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ New-AzureBatchPool [-Id] <String> -VirtualMachineSize <String> [-DisplayName <St
2020
[-InterComputeNodeCommunicationEnabled] [-StartTask <PSStartTask>]
2121
[-CertificateReferences <PSCertificateReference[]>]
2222
[-ApplicationPackageReferences <PSApplicationPackageReference[]>]
23+
[-ApplicationLicenses <System.Collections.Generic.List`1[System.String]>]
2324
[-CloudServiceConfiguration <PSCloudServiceConfiguration>] [-NetworkConfiguration <PSNetworkConfiguration>]
2425
[-UserAccounts <PSUserAccount[]>] -BatchContext <BatchAccountContext>
2526
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
@@ -33,6 +34,7 @@ New-AzureBatchPool [-Id] <String> -VirtualMachineSize <String> [-DisplayName <St
3334
[-InterComputeNodeCommunicationEnabled] [-StartTask <PSStartTask>]
3435
[-CertificateReferences <PSCertificateReference[]>]
3536
[-ApplicationPackageReferences <PSApplicationPackageReference[]>]
37+
[-ApplicationLicenses <System.Collections.Generic.List`1[System.String]>]
3638
[-VirtualMachineConfiguration <PSVirtualMachineConfiguration>]
3739
[-NetworkConfiguration <PSNetworkConfiguration>] [-UserAccounts <PSUserAccount[]>]
3840
-BatchContext <BatchAccountContext> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
@@ -47,6 +49,7 @@ New-AzureBatchPool [-Id] <String> -VirtualMachineSize <String> [-DisplayName <St
4749
[-InterComputeNodeCommunicationEnabled] [-StartTask <PSStartTask>]
4850
[-CertificateReferences <PSCertificateReference[]>]
4951
[-ApplicationPackageReferences <PSApplicationPackageReference[]>]
52+
[-ApplicationLicenses <System.Collections.Generic.List`1[System.String]>]
5053
[-CloudServiceConfiguration <PSCloudServiceConfiguration>] [-NetworkConfiguration <PSNetworkConfiguration>]
5154
[-UserAccounts <PSUserAccount[]>] -BatchContext <BatchAccountContext>
5255
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
@@ -60,6 +63,7 @@ New-AzureBatchPool [-Id] <String> -VirtualMachineSize <String> [-DisplayName <St
6063
[-InterComputeNodeCommunicationEnabled] [-StartTask <PSStartTask>]
6164
[-CertificateReferences <PSCertificateReference[]>]
6265
[-ApplicationPackageReferences <PSApplicationPackageReference[]>]
66+
[-ApplicationLicenses <System.Collections.Generic.List`1[System.String]>]
6367
[-VirtualMachineConfiguration <PSVirtualMachineConfiguration>]
6468
[-NetworkConfiguration <PSNetworkConfiguration>] [-UserAccounts <PSUserAccount[]>]
6569
-BatchContext <BatchAccountContext> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
@@ -90,6 +94,21 @@ The pool is configured to use small virtual machines imaged with the latest oper
9094

9195
## PARAMETERS
9296

97+
### -ApplicationLicenses
98+
The list of application licenses the Batch service will make available on each compute node in the pool.
99+
100+
```yaml
101+
Type: System.Collections.Generic.List`1[System.String]
102+
Parameter Sets: (All)
103+
Aliases:
104+
105+
Required: False
106+
Position: Named
107+
Default value: None
108+
Accept pipeline input: False
109+
Accept wildcard characters: False
110+
```
111+
93112
### -ApplicationPackageReferences
94113
```yaml
95114
Type: PSApplicationPackageReference[]

0 commit comments

Comments
 (0)