Skip to content

Commit c2b91f8

Browse files
azure-pipelines[bot]azure-powershell-botvidai-msft
authored
Migrate Astro from generation to main (Azure#26643)
* Move Astro to main * Update ChangeLog.md --------- Co-authored-by: azure-powershell-bot <[email protected]> Co-authored-by: Vincent Dai <[email protected]>
1 parent ba10fa1 commit c2b91f8

24 files changed

+542
-411
lines changed

src/Astro/Astro.Autorest/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ subject-prefix: $(service-name)
4848
# Disable transform IdentityType as GET+PUT can not replace patch
4949
# 1. Organizations_CreateOrUpdate can not update resources
5050
# 2. the input schemas of PUT and PATCH are different
51+
flatten-userassignedidentity: false
5152
disable-transform-identity-type: true
5253

5354
directive:
@@ -74,4 +75,7 @@ directive:
7475
- where:
7576
verb: Update
7677
hide: true
78+
- from: UserAssignedIdentities.dictionary.cs
79+
where: $
80+
transform: $ = $.replace('null != property.Key && null != property.Value', 'null != property.Key');
7781
```

src/Astro/Astro.Autorest/build-module.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ if(-not $NotIsolated -and -not $Debugger) {
7575
$binFolder = Join-Path $PSScriptRoot 'bin'
7676
$objFolder = Join-Path $PSScriptRoot 'obj'
7777

78+
$isAzure = [System.Convert]::ToBoolean('true')
79+
7880
if(-not $Debugger) {
7981
Write-Host -ForegroundColor Green 'Cleaning build folders...'
8082
$null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder
@@ -151,7 +153,7 @@ if($NoDocs) {
151153
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'README.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
152154
}
153155
$null = New-Item -ItemType Directory -Force -Path $docsFolder
154-
$addComplexInterfaceInfo = ![System.Convert]::ToBoolean('true')
156+
$addComplexInterfaceInfo = !$isAzure
155157
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid -AddComplexInterfaceInfo:$addComplexInterfaceInfo
156158
}
157159

@@ -186,5 +188,4 @@ if (-not $DisableAfterBuildTasks){
186188
}
187189
}
188190

189-
190-
Write-Host -ForegroundColor Green '-------------Done-------------'
191+
Write-Host -ForegroundColor Green '-------------Done-------------'

src/Astro/Astro.Autorest/custom/New-AzAstroOrganization.ps1

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function New-AzAstroOrganization {
100100
# Last name of the user
101101
${UserLastName},
102102

103-
[Parameter(ParameterSetName='CreateExpanded')]
103+
[Parameter(ParameterSetName = 'CreateExpanded')]
104104
[Microsoft.Azure.PowerShell.Cmdlets.Astro.Category('Body')]
105105
[System.Management.Automation.SwitchParameter]
106106
# Decides if enable a system assigned identity for the resource.
@@ -282,7 +282,7 @@ function New-AzAstroOrganization {
282282
)
283283

284284
process {
285-
if($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity') -or $PSBoundParameters.ContainsKey('UserAssignedIdentity') ){
285+
if ($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity') -or $PSBoundParameters.ContainsKey('UserAssignedIdentity')) {
286286
$supportsSystemAssignedIdentity = $PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')
287287
$supportsUserAssignedIdentity = $PSBoundParameters.ContainsKey("UserAssignedIdentity") -and $UserAssignedIdentity.Length -gt 0
288288

@@ -299,9 +299,20 @@ function New-AzAstroOrganization {
299299
else {
300300
$PSBoundParameters.Add("IdentityType", "None")
301301
}
302-
302+
303+
# If user input UserAssignedIdentity
304+
if ($PSBoundParameters.ContainsKey('UserAssignedIdentity')) {
305+
$userIdentityObject = [Microsoft.Azure.PowerShell.Cmdlets.Astro.Models.UserAssignedIdentity]::New()
306+
$PSBoundParameters.IdentityUserAssignedIdentity = @{}
307+
foreach ($item in $PSBoundParameters.UserAssignedIdentity) {
308+
$PSBoundParameters.IdentityUserAssignedIdentity.Add($item, $userIdentityObject )
309+
}
310+
311+
$null = $PSBoundParameters.Remove('UserAssignedIdentity')
312+
}
313+
303314
# remove EnableSystemAssignedIdentity
304-
if($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')) {
315+
if ($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')) {
305316
$null = $PSBoundParameters.Remove("EnableSystemAssignedIdentity")
306317
}
307318
}

0 commit comments

Comments
 (0)