Skip to content

Commit f0bcab6

Browse files
committed
Az.HanaOnAzure
1 parent 7944ad8 commit f0bcab6

File tree

457 files changed

+70732
-0
lines changed

Some content is hidden

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

457 files changed

+70732
-0
lines changed

src/HanaOnAzure/Az.HanaOnAzure.format.ps1xml

Lines changed: 1495 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@{
2+
GUID = '79ad50da-e6b5-4703-885a-d36974a4d9b9'
3+
RootModule = './Az.HanaOnAzure.psm1'
4+
ModuleVersion = '0.1.0'
5+
CompatiblePSEditions = 'Core', 'Desktop'
6+
Author = 'Microsoft Corporation'
7+
CompanyName = 'Microsoft Corporation'
8+
Copyright = 'Microsoft Corporation. All rights reserved.'
9+
Description = 'Microsoft Azure PowerShell: HanaOn cmdlets'
10+
PowerShellVersion = '5.1'
11+
DotNetFrameworkVersion = '4.7.2'
12+
RequiredAssemblies = './bin/Az.HanaOnAzure.private.dll'
13+
FormatsToProcess = './Az.HanaOnAzure.format.ps1xml'
14+
FunctionsToExport = 'Get-AzSapMonitor', 'Get-AzSapMonitorProviderInstance', 'New-AzSapMonitor', 'New-AzSapMonitorProviderInstance', 'Remove-AzSapMonitor', 'Remove-AzSapMonitorProviderInstance', 'Update-AzSapMonitor'
15+
AliasesToExport = '*'
16+
PrivateData = @{
17+
PSData = @{
18+
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'HanaOn'
19+
LicenseUri = 'https://aka.ms/azps-license'
20+
ProjectUri = 'https://github.com/Azure/azure-powershell'
21+
ReleaseNotes = ''
22+
}
23+
}
24+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# region Generated
2+
# ----------------------------------------------------------------------------------
3+
#
4+
# Copyright Microsoft Corporation
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ----------------------------------------------------------------------------------
15+
# Load required Az.Accounts module
16+
$accountsName = 'Az.Accounts'
17+
$accountsModule = Get-Module -Name $accountsName
18+
if(-not $accountsModule) {
19+
$localAccountsPath = Join-Path $PSScriptRoot 'generated\modules'
20+
if(Test-Path -Path $localAccountsPath) {
21+
$localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1
22+
if($localAccounts) {
23+
$accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru
24+
}
25+
}
26+
if(-not $accountsModule) {
27+
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.8.1' } | Measure-Object).Count -gt 0
28+
if($hasAdequateVersion) {
29+
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.8.1 -Scope Global -PassThru
30+
}
31+
}
32+
}
33+
34+
if(-not $accountsModule) {
35+
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
36+
} elseif (($accountsModule.Version -lt [System.Version]'1.8.1') -and (-not $localAccounts)) {
37+
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
38+
}
39+
Write-Information "Loaded Module '$($accountsModule.Name)'"
40+
41+
# Load the private module dll
42+
$null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.HanaOnAzure.private.dll')
43+
44+
# Get the private module's instance
45+
$instance = [Microsoft.Azure.PowerShell.Cmdlets.HanaOnAzure.Module]::Instance
46+
47+
# Ask for the shared functionality table
48+
$VTable = Register-AzModule
49+
50+
# Tweaks the pipeline on module load
51+
$instance.OnModuleLoad = $VTable.OnModuleLoad
52+
53+
# Tweaks the pipeline per call
54+
$instance.OnNewRequest = $VTable.OnNewRequest
55+
56+
# Gets shared parameter values
57+
$instance.GetParameterValue = $VTable.GetParameterValue
58+
59+
# Allows shared module to listen to events from this module
60+
$instance.EventListener = $VTable.EventListener
61+
62+
# Gets shared argument completers
63+
$instance.ArgumentCompleter = $VTable.ArgumentCompleter
64+
65+
# The name of the currently selected Azure profile
66+
$instance.ProfileName = $VTable.ProfileName
67+
68+
69+
# Load the custom module
70+
$customModulePath = Join-Path $PSScriptRoot './custom/Az.HanaOnAzure.custom.psm1'
71+
if(Test-Path $customModulePath) {
72+
$null = Import-Module -Name $customModulePath
73+
}
74+
75+
# Export nothing to clear implicit exports
76+
Export-ModuleMember
77+
78+
# Export proxy cmdlet scripts
79+
$exportsPath = Join-Path $PSScriptRoot './exports'
80+
$directories = Get-ChildItem -Directory -Path $exportsPath
81+
$profileDirectory = $null
82+
if($instance.ProfileName) {
83+
if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) {
84+
$profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName }
85+
} else {
86+
# Don't export anything if the profile doesn't exist for the module
87+
$exportsPath = $null
88+
Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded."
89+
}
90+
} elseif(($directories | Measure-Object).Count -gt 0) {
91+
# Load the last folder if no profile is selected
92+
$profileDirectory = $directories | Select-Object -Last 1
93+
}
94+
95+
if($profileDirectory) {
96+
Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
97+
$exportsPath = $profileDirectory.FullName
98+
}
99+
100+
if($exportsPath) {
101+
Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
102+
$cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath
103+
Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias)
104+
}
105+
106+
# Finalize initialization of this module
107+
$instance.Init();
108+
Write-Information "Loaded Module '$($instance.Name)'"
109+
# endregion

src/HanaOnAzure/MSSharedLibKey.snk

160 Bytes
Binary file not shown.

src/HanaOnAzure/build-module.ps1

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
param([switch]$Isolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs)
15+
$ErrorActionPreference = 'Stop'
16+
17+
if($PSEdition -ne 'Core') {
18+
Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.'
19+
}
20+
21+
if(-not $Isolated -and -not $Debugger) {
22+
Write-Host -ForegroundColor Green 'Creating isolated process...'
23+
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
24+
& "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated
25+
26+
if($LastExitCode -ne 0) {
27+
# Build failed. Don't attempt to run the module.
28+
return
29+
}
30+
31+
if($Test) {
32+
. (Join-Path $PSScriptRoot 'test-module.ps1')
33+
if($LastExitCode -ne 0) {
34+
# Tests failed. Don't attempt to run the module.
35+
return
36+
}
37+
}
38+
39+
if($Docs) {
40+
. (Join-Path $PSScriptRoot 'generate-help.ps1')
41+
if($LastExitCode -ne 0) {
42+
# Docs generation failed. Don't attempt to run the module.
43+
return
44+
}
45+
}
46+
47+
if($Pack) {
48+
. (Join-Path $PSScriptRoot 'pack-module.ps1')
49+
if($LastExitCode -ne 0) {
50+
# Packing failed. Don't attempt to run the module.
51+
return
52+
}
53+
}
54+
55+
$runModulePath = Join-Path $PSScriptRoot 'run-module.ps1'
56+
if($Code) {
57+
. $runModulePath -Code
58+
} elseif($Run) {
59+
. $runModulePath
60+
} else {
61+
Write-Host -ForegroundColor Cyan "To run this module in an isolated PowerShell session, run the 'run-module.ps1' script or provide the '-Run' parameter to this script."
62+
}
63+
return
64+
}
65+
66+
$binFolder = Join-Path $PSScriptRoot 'bin'
67+
$objFolder = Join-Path $PSScriptRoot 'obj'
68+
69+
if(-not $Debugger) {
70+
Write-Host -ForegroundColor Green 'Cleaning build folders...'
71+
$null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder
72+
73+
if((Test-Path $binFolder) -or (Test-Path $objFolder)) {
74+
Write-Host -ForegroundColor Cyan 'Did you forget to exit your isolated module session before rebuilding?'
75+
Write-Error 'Unable to clean ''bin'' or ''obj'' folder. A process may have an open handle.'
76+
}
77+
78+
Write-Host -ForegroundColor Green 'Compiling module...'
79+
$buildConfig = 'Debug'
80+
if($Release) {
81+
$buildConfig = 'Release'
82+
}
83+
dotnet publish $PSScriptRoot --verbosity quiet --configuration $buildConfig /nologo
84+
if($LastExitCode -ne 0) {
85+
Write-Error 'Compilation failed.'
86+
}
87+
88+
$null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release')
89+
}
90+
91+
$dll = Join-Path $PSScriptRoot 'bin\Az.HanaOnAzure.private.dll'
92+
if(-not (Test-Path $dll)) {
93+
Write-Error "Unable to find output assembly in '$binFolder'."
94+
}
95+
96+
# Load DLL to use build-time cmdlets
97+
$null = Import-Module -Name $dll
98+
99+
$modulePaths = $dll
100+
$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.HanaOnAzure.custom.psm1'
101+
if(Test-Path $customPsm1) {
102+
$modulePaths = @($dll, $customPsm1)
103+
}
104+
105+
$exportsFolder = Join-Path $PSScriptRoot 'exports'
106+
if(Test-Path $exportsFolder) {
107+
$null = Get-ChildItem -Path $exportsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
108+
}
109+
$null = New-Item -ItemType Directory -Force -Path $exportsFolder
110+
111+
$internalFolder = Join-Path $PSScriptRoot 'internal'
112+
if(Test-Path $internalFolder) {
113+
$null = Get-ChildItem -Path $internalFolder -Recurse -Exclude '*.psm1', 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
114+
}
115+
$null = New-Item -ItemType Directory -Force -Path $internalFolder
116+
117+
$psd1 = Join-Path $PSScriptRoot './Az.HanaOnAzure.psd1'
118+
$guid = Get-ModuleGuid -Psd1Path $psd1
119+
$moduleName = 'Az.HanaOnAzure'
120+
$examplesFolder = Join-Path $PSScriptRoot 'examples'
121+
$null = New-Item -ItemType Directory -Force -Path $examplesFolder
122+
123+
if($NoDocs) {
124+
Write-Host -ForegroundColor Green 'Creating exports...'
125+
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs
126+
} else {
127+
Write-Host -ForegroundColor Green 'Creating exports and docs...'
128+
$moduleDescription = 'Microsoft Azure PowerShell: HanaOn cmdlets'
129+
$docsFolder = Join-Path $PSScriptRoot 'docs'
130+
if(Test-Path $docsFolder) {
131+
$null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
132+
}
133+
$null = New-Item -ItemType Directory -Force -Path $docsFolder
134+
Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid
135+
}
136+
137+
Write-Host -ForegroundColor Green 'Creating format.ps1xml...'
138+
$formatPs1xml = Join-Path $PSScriptRoot './Az.HanaOnAzure.format.ps1xml'
139+
Export-FormatPs1xml -FilePath $formatPs1xml
140+
141+
Write-Host -ForegroundColor Green 'Creating psd1...'
142+
$customFolder = Join-Path $PSScriptRoot 'custom'
143+
Export-Psd1 -ExportsFolder $exportsFolder -CustomFolder $customFolder -Psd1Path $psd1 -ModuleGuid $guid
144+
145+
Write-Host -ForegroundColor Green 'Creating test stubs...'
146+
$testFolder = Join-Path $PSScriptRoot 'test'
147+
$null = New-Item -ItemType Directory -Force -Path $testFolder
148+
Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFolder $testFolder
149+
150+
Write-Host -ForegroundColor Green 'Creating example stubs...'
151+
Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder
152+
153+
Write-Host -ForegroundColor Green '-------------Done-------------'
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
param([switch]$Isolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources)
15+
$ErrorActionPreference = 'Stop'
16+
17+
if(-not $Isolated) {
18+
Write-Host -ForegroundColor Green 'Creating isolated process...'
19+
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
20+
& "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated
21+
return
22+
}
23+
24+
function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) {
25+
if($predicate) {
26+
$module = Get-Module -ListAvailable -Name $moduleName
27+
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) {
28+
$null = New-Item -ItemType Directory -Force -Path $path
29+
Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..."
30+
if ($requiredVersion) {
31+
Find-Module -Name $moduleName -RequiredVersion $requiredVersion -Repository PSGallery | Save-Module -Path $path
32+
}elseif($versionMinimum) {
33+
Find-Module -Name $moduleName -MinimumVersion $versionMinimum -Repository PSGallery | Save-Module -Path $path
34+
} else {
35+
Find-Module -Name $moduleName -Repository PSGallery | Save-Module -Path $path
36+
}
37+
}
38+
}
39+
}
40+
41+
$ProgressPreference = 'SilentlyContinue'
42+
$all = (@($Accounts.IsPresent, $Pester.IsPresent) | Select-Object -Unique | Measure-Object).Count -eq 1
43+
44+
$localModulesPath = Join-Path $PSScriptRoot 'generated\modules'
45+
if(Test-Path -Path $localModulesPath) {
46+
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
47+
}
48+
49+
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.8.1'
50+
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1'
51+
52+
$tools = Join-Path $PSScriptRoot 'tools'
53+
$resourceDir = Join-Path $tools 'Resources'
54+
$resourceModule = Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psm1'
55+
56+
if ($Resources.IsPresent -and (-not (Test-Path -Path $resourceModule))) {
57+
Write-Host -ForegroundColor Green "Building local Resource module used for test..."
58+
Set-Location $resourceDir
59+
$null = autorest-beta .\readme.md --output-folder=$HOME/.PSSharedModules/Resources
60+
$null = Copy-Item custom/* $HOME/.PSSharedModules/Resources/custom/
61+
Set-Location $HOME/.PSSharedModules/Resources
62+
$null = .\build-module.ps1
63+
Set-Location $PSScriptRoot
64+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# region Generated
2+
# Load the private module dll
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.HanaOnAzure.private.dll')
4+
5+
# Load the internal module
6+
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.HanaOnAzure.internal.psm1'
7+
if(Test-Path $internalModulePath) {
8+
$null = Import-Module -Name $internalModulePath
9+
}
10+
11+
# Export nothing to clear implicit exports
12+
Export-ModuleMember
13+
14+
# Export script cmdlets
15+
Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
16+
Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias)
17+
# endregion

0 commit comments

Comments
 (0)