Skip to content

Commit 8a2cc34

Browse files
committed
Addresing comments. Reving versions.
1 parent 9863004 commit 8a2cc34

18 files changed

+139
-361
lines changed

src/ResourceManager/IotHub/AzureRM.IotHub.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@{
1010

1111
# Version number of this module.
12-
ModuleVersion = '0.0.1'
12+
ModuleVersion = '1.0.0'
1313

1414
# ID used to uniquely identify this module
1515
GUID = '51A3A993-FE39-4F8F-A437-2CB751584AF5'
@@ -45,7 +45,7 @@ CLRVersion='4.0'
4545
ProcessorArchitecture = 'None'
4646

4747
# Modules that must be imported into the global environment prior to importing this module
48-
48+
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '2.3.0'; })
4949

5050
# Assemblies that must be loaded prior to importing this module
5151
RequiredAssemblies = @()
@@ -90,7 +90,7 @@ PrivateData = @{
9090
PSData = @{
9191

9292
# Tags applied to this module. These help with module discovery in online galleries.
93-
# Tags = @()
93+
Tags = 'Azure','ResourceManager','ARM','IoT','IoT Hub'
9494

9595
# A URL to the license for this module.
9696
LicenseUri = 'https://raw.githubusercontent.com/Azure/azure-powershell/dev/LICENSE.txt'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
Please leave this section at the top of the change log.
3+
4+
Changes for the current release should go under the section titled "Current Release", and should adhere to the following format:
5+
6+
## Current Release
7+
* Overview of change #1
8+
- Additional information about change #1
9+
* Overview of change #2
10+
- Additional information about change #2
11+
- Additional information about change #2
12+
* Overview of change #3
13+
* Overview of change #4
14+
- Additional information about change #4
15+
16+
## YYYY.MM.DD - Version X.Y.Z (Previous Release)
17+
* Overview of change #1
18+
- Additional information about change #1
19+
-->
20+
## Current Release
21+
22+
## Version 1.0.0
23+
* Adds commandlets for the Azure IoT Hub

src/ResourceManager/IotHub/Commands.IotHub.Test/Commands.IotHub.Test.csproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<PlatformTarget>AnyCPU</PlatformTarget>
2828
<DebugType>pdbonly</DebugType>
2929
<Optimize>true</Optimize>
30-
<OutputPath>..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.IotHub</OutputPath>
30+
<OutputPath>bin\Release\</OutputPath>
3131
<DefineConstants>TRACE</DefineConstants>
3232
<ErrorReport>prompt</ErrorReport>
3333
<WarningLevel>4</WarningLevel>
@@ -124,12 +124,8 @@
124124
<None Include="packages.config">
125125
<SubType>Designer</SubType>
126126
</None>
127-
<None Include="ScenarioTests\Assert.ps1">
128-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
129-
</None>
130-
<None Include="ScenarioTests\Common.ps1">
131-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
132-
</None>
127+
<None Include="ScenarioTests\Assert.ps1" />
128+
<None Include="ScenarioTests\Common.ps1" />
133129
<None Include="ScenarioTests\IotHubTests.ps1">
134130
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
135131
</None>

src/ResourceManager/IotHub/Commands.IotHub.Test/ScenarioTests/IotHubController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public void RunPsTestWorkflow(
109109
.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries)
110110
.Last();
111111
helper.SetupModules(AzureModule.AzureResourceManager,
112-
"ScenarioTests\\Common.ps1",
112+
"Assert.ps1",
113+
"Common.ps1",
113114
"ScenarioTests\\" + callingClassName + ".ps1",
114115
helper.RMProfileModule,
115116
helper.RMResourceModule,

src/ResourceManager/IotHub/Commands.IotHub/Commands.IotHub.csproj

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
2929
<ErrorReport>prompt</ErrorReport>
3030
<WarningLevel>4</WarningLevel>
3131
</PropertyGroup>
32+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
33+
<OutputPath>..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.IotHub</OutputPath>
34+
<DefineConstants>TRACE;SIGN</DefineConstants>
35+
<Optimize>true</Optimize>
36+
<DebugType>pdbonly</DebugType>
37+
<PlatformTarget>AnyCPU</PlatformTarget>
38+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
39+
<SignAssembly>true</SignAssembly>
40+
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
41+
<DelaySign>true</DelaySign>
42+
<Prefer32Bit>false</Prefer32Bit>
43+
</PropertyGroup>
3244
<ItemGroup>
3345
<Reference Include="Hyak.Common">
3446
<HintPath>..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
@@ -191,12 +203,7 @@
191203
<Link>AzureRM.IotHub.psd1</Link>
192204
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
193205
</None>
194-
<None Include="ResourceManagerStartup.ps1">
195-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
196-
</None>
197-
<None Include="MSSharedLibKey.snk">
198-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
199-
</None>
206+
<None Include="MSSharedLibKey.snk" />
200207
</ItemGroup>
201208
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
202209
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/ResourceManager/IotHub/Commands.IotHub/IotHub/AddAzureRmIotHubEventHubConsumerGroup.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace Microsoft.Azure.Commands.Management.IotHub
1919
using Microsoft.Azure.Management.IotHub;
2020

2121
[Cmdlet(VerbsCommon.Add, "AzureRmIotHubEventHubConsumerGroup", SupportsShouldProcess = true), OutputType(typeof(IEnumerable<string>))]
22+
[Alias("Add-AzureRmIotHubEHCG")]
2223
public class AddAzureRmIotHubEventHubConsumerGroup : IotHubBaseCmdlet
2324
{
2425
[Parameter(

src/ResourceManager/IotHub/Commands.IotHub/IotHub/GetAzureRmEventHubConsumerGroup.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace Microsoft.Azure.Commands.Management.IotHub
2222
using Microsoft.Azure.Management.IotHub.Models;
2323

2424
[Cmdlet(VerbsCommon.Get, "AzureRmIotHubEventHubConsumerGroup"), OutputType(typeof(IEnumerable<string>))]
25+
[Alias("Get-AzureRmIotHubEHCG")]
2526
public class GetAzureRmIotHubEventHubConsumerGroup : IotHubBaseCmdlet
2627
{
2728
[Parameter(

src/ResourceManager/IotHub/Commands.IotHub/IotHub/GetAzureRmIotHub.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ namespace Microsoft.Azure.Commands.Management.IotHub
2323
using Microsoft.Azure.Management.IotHub.Models;
2424
using Microsoft.Rest.Azure;
2525

26-
[Cmdlet(VerbsCommon.Get, "AzureRmIotHub", DefaultParameterSetName = "ListIotHubsBySubscription")]
26+
[Cmdlet(VerbsCommon.Get, "AzureRmIotHub", DefaultParameterSetName = "ListIotHubsByResourceGroup")]
2727
[OutputType(typeof(PSIotHub), typeof(List<PSIotHub>))]
2828
public class GetAzureRmIotHub : IotHubBaseCmdlet
2929
{
3030
const string GetIotHubParameterSet = "GetIotHubByName";
3131
const string ListIotHubsByRGParameterSet = "ListIotHubsByResourceGroup";
32-
const string ListIotHubsBySubscriptionParameterSet = "ListIotHubsBySubscription";
3332

3433
[Parameter(
3534
ParameterSetName = GetIotHubParameterSet,
@@ -40,7 +39,7 @@ public class GetAzureRmIotHub : IotHubBaseCmdlet
4039
[Parameter(
4140
ParameterSetName = ListIotHubsByRGParameterSet,
4241
Position = 0,
43-
Mandatory = true,
42+
Mandatory = false,
4443
ValueFromPipelineByPropertyName = true,
4544
HelpMessage = "Name of the Resource Group")]
4645
[ValidateNotNullOrEmpty]
@@ -64,13 +63,18 @@ public override void ExecuteCmdlet()
6463
this.WriteObject(IotHubUtils.ToPSIotHub(iotHubDescription), false);
6564
break;
6665
case ListIotHubsByRGParameterSet:
67-
IEnumerable<IotHubDescription> iotHubDescriptions = this.IotHubClient.IotHubResource.ListByResourceGroup(this.ResourceGroupName);
68-
this.WriteObject(IotHubUtils.ToPSIotHubs(iotHubDescriptions), true);
69-
break;
70-
case ListIotHubsBySubscriptionParameterSet:
71-
IEnumerable<IotHubDescription> iotHubDescriptionsBySubscription = this.IotHubClient.IotHubResource.ListBySubscription();
72-
this.WriteObject(IotHubUtils.ToPSIotHubs(iotHubDescriptionsBySubscription), true);
73-
break;
66+
if (string.IsNullOrEmpty(this.ResourceGroupName))
67+
{
68+
IEnumerable<IotHubDescription> iotHubDescriptionsBySubscription = this.IotHubClient.IotHubResource.ListBySubscription();
69+
this.WriteObject(IotHubUtils.ToPSIotHubs(iotHubDescriptionsBySubscription), true);
70+
break;
71+
}
72+
else
73+
{
74+
IEnumerable<IotHubDescription> iotHubDescriptions = this.IotHubClient.IotHubResource.ListByResourceGroup(this.ResourceGroupName);
75+
this.WriteObject(IotHubUtils.ToPSIotHubs(iotHubDescriptions), true);
76+
break;
77+
}
7478
default:
7579
throw new ArgumentException("BadParameterSetName");
7680
}

src/ResourceManager/IotHub/Commands.IotHub/IotHub/NewAzureRmIotHubExportDevices.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.Management.IotHub
2222
using ResourceProperties = Microsoft.Azure.Commands.Management.IotHub.Properties;
2323

2424
[Cmdlet(VerbsCommon.New, "AzureRmIotHubExportDevices", SupportsShouldProcess = true)]
25-
[OutputType(typeof(JobResponse))]
25+
[OutputType(typeof(PSIotHubJobResponse))]
2626
public class NewAzureRmIotHubExportDevices : IotHubBaseCmdlet
2727
{
2828
[Parameter(
@@ -48,12 +48,7 @@ public class NewAzureRmIotHubExportDevices : IotHubBaseCmdlet
4848
[ValidateNotNullOrEmpty]
4949
public string ExportBlobContainerUri { get; set; }
5050

51-
[Parameter(
52-
Position = 3,
53-
Mandatory = true,
54-
HelpMessage = "ExcludeKeys")]
55-
[ValidateNotNullOrEmpty]
56-
public bool ExcludeKeys { get; set; }
51+
public SwitchParameter ExcludeKeys { get; set; }
5752

5853
public override void ExecuteCmdlet()
5954
{
@@ -62,7 +57,7 @@ public override void ExecuteCmdlet()
6257
var exportDevicesRequest = new PSExportDevicesRequest()
6358
{
6459
ExportBlobContainerUri = this.ExportBlobContainerUri,
65-
ExcludeKeys = this.ExcludeKeys
60+
ExcludeKeys = this.ExcludeKeys.IsPresent
6661
};
6762

6863
JobResponse jobResponse = this.IotHubClient.IotHubResource.ExportDevices(this.ResourceGroupName, this.Name, IotHubUtils.ToExportDevicesRequest(exportDevicesRequest));

src/ResourceManager/IotHub/Commands.IotHub/IotHub/NewAzureRmIotHubImportDevices.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.Management.IotHub
2222
using ResourceProperties = Microsoft.Azure.Commands.Management.IotHub.Properties;
2323

2424
[Cmdlet(VerbsCommon.New, "AzureRmIotHubImportDevices", SupportsShouldProcess = true)]
25-
[OutputType(typeof(JobResponse))]
25+
[OutputType(typeof(PSIotHubJobResponse))]
2626
public class NewAzureRmIotHubImportDevices : IotHubBaseCmdlet
2727
{
2828
[Parameter(

src/ResourceManager/IotHub/Commands.IotHub/IotHub/RemoveAzureRmIotHub.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ public override void ExecuteCmdlet()
5858
throw e;
5959
}
6060
}
61-
62-
this.WriteObject("Iot Hub Deleted");
6361
}
6462
}
6563
}

src/ResourceManager/IotHub/Commands.IotHub/IotHub/RemoveAzureRmIotHubEventHubConsumerGroup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace Microsoft.Azure.Commands.Management.IotHub
2222
using Microsoft.Azure.Management.IotHub.Models;
2323

2424
[Cmdlet(VerbsCommon.Remove, "AzureRmIotHubEventHubConsumerGroup", SupportsShouldProcess = true), OutputType(typeof(IEnumerable<string>))]
25+
[Alias("Remove-AzureRmIotHubEHCG")]
2526
public class RemoveAzureRmIotHubEventHubConsumerGroup : IotHubBaseCmdlet
2627
{
2728
[Parameter(
@@ -51,6 +52,7 @@ public class RemoveAzureRmIotHubEventHubConsumerGroup : IotHubBaseCmdlet
5152
[Parameter(
5253
Position = 3,
5354
Mandatory = true,
55+
ValueFromPipelineByPropertyName = true,
5456
HelpMessage = "Name of the EventHub ConsumerGroupName")]
5557
[ValidateNotNullOrEmpty]
5658
public string EventHubConsumerGroupName { get; set; }

src/ResourceManager/IotHub/Commands.IotHub/IotHub/RemoveAzureRmIotHubKey.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class RemoveAzureRmIotHubKey : IotHubBaseCmdlet
4949
[Parameter(
5050
Position = 2,
5151
Mandatory = true,
52+
ValueFromPipelineByPropertyName = true,
5253
HelpMessage = "Name of the Key")]
5354
[ValidateNotNullOrEmpty]
5455
public string KeyName { get; set; }

src/ResourceManager/IotHub/Commands.IotHub/IotHub/SetAzureRmIotHub.cs

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@
1515
namespace Microsoft.Azure.Commands.Management.IotHub
1616
{
1717
using System;
18-
using System.Collections.Generic;
1918
using System.Management.Automation;
20-
using System.Linq;
2119
using Microsoft.Azure.Commands.Management.IotHub.Common;
2220
using Microsoft.Azure.Commands.Management.IotHub.Models;
2321
using Microsoft.Azure.Management.IotHub;
2422
using Microsoft.Azure.Management.IotHub.Models;
2523

26-
[Cmdlet(VerbsCommon.Set, "AzureRmIotHub", SupportsShouldProcess = true)]
24+
[Cmdlet(VerbsCommon.Set, "AzureRmIotHub", DefaultParameterSetName = "UpdateSku", SupportsShouldProcess = true)]
2725
[OutputType(typeof(PSIotHub))]
2826
public class SetAzureRmIotHub : IotHubBaseCmdlet
2927
{
@@ -34,55 +32,13 @@ public class SetAzureRmIotHub : IotHubBaseCmdlet
3432
const string UpdateOperationsMonitoringPropertiesParameterSet = "UpdateOperationsMonitoringProperties";
3533

3634
[Parameter(
37-
ParameterSetName = UpdateSkuParameterSet,
38-
Mandatory = true,
39-
ValueFromPipelineByPropertyName = true,
40-
HelpMessage = "Name of the Resource Group")]
41-
[Parameter(
42-
ParameterSetName = UpdateEventHubEndpointPropertiesParameterSet,
43-
Mandatory = true,
44-
ValueFromPipelineByPropertyName = true,
45-
HelpMessage = "Name of the Resource Group")]
46-
[Parameter(
47-
ParameterSetName = UpdateFileUploadPropertiesParameterSet,
48-
Mandatory = true,
49-
ValueFromPipelineByPropertyName = true,
50-
HelpMessage = "Name of the Resource Group")]
51-
[Parameter(
52-
ParameterSetName = UpdateCloudToDevicePropertiesParameterSet,
53-
Mandatory = true,
54-
ValueFromPipelineByPropertyName = true,
55-
HelpMessage = "Name of the Resource Group")]
56-
[Parameter(
57-
ParameterSetName = UpdateOperationsMonitoringPropertiesParameterSet,
5835
Mandatory = true,
5936
ValueFromPipelineByPropertyName = true,
6037
HelpMessage = "Name of the Resource Group")]
6138
[ValidateNotNullOrEmpty]
6239
public string ResourceGroupName { get; set; }
6340

6441
[Parameter(
65-
ParameterSetName = UpdateSkuParameterSet,
66-
Mandatory = true,
67-
ValueFromPipelineByPropertyName = true,
68-
HelpMessage = "Name of the Iot Hub")]
69-
[Parameter(
70-
ParameterSetName = UpdateEventHubEndpointPropertiesParameterSet,
71-
Mandatory = true,
72-
ValueFromPipelineByPropertyName = true,
73-
HelpMessage = "Name of the Iot Hub")]
74-
[Parameter(
75-
ParameterSetName = UpdateFileUploadPropertiesParameterSet,
76-
Mandatory = true,
77-
ValueFromPipelineByPropertyName = true,
78-
HelpMessage = "Name of the Iot Hub")]
79-
[Parameter(
80-
ParameterSetName = UpdateCloudToDevicePropertiesParameterSet,
81-
Mandatory = true,
82-
ValueFromPipelineByPropertyName = true,
83-
HelpMessage = "Name of the Iot Hub")]
84-
[Parameter(
85-
ParameterSetName = UpdateOperationsMonitoringPropertiesParameterSet,
8642
Mandatory = true,
8743
ValueFromPipelineByPropertyName = true,
8844
HelpMessage = "Name of the Iot Hub")]

src/ResourceManager/IotHub/Commands.IotHub/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.0.1")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion("1.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0")]

0 commit comments

Comments
 (0)