Skip to content

Commit 577ff8d

Browse files
Migrate Compute from generation to main (#20788)
* Move Compute to main * Update ChangeLog.md --------- Co-authored-by: Yeming Liu <[email protected]>
1 parent 0997c93 commit 577ff8d

20 files changed

+121
-36
lines changed

src/Compute/Compute.Autorest/Az.Compute.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
}
3434

3535
if(-not $accountsModule) {
36-
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://learn.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
36+
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. For installation instructions, please see: https://docs.microsoft.com/powershell/azure/install-az-ps" -ErrorAction Stop
3737
} elseif (($accountsModule.Version -lt [System.Version]'2.7.5') -and (-not $localAccounts)) {
3838
Write-Error "`nThis module requires $accountsName version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing 'test-module.ps1'. 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
3939
}

src/Compute/Compute.Autorest/custom/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ These provide functionality to our HTTP pipeline and other useful features. In s
3232
### Attributes
3333
For processing the cmdlets, we've created some additional attributes:
3434
- `Microsoft.Azure.PowerShell.Cmdlets.Compute.DescriptionAttribute`
35-
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
35+
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
3636
- `Microsoft.Azure.PowerShell.Cmdlets.Compute.DoNotExportAttribute`
3737
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Compute`.
3838
- `Microsoft.Azure.PowerShell.Cmdlets.Compute.InternalExportAttribute`

src/Compute/Compute.Autorest/custom/Set-AzVMRunCommand_ScriptLocalPath.ps1

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,50 @@ function Set-AzVMRunCommand_ScriptLocalPath {
180180
if ($PSBoundParameters.ContainsKey("ScriptLocalPath"))
181181
{
182182
# Read Local File and add
183-
$script = (Get-Content -Path $ScriptLocalPath) -join ";"
183+
$script = ""
184+
if ((Get-ChildItem $scriptLocalPath | Select-Object Extension).Extension -eq ".sh"){
185+
foreach ($line in Get-Content -Path $scriptLocalPath){
186+
$words = $line.trim().split()
187+
$commentFound = $false
188+
foreach ($word in $words){
189+
if ($word[0] -eq "#" -and $commentFound -eq $false){
190+
$commentFound = $true
191+
$script += "``" + $word + " "
192+
}
193+
else{
194+
$script += $word + " "
195+
}
196+
}
197+
$script = $script.trim()
198+
#close
199+
if ($commentFound){
200+
$script += "``"
201+
}
202+
$script += ";"
203+
}
204+
}
205+
else{
206+
foreach ($line in Get-Content -Path $scriptLocalPath){
207+
$words = $line.trim().split()
208+
$commentFound = $false
209+
foreach ($word in $words){
210+
if ($word[0] -eq "#" -and $commentFound -eq $false){
211+
$commentFound = $true
212+
$script += "<" + $word + " "
213+
}
214+
else{
215+
$script += $word + " "
216+
}
217+
}
218+
$script = $script.trim()
219+
#close
220+
if ($commentFound){
221+
$script += "#>"
222+
}
223+
$script += ";"
224+
}
225+
}
226+
184227
$PSBoundParameters.Add("SourceScript", $script)
185228
# If necessary, remove the -ParameterA parameter from the dictionary of bound parameters
186229
$null = $PSBoundParameters.Remove("ScriptLocalPath")

src/Compute/Compute.Autorest/custom/Set-AzVmssVMRunCommand_ScriptLocalPath.ps1

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,50 @@ function Set-AzVmssVMRunCommand_ScriptLocalPath {
185185
process {
186186
if ($PSBoundParameters.ContainsKey("ScriptLocalPath"))
187187
{
188-
# Read Local File and add
189-
$script = (Get-Content -Path $ScriptLocalPath) -join ";"
188+
# Read Local File and add
189+
$script = ""
190+
if ((Get-ChildItem $scriptLocalPath | Select-Object Extension).Extension -eq ".sh"){
191+
foreach ($line in Get-Content -Path $scriptLocalPath){
192+
$words = $line.trim().split()
193+
$commentFound = $false
194+
foreach ($word in $words){
195+
if ($word[0] -eq "#" -and $commentFound -eq $false){
196+
$commentFound = $true
197+
$script += "``" + $word + " "
198+
}
199+
else{
200+
$script += $word + " "
201+
}
202+
}
203+
$script = $script.trim()
204+
#close
205+
if ($commentFound){
206+
$script += "``"
207+
}
208+
$script += ";"
209+
}
210+
}
211+
else{
212+
foreach ($line in Get-Content -Path $scriptLocalPath){
213+
$words = $line.trim().split()
214+
$commentFound = $false
215+
foreach ($word in $words){
216+
if ($word[0] -eq "#" -and $commentFound -eq $false){
217+
$commentFound = $true
218+
$script += "<" + $word + " "
219+
}
220+
else{
221+
$script += $word + " "
222+
}
223+
}
224+
$script = $script.trim()
225+
#close
226+
if ($commentFound){
227+
$script += "#>"
228+
}
229+
$script += ";"
230+
}
231+
}
190232
$PSBoundParameters.Add("SourceScript", $script)
191233
# If necessary, remove the -ParameterA parameter from the dictionary of bound parameters
192234
$null = $PSBoundParameters.Remove("ScriptLocalPath")

src/Compute/Compute.Autorest/docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.Compute` mo
88
- Packaged: yes
99

