Skip to content

Commit

Permalink
Migrate Astro from generation to main (#26643)
Browse files Browse the repository at this point in the history
* Move Astro to main

* Update ChangeLog.md

---------

Co-authored-by: azure-powershell-bot <[email protected]>
Co-authored-by: Vincent Dai <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent ba10fa1 commit c2b91f8
Show file tree
Hide file tree
Showing 24 changed files with 542 additions and 411 deletions.
4 changes: 4 additions & 0 deletions src/Astro/Astro.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ subject-prefix: $(service-name)
# Disable transform IdentityType as GET+PUT can not replace patch
# 1. Organizations_CreateOrUpdate can not update resources
# 2. the input schemas of PUT and PATCH are different
flatten-userassignedidentity: false
disable-transform-identity-type: true

directive:
Expand All @@ -74,4 +75,7 @@ directive:
- where:
verb: Update
hide: true
- from: UserAssignedIdentities.dictionary.cs
where: $
transform: $ = $.replace('null != property.Key && null != property.Value', 'null != property.Key');
```
7 changes: 4 additions & 3 deletions src/Astro/Astro.Autorest/build-module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ if(-not $NotIsolated -and -not $Debugger) {
$binFolder = Join-Path $PSScriptRoot 'bin'
$objFolder = Join-Path $PSScriptRoot 'obj'

$isAzure = [System.Convert]::ToBoolean('true')

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

Expand Down Expand Up @@ -186,5 +188,4 @@ if (-not $DisableAfterBuildTasks){
}
}


Write-Host -ForegroundColor Green '-------------Done-------------'
Write-Host -ForegroundColor Green '-------------Done-------------'
19 changes: 15 additions & 4 deletions src/Astro/Astro.Autorest/custom/New-AzAstroOrganization.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function New-AzAstroOrganization {
# Last name of the user
${UserLastName},

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

process {
if($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity') -or $PSBoundParameters.ContainsKey('UserAssignedIdentity') ){
if ($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity') -or $PSBoundParameters.ContainsKey('UserAssignedIdentity')) {
$supportsSystemAssignedIdentity = $PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')
$supportsUserAssignedIdentity = $PSBoundParameters.ContainsKey("UserAssignedIdentity") -and $UserAssignedIdentity.Length -gt 0

Expand All @@ -299,9 +299,20 @@ function New-AzAstroOrganization {
else {
$PSBoundParameters.Add("IdentityType", "None")
}


# If user input UserAssignedIdentity
if ($PSBoundParameters.ContainsKey('UserAssignedIdentity')) {
$userIdentityObject = [Microsoft.Azure.PowerShell.Cmdlets.Astro.Models.UserAssignedIdentity]::New()
$PSBoundParameters.IdentityUserAssignedIdentity = @{}
foreach ($item in $PSBoundParameters.UserAssignedIdentity) {
$PSBoundParameters.IdentityUserAssignedIdentity.Add($item, $userIdentityObject )
}

$null = $PSBoundParameters.Remove('UserAssignedIdentity')
}

# remove EnableSystemAssignedIdentity
if($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')) {
if ($PSBoundParameters.ContainsKey('EnableSystemAssignedIdentity')) {
$null = $PSBoundParameters.Remove("EnableSystemAssignedIdentity")
}
}
Expand Down
Loading

0 comments on commit c2b91f8

Please sign in to comment.