-
Notifications
You must be signed in to change notification settings - Fork 4k
Iot Hub Commandlets #3250
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
Iot Hub Commandlets #3250
Conversation
Hi @rkmanda, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!
TTYL, AZPRBOT; |
This is the next iteration after the older PR for the same was closed. Link to PR #3156 |
@rkmanda Please clean up the commits in this PR as described here:https://github.com/Azure/azure-powershell/blob/dev/documentation/cleaning-up-commits.md Please fill out the checklist as required as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("0.0.1")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkmanda this should also be 0.0.1
$op= $iotHubUpdated.Properties.OperationsMonitoringProperties | ||
$op.OperationMonitoringEvents["Connections"] = "Information" | ||
$iotHubUpdated = Set-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IotHubName -OperationsMonitoringProperties $op | ||
Assert-True { $iothubUpdated.Properties.OperationsMonitoringProperties.OperationMonitoringEvents["Connections"] -eq "Information" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkmanda do you plan on adding a test using the parameter set UpdateFileUploadProperties
for Set-AzureRmIotHub
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not as a part of the current PR. The test for this is a little involved as it requires a SAS token to be fetched on the fly. Will add the test later.
|
||
[Cmdlet(VerbsCommon.Get, "AzureRmIotHubJob")] | ||
[OutputType(typeof(PSIotHubJobResponse), typeof(List<PSIotHubJobResponse>))] | ||
public class GetAzureRmIotHubJob : IotHubBaseCmdlet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkmanda I don't see any tests for this cmdlet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prereq for testing this is to have a test for NewAzureRmIotHubExportDevices which also relies on a valid SAS token to be generated on the fly. Will target this later.
|
||
[Cmdlet(VerbsCommon.New, "AzureRmIotHubExportDevices", SupportsShouldProcess = true)] | ||
[OutputType(typeof(JobResponse))] | ||
public class NewAzureRmIotHubExportDevices : IotHubBaseCmdlet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkmanda I don't see any tests for this cmdlet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relies on a valid SAS token to be generated on the fly. Will target this later.
|
||
[Cmdlet(VerbsCommon.New, "AzureRmIotHubImportDevices", SupportsShouldProcess = true)] | ||
[OutputType(typeof(JobResponse))] | ||
public class NewAzureRmIotHubImportDevices : IotHubBaseCmdlet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkmanda I don't see any tests for this cmdlet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relies on a valid SAS token to be generated on the fly. Will target this later.
|
||
|
||
# Assemblies that must be loaded prior to importing this module | ||
RequiredAssemblies = @() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to have The correct version of AzureRM.Profile as a dependency, see: https://github.com/Azure/azure-powershell/blob/dev/src/ResourceManager/Cdn/AzureRM.Cdn.psd1#L54
PSData = @{ | ||
|
||
# Tags applied to this module. These help with module discovery in online galleries. | ||
# Tags = @() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please uncomment tags property and put in appropriate tags
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.IotHub</OutputPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't want this path for tests
public void TestAzureIotHubLifeCycle() | ||
{ | ||
IotHubController.NewInstance.RunPsTestWorkflow( | ||
() => { return new[] { string.Format("{0} {1} {2} {3} {4}", "Test-AzureRmIotHubLifecycle", "northeurope", "powershelliothub", "powershellrg", "S1") }; }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not hard code regions. Instead, your test should detect an appropriate available region as part of test setup. Hard coded regions are a maintenance headache, because the test cannot be re-recorded against the test cluster in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found other resources hardcoding location directly in the script. What I have done is to ensure that the script itself does not have the hardcoding so it can be run in any location. Let me know if this works for the current PR. I will raise an issue to fix this in a subsequent PR.
<OutputPath>..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.IotHub</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need the properties that support delay siging in this target. See: https://github.com/Azure/azure-powershell/blob/dev/src/ResourceManager/Cdn/Commands.Cdn/Commands.Cdn.csproj#L43 for an example. You will also need to include the delay sign key, as that assembly does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doi you have two property groups for the release configuration? Please clean up.
Position = 2, | ||
Mandatory = true, | ||
HelpMessage = "Name of the Key")] | ||
[ValidateNotNullOrEmpty] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance this will come from the pipeline (A Get call, perhaps?)
using Microsoft.Azure.Management.IotHub; | ||
using Microsoft.Azure.Management.IotHub.Models; | ||
|
||
[Cmdlet(VerbsCommon.Set, "AzureRmIotHub", SupportsShouldProcess = true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a default parameter set setting
@@ -0,0 +1,276 @@ | |||
# ---------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this file intended for? Remove
## PARAMETERS | ||
|
||
### -EventHubConsumerGroupName | ||
EventHubConsumerGroupName. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Informative description, please
|
||
### -CloudToDevice | ||
CloudToDevice | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need an informative description for each parameter. This applies to all help files
@markcowl please review. Addressed most comments. Some tests are to be added and I will raise an issue for this. The region hardcoding will also be removed as a part of the test issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to file test issues for:
- missing coverage
- hard-coded locations
- cleanup of duplicated scripts
Send us the link for these issues and we will be able to merge the PR once it passes test and signing builds
## Current Release | ||
|
||
## Version 1.0.0 | ||
* Adds commandlets for the Azure IoT Hub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please listy the capabilities of these cmdlets, and the resources they allow you to manage.
<OutputPath>..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.IotHub</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doi you have two property groups for the release configuration? Please clean up.
Sign job was successful: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-sign/755/ |
On demand: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1346/ Sign job: http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-sign/760/ LGTM once both pass |
Can this be merged now? |
Description
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThrough
parameter.Cmdlet Parameter Guidelines