Skip to content

Add new management cmdlets for Azure Location Based Services #5284

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 7 commits into from
Jan 29, 2018
Merged

Add new management cmdlets for Azure Location Based Services #5284

merged 7 commits into from
Jan 29, 2018

Conversation

JCookit
Copy link
Contributor

@JCookit JCookit commented Jan 16, 2018

Description

New component: management plane cmdlets for Azure Location Based Services (a new service).

Previously worked on in azure-powershell-pr https://github.com/Azure/azure-powershell-pr/pull/369 with feedback here. Have incorporated this feedback.

Based on the swagger here and the .net SDK here.


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

  • 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.

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.

@JCookit
Copy link
Contributor Author

JCookit commented Jan 16, 2018

I see the break above --- something to do with 'mappings'? what's that?

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.

Initial review comments

```

### -InputObject
{{Fill InputObject Description}}
Copy link
Member

Choose a reason for hiding this comment

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

Please fill in the descriptions for all parameters in the help

# Test
$accountname = 'csa' + $rgname;
$skuname = 'S0';
$loc = 'West US';
Copy link
Member

Choose a reason for hiding this comment

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

regions should not be hardcoded - this will keep maintainers from being able to run and record tests in some environments

New-AzureRmResourceGroup -Name $rgname -Location $loc;

$createdAccount = New-AzureRmLocationBasedServicesAccount -ResourceGroupName $rgname -Name $accountname -SkuName $skuname -Force;
Assert-NotNull $createdAccount;
Copy link
Member

Choose a reason for hiding this comment

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

Please add some additional validation of the account properties

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@markcowl
Copy link
Member

@JCookit A couple of things from a cursory review, will add some detail tomorrow

@markcowl
Copy link
Member

@JCookit Also, the test is failing due to an app.config file in your test directory - you want to avoid using these for assembly binding redirects, as this can mask issues.

- updated help files with missing descriptions
- removed app.config and obsolete newtonsoft dependency
@JCookit
Copy link
Contributor Author

JCookit commented Jan 18, 2018

@markcowl
added missing help, removed app.config and changed hard-coded location.

- dynamically determine RG region in tests

- also added PSSku object (was returning sdk model object before)

- reran all unittests
@@ -0,0 +1,28 @@
<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

# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '3.3.2'; })
Copy link
Member

Choose a reason for hiding this comment

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

Needs to sue the current version (4.1.1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it

RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '3.3.2'; })

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Copy link
Member

Choose a reason for hiding this comment

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

Need to add your management assembly, and any other assemblies not used by other modules here (see the other psd1 files for samples)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok. should just be our management assembly.


# A URL to an icon representing this module.
# IconUri = ''

Copy link
Member

Choose a reason for hiding this comment

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

Need to add

Prerelease='preview'

here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

inside the PSData? ok.

/// <summary>
/// Get Location Based Services Account by name, all accounts under resource group or all accounts under the subscription
/// </summary>
[Cmdlet(VerbsCommon.Get, LocationBasedServicesAccountNounStr), OutputType(typeof(PSLocationBasedServicesAccount))]
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 DefaultParameterSetName, since there is more than one parameter set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok. does it matter which one? i picked.

<PropertyName>AccountName</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Id</PropertyName>
Copy link
Member

Choose a reason for hiding this comment

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

No other data that the user would liek to know about the account?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this time, our accounts themselves are dead simple. Nothing else interesting (at least that's exposed in the SDK... yet)


PrimaryKey SecondaryKey
---------- ------------
yKp9encJJQyJMlxgj0gc4n5Iz9DheQyxt020Rwnd3a8 AeE4SoxPk6BrYZgRlqA8uuchLXzkTEHTpm3_iMaml2g
Copy link
Member

Choose a reason for hiding this comment

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

You might want to ensure that these are obviously redeacted (xxxxxxxx, yyyyyyyyyy, ***********, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ya wasn't sure what best practice was. These keys are just examples; they won't work.
but i can redact.

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.Management.LocationBasedServices" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" 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.

don't need any entries other than your management client

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authorization", "..\..\Common\Commands.Common.Authorization\Commands.Common.Authorization.csproj", "{24508E26-154D-47F1-80EE-439BF0710996}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Graph.RBAC", "..\..\Common\Commands.Common.Graph.RBAC\Commands.Common.Graph.RBAC.csproj", "{269ACF73-0A34-42DC-AB9C-4B15931A489D}"
Copy link
Member

Choose a reason for hiding this comment

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

Please include Commands.Common.Network, and Commands.Common.Storage projects, they are necessary for building Profile

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added Network (Storage was already there). fwiw, this isn't documented that i can find.

- Additional information about change #1
-->
## Current Release
* Integrate with Cognitive Services Management SDK version 2.0.0.
Copy link
Member

Choose a reason for hiding this comment

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

?? I don;t think this impacts this library

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right. bad copy/paste from the project i was modeling after.

- fixed various metadata
- added ResourceId parameter sets & DefaultParameterSets
- updated help
- improved and reran unittests
@markcowl
Copy link
Member

@markcowl markcowl merged commit 4501b79 into Azure:preview Jan 29, 2018
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.

5 participants