Skip to content

Commit 2a7c1d4

Browse files
authored
Make Sha256Checksum optional in New-AzImageBuilderCustomizerObject (#12179)
Co-authored-by: wyunchi-ms <[email protected]>
1 parent 29fd844 commit 2a7c1d4

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

src/ImageBuilder/custom/Az.ImageBuilder.custom.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# region Generated
22
# Load the private module dll
3-
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '../bin/Az.ImageBuilder.private.dll')
3+
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.ImageBuilder.private.dll')
44

55
# Load the internal module
6-
$internalModulePath = Join-Path $PSScriptRoot '../internal/Az.ImageBuilder.internal.psm1'
6+
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.ImageBuilder.internal.psm1'
77
if(Test-Path $internalModulePath) {
88
$null = Import-Module -Name $internalModulePath
99
}

src/ImageBuilder/custom/New-AzImageBuilderCustomizerObject.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function New-AzImageBuilderCustomizerObject {
4141
[Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
4242
[string]
4343
${ScriptUri},
44-
[Parameter(ParameterSetName='ShellCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
45-
[Parameter(ParameterSetName='FileCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
46-
[Parameter(ParameterSetName='PowerShellCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
44+
[Parameter(ParameterSetName='ShellCustomizer', HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
45+
[Parameter(ParameterSetName='FileCustomizer', HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
46+
[Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
4747
[Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
4848
[string]
4949
${Sha256Checksum},

src/ImageBuilder/custom/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Custom
2-
This directory contains custom implementation for non-generated cmdlets for the `Az.ImageBuilder` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.ImageBuilder.custom.psm1`. This file should not be modified.
2+
This directory contains custom implementation for non-generated cmdlets for the `Az.ImageBuilder` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.ImageBuilder.custom.psm1`. This file should not be modified.
33

44
## Info
55
- Modifiable: yes
@@ -15,10 +15,10 @@ For C# cmdlets, they are compiled with the rest of the generated low-level cmdle
1515
For script cmdlets, these are loaded via the `Az.ImageBuilder.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build.
1616

1717
## Purpose
18-
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder.
18+
This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder.
1919

2020
## Usage
21-
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
21+
The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters:
2222
- Break
2323
- DefaultProfile
2424
- HttpPipelineAppend
@@ -36,6 +36,6 @@ For processing the cmdlets, we've created some additional attributes:
3636
- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.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.ImageBuilder`.
3838
- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.InternalExportAttribute`
39-
- Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.ImageBuilder`. For more information, see [readme.md](../internal/readme.md) in the `../internal` folder.
39+
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.ImageBuilder`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder.
4040
- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.ProfileAttribute`
4141
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.

src/ImageBuilder/docs/Az.ImageBuilder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.ImageBuilder
3-
Module Guid: aab8c8e8-8e05-4f5f-af3c-0f2aa5cc1648
3+
Module Guid: bdedc683-d9b6-41ea-b310-d068b8c72305
44
Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder
55
Help Version: 1.0.0.0
66
Locale: en-US

src/ImageBuilder/docs/New-AzImageBuilderCustomizerObject.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ Describes a unit of image customization
1414

1515
### ShellCustomizer (Default)
1616
```
17-
New-AzImageBuilderCustomizerObject -CustomizerName <String> -Sha256Checksum <String> -ShellCustomizer
18-
[-Inline <String[]>] [-ScriptUri <String>] [<CommonParameters>]
17+
New-AzImageBuilderCustomizerObject -CustomizerName <String> -ShellCustomizer [-Inline <String[]>]
18+
[-ScriptUri <String>] [-Sha256Checksum <String>] [<CommonParameters>]
1919
```
2020

2121
### FileCustomizer
2222
```
23-
New-AzImageBuilderCustomizerObject -CustomizerName <String> -FileCustomizer -Sha256Checksum <String>
24-
[-Destination <String>] [-SourceUri <String>] [<CommonParameters>]
23+
New-AzImageBuilderCustomizerObject -CustomizerName <String> -FileCustomizer [-Destination <String>]
24+
[-Sha256Checksum <String>] [-SourceUri <String>] [<CommonParameters>]
2525
```
2626

2727
### PowerShellCustomizer
2828
```
29-
New-AzImageBuilderCustomizerObject -CustomizerName <String> -PowerShellCustomizer -Sha256Checksum <String>
30-
[-Inline <String[]>] [-RunElevated <Boolean>] [-ScriptUri <String>] [-ValidExitCode <Int32[]>]
29+
New-AzImageBuilderCustomizerObject -CustomizerName <String> -PowerShellCustomizer [-Inline <String[]>]
30+
[-RunElevated <Boolean>] [-ScriptUri <String>] [-Sha256Checksum <String>] [-ValidExitCode <Int32[]>]
3131
[<CommonParameters>]
3232
```
3333

@@ -320,7 +320,7 @@ Type: System.String
320320
Parameter Sets: FileCustomizer, PowerShellCustomizer, ShellCustomizer
321321
Aliases:
322322

323-
Required: True
323+
Required: False
324324
Position: Named
325325
Default value: None
326326
Accept pipeline input: False

src/ImageBuilder/docs/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Docs
2-
This directory contains the documentation of the cmdlets for the `Az.ImageBuilder` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overriden on regeneration*. To update documentation examples, please use the `../examples` folder.
2+
This directory contains the documentation of the cmdlets for the `Az.ImageBuilder` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overriden on regeneration*. To update documentation examples, please use the `..\examples` folder.
33

44
## Info
55
- Modifiable: no
@@ -8,4 +8,4 @@ This directory contains the documentation of the cmdlets for the `Az.ImageBuilde
88
- Packaged: yes
99

1010
## Details
11-
The process of documentation generation loads `Az.ImageBuilder` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://docs.microsoft.com/en-us/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.ImageBuilder` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://docs.microsoft.com/en-us/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/ImageBuilder/test/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Test
2-
This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `../custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets.
2+
This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets.
33

44
## Info
55
- Modifiable: yes

0 commit comments

Comments
 (0)