Skip to content

Routing support for IotHub #3998

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

Closed
wants to merge 23 commits into from
Closed

Conversation

ssankar1984
Copy link

@ssankar1984 ssankar1984 commented May 18, 2017

Description

Routing support for IotHub

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

  • [ Y] Title of the pull request is clear and informative.
  • [ Y] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • [ Y] The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • [ Y] Pull request includes test coverage for the included changes.
  • [ Y] PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • [ Y] New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • [ Y] Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • [ Y] Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • [Y ] Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • [ Y] Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

@msftclas
Copy link

@ssankar1984,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@azuresdkci
Copy link

Can one of the admins verify this patch?

@cormacpayne
Copy link
Member

@azuresdkci add to whitelist

@ssankar1984
Copy link
Author

resolved conflict

Copy link
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this involves changes to your cmdlet surface, you must send us the changes to the public interface for review before this cna be accepted (md file changes suffice).

I don't understand the various routing properties and why there are so many of them, please send an explanation, come to an office hours, or set up a review time.

Please include a description of changes in your changelog.

<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@@ -156,6 +153,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
</packages>
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.3.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@@ -85,6 +85,7 @@
<Compile Include="Serialization\ModelConversionExtensions.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Mandatory = false,
HelpMessage = "Routes")]
[ValidateNotNullOrEmpty]
public List<PSRouteProperties> Routes { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between RouteProperties and routing properties? You shoiuld just take an array of the type rather than a list. Also, parameter name should be singular (Route)

Mandatory = false,
HelpMessage = "Fallback Routes")]
[ValidateNotNullOrEmpty]
public PSFallbackRouteProperties FallbackRoute { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really necessary to have 3 different types for these 3 kinds of route properties?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should rename the rout property types to make the distinction clear, the List<> type should be an array, and parameter names should be singular.

/// <summary>
/// The properties related to service bus queue endpoint types.
/// </summary>
public partial class PSRoutingServiceBusQueueEndpointProperties
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the rationale for having a separate class for this? Isn't there a more generic Routing Proeprties that will do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need separate classes , discussed offline

@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyVersion("2.0.1")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change

@@ -39,7 +38,7 @@ Adds a new consumergroup named "myconsumergroup" to the eventhub for operations
## PARAMETERS

### -EventHubConsumerGroupName
Name of the EventHub ConsumerGroup that you want to add.
EventHubConsumerGroupName.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use complete sentences in the help descriptions. This applies acrosss the board to all help files

Sankar Sundaram added 4 commits May 23, 2017 17:55
@@ -146,6 +132,10 @@
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
<Name>Commands.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\Common\Commands.Common.Authentication.ResourceManager\Commands.Common.Authentication.ResourceManager.csproj">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You really should not need this reference

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssankar1984 Not removed. Please push the changes to your branch.

@@ -37,8 +37,50 @@ function Test-AzureRmIotHubLifecycle
# Create or Update Resource Group
$resourceGroup = New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Location

Write-Debug " Create new eventHub "
$namespaceName = "IotHubPSEHNamespaceTest"
Copy link
Member

@markcowl markcowl May 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not hard code names in the tests, you should generate names using test common code. This allows tests to be used against any subscription

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should run against all subs , I see this pattern followed all over the test , this helps us to delete resources if it was there before while running a new test and therefore not leave undeleted resources without usage in the subscription. For test common code , are you suggesting passing this param ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am suggesting generating the parameter based on a prefix, there are lots of examples of using the test library to do this.

@@ -37,30 +37,24 @@
<Reference Include="Hyak.Common">
<HintPath>..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.EventHub, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you add this depednency on EventHub? This creates a cross-depednency on EventHub managemrnt client between this module and the Evnethub module. Please remove this, or consider moving any necessary methods into common code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch ! , removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssankar1984 Not removed.

</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this reference

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not removed.

@@ -178,6 +179,10 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Microsoft.Azure.Commands.IotHub.dll-Help.xml">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove. Follow the directions here for creating help markdowns: https://github.com/Azure/azure-powershell/blob/preview/documentation/help-generation.md

@@ -97,7 +101,7 @@ public class SetAzureRmIotHub : IotHubBaseCmdlet
[Parameter(
ParameterSetName = UpdateFileUploadPropertiesParameterSet,
Mandatory = false,
HelpMessage = "fileUploadNotificationMaxDeliveryCount")]
HelpMessage = "FileUploadNotificationMaxDeliveryCount")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a help message, you are merely copying the name of the parameter

Mandatory = false,
HelpMessage = "RoutingProperties")]
[ValidateNotNullOrEmpty]
public PSRoutingProperties RoutingProperties { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this. These type names need to be disambiguated

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the type name for RouteProperties , are you suggesting changing this too ? So we have the following now ...
PSRoutingProperties
PSRouteMetadata
PSFallbackRouteMetadata
PSEndpoints
Please suggest if you want these to be changed...

@@ -0,0 +1,2634 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file

@@ -8,7 +8,7 @@ Locale: en-US

# AzureRM.IotHub Module
## Description
Commands for Managing Azure IotHubs
{{Manually Enter Description Here}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a description

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to fix all the help descriptions to be meaningful

@@ -73,7 +73,7 @@
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
<Private>True</Private>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove any changes to this file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The true is removed and added and therefore it shows as a diff

@@ -24,4 +24,4 @@
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
</packages>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove any changes to this file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@@ -146,6 +132,10 @@
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
<Name>Commands.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\Common\Commands.Common.Authentication.ResourceManager\Commands.Common.Authentication.ResourceManager.csproj">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssankar1984 Not removed. Please push the changes to your branch.

@@ -37,30 +37,24 @@
<Reference Include="Hyak.Common">
<HintPath>..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.EventHub, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssankar1984 Not removed.

</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not removed.

@@ -8,7 +8,7 @@ Locale: en-US

# AzureRM.IotHub Module
## Description
Commands for Managing Azure IotHubs
{{Manually Enter Description Here}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to fix all the help descriptions to be meaningful

@@ -37,8 +37,50 @@ function Test-AzureRmIotHubLifecycle
# Create or Update Resource Group
$resourceGroup = New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Location

Write-Debug " Create new eventHub "
$namespaceName = "IotHubPSEHNamespaceTest"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am suggesting generating the parameter based on a prefix, there are lots of examples of using the test library to do this.

<package id="Microsoft.Rest.ClientRuntime" version="2.3.5" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.5" targetFramework="net452" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net452" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.7" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@@ -9,9 +9,9 @@
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.5" targetFramework="net45" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change this file

@@ -61,22 +63,22 @@ Accept wildcard characters: False
```

### -PrimaryKey
The Primary Key.
PrimaryKey
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Primary Key

@@ -156,7 +156,9 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="packages.config">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to revert this change

@markcowl
Copy link
Member

markcowl commented Jun 4, 2017

@markcowl markcowl changed the base branch from preview to release-4.1.0 June 4, 2017 23:41
@markcowl
Copy link
Member

markcowl commented Jun 5, 2017

will close in favor of #4075

@markcowl markcowl closed this Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants