Skip to content

Commit 5fc7132

Browse files
Move CustomLocation to main
1 parent 24ae171 commit 5fc7132

File tree

81 files changed

+1478
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1478
-231
lines changed

src/CustomLocation/CustomLocation.Autorest/Az.CustomLocation.psm1

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,41 @@
4747

4848
# Ask for the shared functionality table
4949
$VTable = Register-AzModule
50-
50+
5151
# Tweaks the pipeline on module load
5252
$instance.OnModuleLoad = $VTable.OnModuleLoad
5353

5454
# Following two delegates are added for telemetry
5555
$instance.GetTelemetryId = $VTable.GetTelemetryId
5656
$instance.Telemetry = $VTable.Telemetry
57-
57+
58+
# Delegate to sanitize the output object
59+
$instance.SanitizeOutput = $VTable.SanitizerHandler
60+
61+
# Delegate to get the telemetry info
62+
$instance.GetTelemetryInfo = $VTable.GetTelemetryInfo
5863

5964
# Tweaks the pipeline per call
6065
$instance.OnNewRequest = $VTable.OnNewRequest
61-
66+
6267
# Gets shared parameter values
6368
$instance.GetParameterValue = $VTable.GetParameterValue
64-
69+
6570
# Allows shared module to listen to events from this module
6671
$instance.EventListener = $VTable.EventListener
67-
72+
6873
# Gets shared argument completers
6974
$instance.ArgumentCompleter = $VTable.ArgumentCompleter
70-
75+
7176
# The name of the currently selected Azure profile
7277
$instance.ProfileName = $VTable.ProfileName
7378

74-
7579
# Load the custom module
7680
$customModulePath = Join-Path $PSScriptRoot './custom/Az.CustomLocation.custom.psm1'
7781
if(Test-Path $customModulePath) {
7882
$null = Import-Module -Name $customModulePath
7983
}
80-
84+
8185
# Export nothing to clear implicit exports
8286
Export-ModuleMember
8387

@@ -97,12 +101,12 @@
97101
# Load the last folder if no profile is selected
98102
$profileDirectory = $directories | Select-Object -Last 1
99103
}
100-
104+
101105
if($profileDirectory) {
102106
Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
103107
$exportsPath = $profileDirectory.FullName
104108
}
105-
109+
106110
if($exportsPath) {
107111
Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
108112
$cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath

src/CustomLocation/CustomLocation.Autorest/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This directory contains the PowerShell module for the CustomLocation service.
44

55
---
6-
76
## Info
87
- Modifiable: yes
98
- Generated: all
@@ -31,17 +30,19 @@ For information on how to develop for `Az.CustomLocation`, see [how-to.md](how-t
3130
commit: f1180941e238bc99ac71f9535ecd126bb8b77d8f
3231
require:
3332
- $(this-folder)/../../readme.azure.noprofile.md
34-
input-file:
33+
input-file:
3534
- $(repo)/specification/extendedlocation/resource-manager/Microsoft.ExtendedLocation/preview/2021-08-31-preview/customlocations.json
3635

3736
module-version: 0.1.0
3837
title: CustomLocation
3938
subject-prefix: $(service-name)
39+
disable-transform-identity-type: true
40+
flatten-userassignedidentity: false
4041

4142
identity-correction-for-post: true
4243

4344
directive:
44-
- from: swagger-document
45+
- from: swagger-document
4546
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ExtendedLocation/customLocations/{resourceName}"].delete.responses
4647
transform: >-
4748
return {
@@ -62,7 +63,7 @@ directive:
6263
}
6364
}
6465
65-
- from: swagger-document
66+
- from: swagger-document
6667
where: $.definitions.customLocationProperties.properties.provisioningState
6768
transform: >-
6869
return {

src/CustomLocation/CustomLocation.Autorest/exports/Find-AzCustomLocationTargetResourceGroup.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ param(
7777
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')]
7878
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity]
7979
# Identity Parameter
80-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8180
${InputObject},
8281

8382
[Parameter(ParameterSetName='FindExpanded')]
@@ -187,7 +186,13 @@ begin {
187186
FindViaJsonString = 'Az.CustomLocation.private\Find-AzCustomLocationTargetResourceGroup_FindViaJsonString';
188187
}
189188
if (('FindExpanded', 'FindViaJsonFilePath', 'FindViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
190-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
189+
$testPlayback = $false
190+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
191+
if ($testPlayback) {
192+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
193+
} else {
194+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
195+
}
191196
}
192197
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
193198
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocation.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ param(
7575
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')]
7676
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity]
7777
# Identity Parameter
78-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
7978
${InputObject},
8079

8180
[Parameter()]
@@ -159,7 +158,13 @@ begin {
159158
List1 = 'Az.CustomLocation.private\Get-AzCustomLocation_List1';
160159
}
161160
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
162-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
161+
$testPlayback = $false
162+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
163+
if ($testPlayback) {
164+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
165+
} else {
166+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
167+
}
163168
}
164169
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
165170
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocationEnabledResourceType.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,13 @@ begin {
129129
List = 'Az.CustomLocation.private\Get-AzCustomLocationEnabledResourceType_List';
130130
}
131131
if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
132-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
132+
$testPlayback = $false
133+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
134+
if ($testPlayback) {
135+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
136+
} else {
137+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
138+
}
133139
}
134140
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
135141
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocationResourceSyncRule.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,12 @@ param(
8787
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')]
8888
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity]
8989
# Identity Parameter
90-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9190
${InputObject},
9291

9392
[Parameter(ParameterSetName='GetViaIdentityCustomlocation', Mandatory, ValueFromPipeline)]
9493
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')]
9594
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity]
9695
# Identity Parameter
97-
# To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table.
9896
${CustomlocationInputObject},
9997

10098
[Parameter()]
@@ -178,7 +176,13 @@ begin {
178176
List = 'Az.CustomLocation.private\Get-AzCustomLocationResourceSyncRule_List';
179177
}
180178
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
181-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
179+
$testPlayback = $false
180+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
181+
if ($testPlayback) {
182+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
183+
} else {
184+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
185+
}
182186
}
183187
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
184188
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/CustomLocation/CustomLocation.Autorest/exports/New-AzCustomLocation.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,13 @@ begin {
217217
CreateViaJsonString = 'Az.CustomLocation.custom\New-AzCustomLocation';
218218
}
219219
if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
220-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
220+
$testPlayback = $false
221+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
222+
if ($testPlayback) {
223+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
224+
} else {
225+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
226+
}
221227
}
222228
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
223229
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/CustomLocation/CustomLocation.Autorest/exports/New-AzCustomLocationResourceSyncRule.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,12 @@ param(
9696
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')]
9797
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity]
9898
# Identity Parameter
99-
# To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table.
10099
${CustomlocationInputObject},
101100

102101
[Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)]
103102
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')]
104103
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity]
105104
# Identity Parameter
106-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
107105
${InputObject},
108106

109107
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
@@ -132,7 +130,6 @@ param(
132130
# Valid operators include In, NotIn, Exists, and DoesNotExist.
133131
# The values set must be non-empty in the case of In and NotIn.
134132
# The values set must be empty in the case of Exists and DoesNotExist.
135-
# To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table.
136133
${SelectorMatchExpression},
137134

138135
[Parameter(ParameterSetName='CreateExpanded')]
@@ -270,7 +267,13 @@ begin {
270267
CreateViaJsonString = 'Az.CustomLocation.private\New-AzCustomLocationResourceSyncRule_CreateViaJsonString';
271268
}
272269
if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
273-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
270+
$testPlayback = $false
271+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
272+
if ($testPlayback) {
273+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
274+
} else {
275+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
276+
}
274277
}
275278
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
276279
[Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

0 commit comments

Comments
 (0)