1010
## Details
11-
The process of documentation generation loads `Az.Compute` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder.
11+
The process of documentation generation loads `Az.Compute` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder.

src/Compute/Compute.Autorest/exports/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Exports
2-
This directory contains the cmdlets *exported by* `Az.Compute`. No other cmdlets in this repository are directly exported. What that means is the `Az.Compute` module will run [Export-ModuleMember](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation.
2+
This directory contains the cmdlets *exported by* `Az.Compute`. No other cmdlets in this repository are directly exported. What that means is the `Az.Compute` module will run [Export-ModuleMember](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation.
33

44
## Info
55
- Modifiable: no
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"autorest_core": "3.9.3",
3-
"swagger_commit": "c583b05741fadfdca116be3b9ccb1c4be8a73258",
2+
"autorest_modelerfour": "4.15.414",
43
"autorest_powershell": "3.0.498",
4+
"autorest_core": "3.9.4",
55
"autorest": "`-- (empty)",
6-
"node": "v14.15.5",
7-
"autorest_modelerfour": "4.15.414"
6+
"swagger_commit": "18e83e24c36eed85a240103b476de0220ace7f84",
7+
"node": "v14.15.5"
88
}

src/Compute/Compute.Autorest/how-to.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To generate documentation, the process is now integrated into the `build-module.
1414
To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder.
1515

1616
## Packing `Az.Compute`
17-
To pack `Az.Compute` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://learn.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
17+
To pack `Az.Compute` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team.
1818

1919
## Module Script Details
2020
There are multiple scripts created for performing different actions for developing `Az.Compute`.

src/Compute/Compute.Autorest/internal/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This directory contains a module to handle *internal only* cmdlets. Cmdlets that
88
- Packaged: yes
99

1010
## Details
11-
The `Az.Compute.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.Compute`. Instead, this sub-module is imported by the `..\custom\Az.Compute.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.Compute.internal\Get-Example` would call an internal cmdlet named `Get-Example`.
11+
The `Az.Compute.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.Compute`. Instead, this sub-module is imported by the `..\custom\Az.Compute.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.Compute.internal\Get-Example` would call an internal cmdlet named `Get-Example`.
1212

1313
## Purpose
1414
This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.Compute`.

src/Compute/Compute/Az.Compute.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 1/6/2023
6+
# Generated on: 1/30/2023
77
#
88

99
@{
@@ -220,7 +220,7 @@ PrivateData = @{
220220
PSData = @{
221221

222222
# Tags applied to this module. These help with module discovery in online galleries.
223-
Tags = 'Azure','ResourceManager','ARM','Compute','IAAS','VM','VirtualMachine'
223+
Tags = 'Azure', 'ResourceManager', 'ARM', 'Compute', 'IAAS', 'VM', 'VirtualMachine'
224224

225225
# A URL to the license for this module.
226226
LicenseUri = 'https://aka.ms/azps-license'
@@ -248,7 +248,7 @@ PrivateData = @{
248248

249249
} # End of PSData hashtable
250250

251-
} # End of PrivateData hashtable
251+
} # End of PrivateData hashtable
252252

253253
# HelpInfo URI of this module
254254
# HelpInfoURI = ''

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* Filled in missing parameter descriptions across multiple parameters and improved some existing parameter descriptions.
2626
* Updated Compute PS to use the new .Net SDK version 59.0.0. This includes an approved breaking change for a non-functional feature.
2727
- The type of the property `Source` of type `Microsoft.Azure.Management.Compute.Models.GalleryDataDiskImage`, `Microsoft.Azure.Management.Compute.Models.GalleryOSDiskImage`, and `Microsoft.Azure.Management.Compute.Models.GalleryImageVersionStorageProfile` has changed from `Microsoft.Azure.Management.Compute.Models.GalleryArtifactVersionSource` to `Microsoft.Azure.Management.Compute.Models.GalleryDiskImageSource`.
28+
* Updated Set-AzVMRunCommand and Set-AzVmssRunCommand ScriptLocalPath parameter set to work with Linux and with files that have comments.
2829
* Added `-TargetExtendedLocation` parameter to `New-AzGalleryImageVersion` and `Update-AzGalleryImageVersion`
2930
* Added `-AllowDeletionOfReplicatedLocation` to `Update-AzGalleryImageVersion`
3031

src/Compute/Compute/help/Get-AzGalleryApplication.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ To create the parameters described below, construct a hash table containing the
165165
`INPUTOBJECT <IComputeIdentity>`: Identity Parameter
166166
- `[CommandId <String>]`: The command id.
167167
- `[GalleryApplicationName <String>]`: The name of the gallery Application Definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
168-
- `[GalleryApplicationVersionName <String>]`: The name of the gallery Application Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: `<MajorVersion>.<MinorVersion>.<Patch>`
168+
- `[GalleryApplicationVersionName <String>]`: The name of the gallery Application Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>
169169
- `[GalleryImageName <String>]`: The name of the gallery image definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
170-
- `[GalleryImageVersionName <String>]`: The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: `<MajorVersion>.<MinorVersion>.<Patch>`
170+
- `[GalleryImageVersionName <String>]`: The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>
171171
- `[GalleryName <String>]`: The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods allowed in the middle. The maximum length is 80 characters.
172172
- `[Id <String>]`: Resource identity path
173173
- `[InstanceId <String>]`: The instance ID of the virtual machine.

src/Compute/Compute/help/Get-AzGalleryApplicationVersion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ To create the parameters described below, construct a hash table containing the
197197
`INPUTOBJECT <IComputeIdentity>`: Identity Parameter
198198
- `[CommandId <String>]`: The command id.
199199
- `[GalleryApplicationName <String>]`: The name of the gallery Application Definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
200-
- `[GalleryApplicationVersionName <String>]`: The name of the gallery Application Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: `<MajorVersion>.<MinorVersion>.<Patch>`
200+
- `[GalleryApplicationVersionName <String>]`: The name of the gallery Application Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>
201201
- `[GalleryImageName <String>]`: The name of the gallery image definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
202-
- `[GalleryImageVersionName <String>]`: The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: `<MajorVersion>.<MinorVersion>.<Patch>`
202+
- `[GalleryImageVersionName <String>]`: The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>
203203
- `[GalleryName <String>]`: The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods allowed in the middle. The maximum length is 80 characters.
204204
- `[Id <String>]`: Resource identity path
205205
- `[InstanceId <String>]`: The instance ID of the virtual machine.

0 commit comments

Comments
 (0)