Skip to content
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

Migrate Astro from generation to main #26643

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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