-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Add Get-AzAvailableServiceAlias cmdlet. #10198
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
markcowl
merged 4 commits into
Azure:network-september
from
jkhurana19:usr/jakhuran/mergeGetAvailableServiceAlias
Oct 7, 2019
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4857b90
Add Get-AzAvailableServiceAlias cmdlet.
JK-microsoft 85a88c1
Merge branch 'network-september' into usr/jakhuran/mergeGetAvailableS…
jkhurana19 da720ed
PR changes: update link in help and rename the modeling class to PsAv…
JK-microsoft 11ee14a
Merge branch 'usr/jakhuran/mergeGetAvailableServiceAlias' of https://…
JK-microsoft 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
36 changes: 36 additions & 0 deletions
36
src/Network/Network.Test/ScenarioTests/AvailableAliasTests.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,36 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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.Network.Test.ScenarioTests; | ||
| using Microsoft.WindowsAzure.Commands.ScenarioTest; | ||
| using Xunit; | ||
|
|
||
| namespace Commands.Network.Test.ScenarioTests | ||
| { | ||
| public class AvailableAliasTests :NetworkTestRunner | ||
| { | ||
| public AvailableAliasTests(Xunit.Abstractions.ITestOutputHelper output) | ||
| : base(output) | ||
| { | ||
| } | ||
|
|
||
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| [Trait(Category.Owner, NrpTeamAlias.sdnnrp)] | ||
| public void TestAvailableAliasList() | ||
| { | ||
| TestRunner.RunTestScript( "Test-GetAvailableAliasList"); | ||
| } | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
src/Network/Network.Test/ScenarioTests/AvailableAliasTests.ps1
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,33 @@ | ||
| # ---------------------------------------------------------------------------------- | ||
| # | ||
| # 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. | ||
| # ---------------------------------------------------------------------------------- | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Tests checking API to list available Alias. | ||
| #> | ||
| function Test-GetAvailableAliasList | ||
| { | ||
| $location = Get-ProviderLocation ResourceManagement | ||
|
|
||
| try | ||
| { | ||
| $results = Get-AzAvailableServiceAlias -Location $location; | ||
| Assert-NotNull $results; | ||
| } | ||
| finally | ||
| { | ||
| # Cleanup | ||
| Clean-ResourceGroup $rgname | ||
| } | ||
| } |
75 changes: 75 additions & 0 deletions
75
...cords/Commands.Network.Test.ScenarioTests.AvailableAliasTests/TestAvailableAliasList.json
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,75 @@ | ||
| { | ||
| "Entries": [ | ||
| { | ||
| "RequestUri": "/subscriptions/947d47b4-7883-4bb9-9d85-c5e8e2f572ce/providers/Microsoft.Network/locations/West%20Central%20US/availableServiceAliases?api-version=2019-08-01", | ||
| "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTQ3ZDQ3YjQtNzg4My00YmI5LTlkODUtYzVlOGUyZjU3MmNlL3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvV2VzdCUyMENlbnRyYWwlMjBVUy9hdmFpbGFibGVTZXJ2aWNlQWxpYXNlcz9hcGktdmVyc2lvbj0yMDE5LTA4LTAx", | ||
| "RequestMethod": "GET", | ||
| "RequestBody": "", | ||
| "RequestHeaders": { | ||
| "x-ms-client-request-id": [ | ||
| "bb89b196-039e-470b-9c61-c5e3b7a8ad20" | ||
| ], | ||
| "Accept-Language": [ | ||
| "en-US" | ||
| ], | ||
| "User-Agent": [ | ||
| "FxVersion/4.6.27817.01", | ||
| "OSName/Windows", | ||
| "OSVersion/Microsoft.Windows.10.0.18362.", | ||
| "Microsoft.Azure.Management.Network.NetworkManagementClient/19.16.0.0" | ||
| ] | ||
| }, | ||
| "ResponseHeaders": { | ||
| "Cache-Control": [ | ||
| "no-cache" | ||
| ], | ||
| "Pragma": [ | ||
| "no-cache" | ||
| ], | ||
| "x-ms-request-id": [ | ||
| "32791b33-78e3-4611-8d4f-91fdce3eac56" | ||
| ], | ||
| "x-ms-correlation-request-id": [ | ||
| "cf783df8-e0a8-4743-9b55-98a450937f2a" | ||
| ], | ||
| "x-ms-arm-service-request-id": [ | ||
| "138ace78-6c17-4b70-8794-bf455e2f1f53" | ||
| ], | ||
| "Strict-Transport-Security": [ | ||
| "max-age=31536000; includeSubDomains" | ||
| ], | ||
| "Server": [ | ||
| "Microsoft-HTTPAPI/2.0", | ||
| "Microsoft-HTTPAPI/2.0" | ||
| ], | ||
| "x-ms-ratelimit-remaining-subscription-reads": [ | ||
| "11999" | ||
| ], | ||
| "x-ms-routing-request-id": [ | ||
| "WESTUS:20191004T202417Z:cf783df8-e0a8-4743-9b55-98a450937f2a" | ||
| ], | ||
| "X-Content-Type-Options": [ | ||
| "nosniff" | ||
| ], | ||
| "Date": [ | ||
| "Fri, 04 Oct 2019 20:24:16 GMT" | ||
| ], | ||
| "Content-Length": [ | ||
| "632" | ||
| ], | ||
| "Content-Type": [ | ||
| "application/json; charset=utf-8" | ||
| ], | ||
| "Expires": [ | ||
| "-1" | ||
| ] | ||
| }, | ||
| "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"name\": \"servicesAzure\",\r\n \"id\": \"/subscriptions/947d47b4-7883-4bb9-9d85-c5e8e2f572ce/providers/Microsoft.Network/AvailableServiceAliases/servicesAzure\",\r\n \"type\": \"Microsoft.Network/AvailableServiceAliases\",\r\n \"resourceName\": \"/services/Azure\"\r\n },\r\n {\r\n \"name\": \"servicesAzureManagedInstance\",\r\n \"id\": \"/subscriptions/947d47b4-7883-4bb9-9d85-c5e8e2f572ce/providers/Microsoft.Network/AvailableServiceAliases/servicesAzureManagedInstance\",\r\n \"type\": \"Microsoft.Network/AvailableServiceAliases\",\r\n \"resourceName\": \"/services/Azure/ManagedInstance\"\r\n }\r\n ]\r\n}", | ||
| "StatusCode": 200 | ||
| } | ||
| ], | ||
| "Names": {}, | ||
| "Variables": { | ||
| "SubscriptionId": "947d47b4-7883-4bb9-9d85-c5e8e2f572ce" | ||
| } | ||
| } |
52 changes: 52 additions & 0 deletions
52
src/Network/Network/AvailableAlias/GetAzureAvailableServiceAlias.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,52 @@ | ||
| // | ||
| // Copyright (c) Microsoft and contributors. All rights reserved. | ||
| // | ||
| // 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 System.Collections.Generic; | ||
| using System.Management.Automation; | ||
| using Microsoft.Azure.Commands.Network.Models; | ||
| using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; | ||
| using Microsoft.Azure.Management.Network; | ||
| using CNM = Microsoft.Azure.Commands.Network.Models; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Network.Automation | ||
| { | ||
| [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "AvailableServiceAlias"), OutputType(typeof(PSAvailableAlias))] | ||
| public partial class GetAzureAvailableServiceAliasCommand : NetworkBaseCmdlet | ||
| { | ||
| [Parameter( | ||
| Mandatory = true, | ||
| HelpMessage = "The location.", | ||
| ValueFromPipelineByPropertyName = true)] | ||
| [LocationCompleter("Microsoft.Network/locations/availableServiceAliases")] | ||
| [ValidateNotNullOrEmpty] | ||
| public string Location { get; set; } | ||
|
|
||
| public override void Execute() | ||
| { | ||
| base.Execute(); | ||
|
|
||
| var availableServiceAliasList = this.NetworkClient.NetworkManagementClient.AvailableServiceAliases.List(Location); | ||
| List<PSAvailableAlias> psAvailableServiceAlias = new List<PSAvailableAlias>(); | ||
|
|
||
| foreach (var availableServiceAlias in availableServiceAliasList) | ||
| { | ||
| psAvailableServiceAlias.Add(NetworkResourceManagerProfile.Mapper.Map<CNM.PSAvailableAlias>(availableServiceAlias)); | ||
| } | ||
|
|
||
| WriteObject(psAvailableServiceAlias, true); | ||
| } | ||
| } | ||
| } |
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
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
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
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,18 @@ | ||
| using System.Collections.Generic; | ||
| using Microsoft.WindowsAzure.Commands.Common.Attributes; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Network.Models | ||
| { | ||
| public class PSAvailableAlias | ||
| { | ||
| [Ps1Xml(Label = "Name", Target = ViewControl.Table, Position = 1)] | ||
| public string Name { get; set; } | ||
|
|
||
| public string Id { get; set; } | ||
|
|
||
| [Ps1Xml(Target = ViewControl.Table)] | ||
| public string Type { get; set; } | ||
|
|
||
| public string ResourceName { get; set; } | ||
| } | ||
| } | ||
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
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,80 @@ | ||
| --- | ||
| external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml | ||
| Module Name: Az.Network | ||
| online version: | ||
jkhurana19 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| schema: 2.0.0 | ||
| --- | ||
|
|
||
| # Get-AzAvailableServiceAlias | ||
|
|
||
| ## SYNOPSIS | ||
| Get available service aliases in the region. | ||
|
|
||
| ## SYNTAX | ||
|
|
||
| ``` | ||
| Get-AzAvailableServiceAlias -Location <String> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>] | ||
| ``` | ||
|
|
||
| ## DESCRIPTION | ||
| The **Get-AzAvailableServiceAlias** cmdlet allows you to retrieve all of the available service aliases for a subnet in the provided location. | ||
|
|
||
| ## EXAMPLES | ||
|
|
||
| ### Example 1 | ||
| ```powershell | ||
| PS C:\> Get-AzAvailableServiceAliases -Location "westus" | ||
|
|
||
| Name Id Type ResourceName | ||
| ---- -- ---- ------------ | ||
| servicesAzure /subscriptions/61dc4623-b5f8-41a0-acfc-29537dcf6e5d/providers/Microsoft.Network/AvailableServiceAliases/servicesAzure Microsoft.Network/AvailableServiceAliases /services/Azure | ||
| servicesAzureManagedInstance /subscriptions/61dc4623-b5f8-41a0-acfc-29537dcf6e5d/providers/Microsoft.Network/AvailableServiceAliases/servicesAzureManagedInstance Microsoft.Network/AvailableServiceAliases /services/Azure/ManagedInstance | ||
|
|
||
| ``` | ||
|
|
||
| ## PARAMETERS | ||
|
|
||
| ### -DefaultProfile | ||
| The credentials, account, tenant, and subscription used for communication with Azure. | ||
|
|
||
| ```yaml | ||
| Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer | ||
| Parameter Sets: (All) | ||
| Aliases: AzContext, AzureRmContext, AzureCredential | ||
|
|
||
| Required: False | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: False | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### -Location | ||
| The location. | ||
|
|
||
| ```yaml | ||
| Type: System.String | ||
| Parameter Sets: (All) | ||
| Aliases: | ||
|
|
||
| Required: True | ||
| Position: Named | ||
| Default value: None | ||
| Accept pipeline input: True (ByPropertyName) | ||
| Accept wildcard characters: False | ||
| ``` | ||
|
|
||
| ### CommonParameters | ||
| This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). | ||
|
|
||
| ## INPUTS | ||
|
|
||
| ### System.String | ||
|
|
||
| ## OUTPUTS | ||
|
|
||
| ### Microsoft.Azure.Commands.Network.Models.PSAvailableAlias | ||
|
|
||
| ## NOTES | ||
|
|
||
| ## RELATED LINKS | ||
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.
Uh oh!
There was an error while loading. Please reload this page.