Skip to content

Logic App Integration Account Control Numbers cmdlets #3566

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

Merged
merged 10 commits into from
Mar 8, 2017

Conversation

daviburg
Copy link
Member

@daviburg daviburg commented Mar 2, 2017

Description

New cmdlets for Logic App Integration Account Control Numbers:
Get, Set, List generated control numbers, Get, Remove received control numbers.

Building atop Azure/azure-sdk-for-net#2858

Underlying sessions entities are intentionally not exposed to cmdlet user. Cmdlet user will know high level business concept of control numbers. Sessions is Microsoft's B2B connector specific underlying storage mechanism for this and other states.
Full CRUD is intentionally not exposed to cmdlet user. Select commands above are exposed for the specific purpose of a service operator to fix up current state in the event of a disaster recovery to a back-up site.


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.

  • I have read the contribution guidelines.
  • If changes were made to any cmdlet, the XML help was regenerated using the platyPSHelp module.
  • If any large changes are made to a service, they are reflected in the respective change log.
    For the sake of completeness, will add an additional commit with change log update to this PR.

General Guidelines

  • Title of the pull request is clear and informative.
  • 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.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • 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

  • 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.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.
    Remove cmdlet produces no output and a PassThru parameter would not work for it either.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • 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.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

@azuresdkci
Copy link

Can one of the admins verify this patch?

@cormacpayne
Copy link
Member

@azuresdkci add to whitelist

@markcowl
Copy link
Member

markcowl commented Mar 3, 2017

@daviburg this is failing because it can't find your package. Have you published the package yet?

@shahabhijeet
Copy link
Contributor

@azuresdkci test this please

@cormacpayne cormacpayne assigned markcowl and unassigned daviburg Mar 6, 2017
.SYNOPSIS
Returns true if current mode is record
#>
function IsRecordMode()
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 already availble from TestSupport.RunningMocked. Duplicating this is maintenance problem going forward.

Copy link
Member Author

Choose a reason for hiding this comment

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

So if (-not [Microsoft.WindowsAzure.Commands.Utilities.Common.TestMockSupport]::RunningMocked) gives me the wrong result when running in Record mode, i.e. return trues which cause setup code not to run and the test to fail. I will keep the approach I mimicked from existing test code which works reliably.

@@ -21,22 +21,32 @@ namespace Microsoft.Azure.Commands.LogicApp.Cmdlets
/// <summary>
/// Gets the integration account agreement by name
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureRmIntegrationAccountAgreement"), OutputType(typeof (object))]
[Cmdlet(VerbsCommon.Get, "AzureRmIntegrationAccountAgreement")]
[OutputType(typeof(object))]
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 essentially useless, please be more specific about the output type

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing

Copy link
Member Author

Choose a reason for hiding this comment

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

This change resulted in a breaking change build error. I think that as object return type provided no value this breaking change is unlikely to actually break any client. Is there a way to acknowledgement the breaking change as acceptable?

00:48:41 "D:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.LogicApp\Microsoft.Azure.Commands.LogicApp.dll","Microsoft.Azure.Commands.LogicApp.Cmdlets.GetAzureIntegrationAccountAgreementCommand","Get-AzureRmIntegrationAccountAgreement","0","1020","The cmdlet 'Get-AzureRmIntegrationAccountAgreement' no longer has output type 'Object'.","Make cmdlet 'Get-AzureRmIntegrationAccountAgreement' return type 'Object'."

/// Gets the integration account generated interchange control number by agreement name
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureRmIntegrationAccountGeneratedIcn")]
[OutputType(typeof(IntegrationAccountClient.IntegrationAccountControlNumber), typeof(IList<IntegrationAccountClient.QualifiedIntegrationAccountControlNumber>))]
Copy link
Member

Choose a reason for hiding this comment

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

Why areen't these simple public types?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing

/// Gets the integration account received interchange control number by agreement name and control number value.
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureRmIntegrationAccountReceivedIcn")]
[OutputType(typeof(IntegrationAccountClient.IntegrationAccountControlNumber))]
Copy link
Member

Choose a reason for hiding this comment

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

Why is this not a simple, public type?

/// Updates the integration account generated interchange control number.
/// </summary>
[Cmdlet(VerbsCommon.Set, "AzureRmIntegrationAccountGeneratedIcn", SupportsShouldProcess = true)]
[OutputType(typeof(IntegrationAccountClient.IntegrationAccountControlNumber))]
Copy link
Member

Choose a reason for hiding this comment

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

simple type

Copy link
Member

Choose a reason for hiding this comment

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

In other words - you need to provide a simple type definition, not a type defined within another type.

@@ -193,6 +200,10 @@
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
<Name>Commands.ResourceManager.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj">
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 allowed. You cannot have a dependency on another cmdlets project

Copy link
Member Author

Choose a reason for hiding this comment

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

Removing

/// <summary>
/// LogicApp client partial class for integration account control number types.
/// </summary>
public partial class IntegrationAccountClient
Copy link
Member

Choose a reason for hiding this comment

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

These look like generated types, why are these here and not in your SDK?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because the types are client-side only. The swagger and SDK specify what the server is aware of, which here is just an obscure/opaque JToken object. The clients store state specific to themselves within the session. Different client-defined types can and are stored in different sessions.

Copy link
Member

Choose a reason for hiding this comment

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

If these are exchanged with the service, you should consider adding these types to your API definition. This is not a blocker for the PR.

@markcowl markcowl assigned daviburg and unassigned markcowl Mar 6, 2017
* Added Set-AzureRmIntegrationAccountReceivedIcn
* Specified return type(s) of integration account cmdlets
* Fixed return types for control number cmdlets
@markcowl
Copy link
Member

markcowl commented Mar 7, 2017

@daviburg You have two issues causing static analysis failures:

  • Cmdlets with nouns that are plural, please fix this
  • The commands that now have a better return type than object - please add exceptiosn for these, our tool is incorrectly flagging these as breakign changes when they are not. We have an issue to fix the tool, but adding the escepotions for now should fix the issue.

@daviburg
Copy link
Member Author

daviburg commented Mar 7, 2017

I added the exceptions for the return type. I did not find in the Jenkins build artifacts or console output where is the "Cmdlets with nouns that are plural" issue.

@markcowl markcowl changed the base branch from dev to release-3.7.0 March 8, 2017 00:26
@markcowl
Copy link
Member

markcowl commented Mar 8, 2017

on demand run here:http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1432/

LGTM once the on demand run passes

@markcowl markcowl merged commit 1094854 into Azure:release-3.7.0 Mar 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants