-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
74ae8b7
initial checkin to public repo for new cmdlets
JCookit 623f7f0
Merge remote-tracking branch 'upstream/preview' into preview
JCookit fd6415f
merge from upstream and rerun unittests
JCookit 1927989
added mapping rule
JCookit ea2c7cb
per feedback:
JCookit 94f7f98
per feedback:
JCookit b775d54
per feedback:
JCookit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
134 changes: 134 additions & 0 deletions
134
src/ResourceManager/LocationBasedServices/AzureRM.LocationBasedServices.psd1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# | ||
# Module manifest for module 'PSGet_AzureRM.LocationBasedServices' | ||
# | ||
# Generated by: Microsoft Corporation | ||
# | ||
# Generated on: 8/7/2017 | ||
# | ||
|
||
@{ | ||
|
||
# Script module or binary module file associated with this manifest. | ||
# RootModule = '' | ||
|
||
# Version number of this module. | ||
ModuleVersion = '1.0.0' | ||
|
||
# Supported PSEditions | ||
# CompatiblePSEditions = @() | ||
|
||
# ID used to uniquely identify this module | ||
GUID = 'bf60f35d-6c0b-42f2-be30-eb333a31279d' | ||
|
||
# Author of this module | ||
Author = 'Microsoft Corporation' | ||
|
||
# Company or vendor of this module | ||
CompanyName = 'Microsoft Corporation' | ||
|
||
# Copyright statement for this module | ||
Copyright = 'Microsoft Corporation. All rights reserved.' | ||
|
||
# Description of the functionality provided by this module | ||
Description = 'Microsoft Azure PowerShell - Location Based Services management cmdlets for Azure Resource Manager. Creates and manages location based services accounts in Azure Resource Manager.' | ||
|
||
# Minimum version of the Windows PowerShell engine required by this module | ||
PowerShellVersion = '3.0' | ||
|
||
# Name of the Windows PowerShell host required by this module | ||
# PowerShellHostName = '' | ||
|
||
# Minimum version of the Windows PowerShell host required by this module | ||
# PowerShellHostVersion = '' | ||
|
||
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. | ||
DotNetFrameworkVersion = '4.5.2' | ||
|
||
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. | ||
CLRVersion = '4.0' | ||
|
||
# Processor architecture (None, X86, Amd64) required by this module | ||
# ProcessorArchitecture = '' | ||
|
||
# Modules that must be imported into the global environment prior to importing this module | ||
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '4.1.1'; }) | ||
|
||
# Assemblies that must be loaded prior to importing this module | ||
RequiredAssemblies = '.\Microsoft.Azure.Management.LocationBasedServices.dll' | ||
|
||
# Script files (.ps1) that are run in the caller's environment prior to importing this module. | ||
# ScriptsToProcess = @() | ||
|
||
# Type files (.ps1xml) to be loaded when importing this module | ||
# TypesToProcess = @() | ||
|
||
# Format files (.ps1xml) to be loaded when importing this module | ||
FormatsToProcess = '.\Microsoft.Azure.Commands.LocationBasedServices.format.ps1xml' | ||
|
||
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess | ||
NestedModules = @('.\Microsoft.Azure.Commands.LocationBasedServices.dll') | ||
|
||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. | ||
FunctionsToExport = @() | ||
|
||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. | ||
CmdletsToExport = 'Get-AzureRmLocationBasedServicesAccount', | ||
'New-AzureRmLocationBasedServicesAccount', | ||
'Remove-AzureRmLocationBasedServicesAccount', | ||
'Set-AzureRmLocationBasedServicesAccount', | ||
'Get-AzureRmLocationBasedServicesAccountKey', | ||
'New-AzureRmLocationBasedServicesAccountKey' | ||
|
||
|
||
# Variables to export from this module | ||
# VariablesToExport = @() | ||
|
||
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. | ||
AliasesToExport = @() | ||
|
||
# DSC resources to export from this module | ||
# DscResourcesToExport = @() | ||
|
||
# List of all modules packaged with this module | ||
# ModuleList = @() | ||
|
||
# List of all files packaged with this module | ||
# FileList = @() | ||
|
||
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. | ||
PrivateData = @{ | ||
|
||
PSData = @{ | ||
|
||
# Tags applied to this module. These help with module discovery in online galleries. | ||
Tags = 'Azure','ResourceManager','ARM','LocationBasedServices', 'LBS' | ||
|
||
# A URL to the license for this module. | ||
LicenseUri = 'https://raw.githubusercontent.com/Azure/azure-powershell/preview/LICENSE.txt' | ||
|
||
# A URL to the main website for this project. | ||
ProjectUri = 'https://github.com/Azure/azure-powershell' | ||
|
||
# A URL to an icon representing this module. | ||
# IconUri = '' | ||
|
||
# ReleaseNotes of this module | ||
ReleaseNotes = 'first version' | ||
|
||
# External dependent modules of this module | ||
# ExternalModuleDependencies = '' | ||
|
||
Prerelease = 'preview' | ||
|
||
} # End of PSData hashtable | ||
|
||
} # End of PrivateData hashtable | ||
|
||
# HelpInfo URI of this module | ||
# HelpInfoURI = '' | ||
|
||
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. | ||
# DefaultCommandPrefix = '' | ||
|
||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- | ||
Please leave this section at the top of the change log. | ||
|
||
Changes for the current release should go under the section titled "Current Release", and should adhere to the following format: | ||
|
||
## Current Release | ||
* Overview of change #1 | ||
- Additional information about change #1 | ||
* Overview of change #2 | ||
- Additional information about change #2 | ||
- Additional information about change #2 | ||
* Overview of change #3 | ||
* Overview of change #4 | ||
- Additional information about change #4 | ||
|
||
## YYYY.MM.DD - Version X.Y.Z (Previous Release) | ||
* Overview of change #1 | ||
- Additional information about change #1 | ||
--> | ||
## Current Release | ||
* First release of Location Based Services management cmdlets | ||
|
121 changes: 121 additions & 0 deletions
121
...ocationBasedServices/Commands.LocationBasedServices/Commands.LocationBasedServices.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{CFDE176D-2F12-4730-88B1-2722E986F4B1}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Microsoft.Azure.Commands.LocationBasedServices</RootNamespace> | ||
<AssemblyName>Microsoft.Azure.Commands.LocationBasedServices</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir> | ||
<RestorePackages>true</RestorePackages> | ||
<CodeAnalysisAdditionalOptions>/assemblyCompareMode:StrongNameIgnoringVersion</CodeAnalysisAdditionalOptions> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.LocationBasedServices\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<RunCodeAnalysis>true</RunCodeAnalysis> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<DefineConstants>TRACE;SIGN</DefineConstants> | ||
<Optimize>true</Optimize> | ||
<OutputPath>..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.LocationBasedServices\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<CodeAnalysisLogFile>bin\Release\Microsoft.Azure.Commands.LocationBasedServices.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> | ||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> | ||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> | ||
<ErrorReport>prompt</ErrorReport> | ||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
<CodeAnalysisRuleSetDirectories>;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\Rule Sets</CodeAnalysisRuleSetDirectories> | ||
<CodeAnalysisRuleDirectories>;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\Rules</CodeAnalysisRuleDirectories> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile> | ||
<DelaySign>true</DelaySign> | ||
<Prefer32Bit>false</Prefer32Bit> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.Azure.Management.LocationBasedServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\..\..\packages\Microsoft.Azure.Management.LocationBasedServices.1.0.0\lib\net452\Microsoft.Azure.Management.LocationBasedServices.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> | ||
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> | ||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.IO.Compression.FileSystem" /> | ||
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> | ||
<Reference Include="System.Numerics" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="LocationBasedServicesAccount\GetAzureLocationBasedServicesAccount.cs" /> | ||
<Compile Include="LocationBasedServicesAccount\GetAzureLocationBasedServicesAccountKey.cs" /> | ||
<Compile Include="LocationBasedServicesAccount\LocationBasedServicesAccountBaseCmdlet.cs" /> | ||
<Compile Include="LocationBasedServicesAccount\LocationBasedServicesManagementClient.cs" /> | ||
<Compile Include="LocationBasedServicesAccount\NewAzureLocationBasedServicesAccount.cs" /> | ||
<Compile Include="LocationBasedServicesAccount\NewAzureLocationBasedServicesAccountKey.cs" /> | ||
<Compile Include="LocationBasedServicesAccount\RemoveAzureLocationBasedServicesAccount.cs" /> | ||
<Compile Include="Models\PSLocationBasedServicesAccount.cs" /> | ||
<Compile Include="Models\PSLocationBasedServicesAccountSku.cs" /> | ||
<Compile Include="Models\PSLocationBasedServicesAccountKeys.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="..\AzureRM.LocationBasedServices.psd1"> | ||
<Link>AzureRM.LocationBasedServices.psd1</Link> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Microsoft.Azure.Commands.LocationBasedServices.format.ps1xml"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Include="MSSharedLibKey.snk" /> | ||
<None Include="packages.config"> | ||
<SubType>Designer</SubType> | ||
</None> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\Common\Commands.Common.Authentication.Abstractions\Commands.Common.Authentication.Abstractions.csproj"> | ||
<Project>{70527617-7598-4aef-b5bd-db9186b8184b}</Project> | ||
<Name>Commands.Common.Authentication.Abstractions</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj"> | ||
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project> | ||
<Name>Commands.Common</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\Common\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj"> | ||
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project> | ||
<Name>Commands.ResourceManager.Common</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="..\..\..\..\tools\Common.Dependencies.targets" /> | ||
<Target Name="AfterBuild"> | ||
<ItemGroup> | ||
<MarkdownFiles Include="$(ProjectDir)help\*.*" /> | ||
</ItemGroup> | ||
<Copy SourceFiles="@(MarkdownFiles)" DestinationFolder="$(OutputPath)\help\" ContinueOnError="false" /> | ||
</Target> | ||
</Project> |
110 changes: 110 additions & 0 deletions
110
...ocationBasedServices/LocationBasedServicesAccount/GetAzureLocationBasedServicesAccount.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Commands.LocationBasedServices.Models; | ||
using Microsoft.Azure.Management.LocationBasedServices; | ||
using System.Management.Automation; | ||
|
||
namespace Microsoft.Azure.Commands.LocationBasedServices | ||
{ | ||
/// <summary> | ||
/// Get Location Based Services Account by name, all accounts under resource group or all accounts under the subscription | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, LocationBasedServicesAccountNounStr, DefaultParameterSetName = ResourceGroupParameterSet), | ||
OutputType(typeof(PSLocationBasedServicesAccount))] | ||
public class GetAzureLocationBasedServiceAccountCommand : LocationBasedServicesAccountBaseCmdlet | ||
{ | ||
protected const string ResourceGroupParameterSet = "ResourceGroupParameterSet"; | ||
protected const string AccountNameParameterSet = "AccountNameParameterSet"; | ||
protected const string ResourceIdParameterSet = "ResourceIdParameterSet"; | ||
|
||
[Parameter( | ||
Position = 0, | ||
Mandatory = false, | ||
ParameterSetName = ResourceGroupParameterSet, | ||
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "Resource Group Name.")] | ||
[Parameter( | ||
Position = 0, | ||
Mandatory = true, | ||
ParameterSetName = AccountNameParameterSet, | ||
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "Resource Group Name.")] | ||
[ValidateNotNullOrEmpty] | ||
public string ResourceGroupName { get; set; } | ||
|
||
[Parameter( | ||
Position = 1, | ||
Mandatory = true, | ||
ValueFromPipelineByPropertyName = true, | ||
ParameterSetName = AccountNameParameterSet, | ||
HelpMessage = "Location Based Services Account Name.")] | ||
[Alias(LocationBasedServicesAccountNameAlias, AccountNameAlias)] | ||
[ValidateNotNullOrEmpty] | ||
public string Name { get; set; } | ||
|
||
[Parameter( | ||
Position = 0, | ||
Mandatory = true, | ||
ValueFromPipelineByPropertyName = true, | ||
ParameterSetName = ResourceIdParameterSet, | ||
HelpMessage = "Location Based Services Account ResourceId.")] | ||
[ValidateNotNullOrEmpty] | ||
public string ResourceId { get; set; } | ||
|
||
public override void ExecuteCmdlet() | ||
{ | ||
base.ExecuteCmdlet(); | ||
|
||
RunCmdLet(() => | ||
{ | ||
switch (ParameterSetName) | ||
{ | ||
case AccountNameParameterSet: | ||
{ | ||
var locationBasedServicesAccount = this.LocationBasedServicesClient.Accounts.Get(this.ResourceGroupName, this.Name); | ||
WriteLocationBasedServicesAccount(locationBasedServicesAccount); | ||
break; | ||
} | ||
case ResourceGroupParameterSet: | ||
{ | ||
if (string.IsNullOrEmpty(this.ResourceGroupName)) | ||
{ | ||
var locationBasedServicesAccounts = this.LocationBasedServicesClient.Accounts.ListBySubscription(); | ||
WriteLocationBasedServicesAccountList(locationBasedServicesAccounts); | ||
} | ||
else | ||
{ | ||
var locationBasedServicesAccounts = this.LocationBasedServicesClient.Accounts.ListByResourceGroup(this.ResourceGroupName); | ||
WriteLocationBasedServicesAccountList(locationBasedServicesAccounts); | ||
} | ||
break; | ||
} | ||
case ResourceIdParameterSet: | ||
{ | ||
string resourceGroupName; | ||
string resourceName; | ||
|
||
if (ValidateAndExtractName(this.ResourceId, out resourceGroupName, out resourceName)) | ||
{ | ||
var locationBasedServicesAccount = this.LocationBasedServicesClient.Accounts.Get(resourceGroupName, resourceName); | ||
WriteLocationBasedServicesAccount(locationBasedServicesAccount); | ||
} | ||
break; | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 add
here
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.
inside the PSData? ok.