diff --git a/src/ImageBuilder/Az.ImageBuilder.format.ps1xml b/src/ImageBuilder/Az.ImageBuilder.format.ps1xml
new file mode 100644
index 000000000000..a2da24e8289d
--- /dev/null
+++ b/src/ImageBuilder/Az.ImageBuilder.format.ps1xml
@@ -0,0 +1,1283 @@
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.ImageBuilderIdentity
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.ImageBuilderIdentity
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ImageTemplateName
+
+
+ ResourceGroupName
+
+
+ RunOutputName
+
+
+ SubscriptionId
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Message
+
+
+ Target
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBase
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBase
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Message
+
+
+ Target
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClientId
+
+
+ PrincipalId
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Location
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RunOutputName
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags
+
+
+
+
+
+
+
+
+
+
+
+ Item
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateFileCustomizer
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateFileCustomizer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Destination
+
+
+ Sha256Checksum
+
+
+ SourceUri
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity
+
+
+
+
+
+
+
+
+
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatus
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatus
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ EndTime
+
+
+ Message
+
+
+ RunState
+
+
+ RunSubState
+
+
+ StartTime
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateListResult
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateListResult
+
+
+
+
+
+
+
+
+
+
+
+ NextLink
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageDistributor
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageDistributor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RunOutputName
+
+
+ Type
+
+
+ ImageId
+
+
+ Location
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageSource
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageSource
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Type
+
+
+ ImageId
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePlatformImageSource
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePlatformImageSource
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Type
+
+
+ Offer
+
+
+ Publisher
+
+
+ Sku
+
+
+ Version
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePowerShellCustomizer
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePowerShellCustomizer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Inline
+
+
+ RunElevated
+
+
+ ScriptUri
+
+
+ Sha256Checksum
+
+
+ ValidExitCode
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ BuildTimeoutInMinute
+
+
+ ProvisioningState
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateRestartCustomizer
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateRestartCustomizer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ RestartCheckCommand
+
+
+ RestartCommand
+
+
+ RestartTimeout
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageDistributor
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageDistributor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RunOutputName
+
+
+ Type
+
+
+ ExcludeFromLatest
+
+
+ GalleryImageId
+
+
+ ReplicationRegion
+
+
+ StorageAccountType
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageVersionSource
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageVersionSource
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Type
+
+
+ ImageVersionId
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateShellCustomizer
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateShellCustomizer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Inline
+
+
+ ScriptUri
+
+
+ Sha256Checksum
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource
+
+
+
+
+
+
+
+
+
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTags
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTags
+
+
+
+
+
+
+
+
+
+
+
+ Item
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVhdDistributor
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVhdDistributor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RunOutputName
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfile
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OSDiskSizeGb
+
+
+ VMSize
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateWindowsUpdateCustomizer
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateWindowsUpdateCustomizer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Filter
+
+
+ SearchCriterion
+
+
+ UpdateLimit
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ErrorDetail
+
+
+ ExceptionType
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Operation
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Operation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IsDataAction
+
+
+ Name
+
+
+ Origin
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplay
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplay
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Description
+
+
+ Operation
+
+
+ Provider
+
+
+ Resource
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationListResult
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationListResult
+
+
+
+
+
+
+
+
+
+
+
+ NextLink
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PlanName
+
+
+ PlanProduct
+
+
+ PlanPublisher
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningError
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningError
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Message
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Resource
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Resource
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Location
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTags
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTags
+
+
+
+
+
+
+
+
+
+
+
+ Item
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutput
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutput
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputCollection
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputCollection
+
+
+
+
+
+
+
+
+
+
+
+ NextLink
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputProperties
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputProperties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ArtifactId
+
+
+ ArtifactUri
+
+
+ ProvisioningState
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.SubResource
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.SubResource
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfig
+
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfig
+
+
+
+
+
+
+
+
+
+
+
+ SubnetId
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/ImageBuilder/Az.ImageBuilder.psd1 b/src/ImageBuilder/Az.ImageBuilder.psd1
new file mode 100644
index 000000000000..59f60acbe6ac
--- /dev/null
+++ b/src/ImageBuilder/Az.ImageBuilder.psd1
@@ -0,0 +1,24 @@
+@{
+ GUID = 'bdedc683-d9b6-41ea-b310-d068b8c72305'
+ RootModule = './Az.ImageBuilder.psm1'
+ ModuleVersion = '0.1.0'
+ CompatiblePSEditions = 'Core', 'Desktop'
+ Author = 'Microsoft Corporation'
+ CompanyName = 'Microsoft Corporation'
+ Copyright = 'Microsoft Corporation. All rights reserved.'
+ Description = 'Microsoft Azure PowerShell: ImageBuilder cmdlets'
+ PowerShellVersion = '5.1'
+ DotNetFrameworkVersion = '4.7.2'
+ RequiredAssemblies = './bin/Az.ImageBuilder.private.dll'
+ FormatsToProcess = './Az.ImageBuilder.format.ps1xml'
+ FunctionsToExport = 'Get-AzImageBuilderRunOutput', 'Get-AzImageBuilderTemplate', 'New-AzImageBuilderCustomizerObject', 'New-AzImageBuilderDistributorObject', 'New-AzImageBuilderSourceObject', 'New-AzImageBuilderTemplate', 'Remove-AzImageBuilderTemplate', 'Start-AzImageBuilderTemplate', 'Stop-AzImageBuilderTemplate', '*'
+ AliasesToExport = '*'
+ PrivateData = @{
+ PSData = @{
+ Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'ImageBuilder'
+ LicenseUri = 'https://aka.ms/azps-license'
+ ProjectUri = 'https://github.com/Azure/azure-powershell'
+ ReleaseNotes = ''
+ }
+ }
+}
diff --git a/src/ImageBuilder/Az.ImageBuilder.psm1 b/src/ImageBuilder/Az.ImageBuilder.psm1
new file mode 100644
index 000000000000..274a190a9799
--- /dev/null
+++ b/src/ImageBuilder/Az.ImageBuilder.psm1
@@ -0,0 +1,109 @@
+# region Generated
+ # ----------------------------------------------------------------------------------
+ #
+ # Copyright Microsoft Corporation
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ # http://www.apache.org/licenses/LICENSE-2.0
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ # ----------------------------------------------------------------------------------
+ # Load required Az.Accounts module
+ $accountsName = 'Az.Accounts'
+ $accountsModule = Get-Module -Name $accountsName
+ if(-not $accountsModule) {
+ $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules'
+ if(Test-Path -Path $localAccountsPath) {
+ $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1
+ if($localAccounts) {
+ $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru
+ }
+ }
+ if(-not $accountsModule) {
+ $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.7.4' } | Measure-Object).Count -gt 0
+ if($hasAdequateVersion) {
+ $accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.7.4 -Scope Global -PassThru
+ }
+ }
+ }
+
+ if(-not $accountsModule) {
+ Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
+ } elseif (($accountsModule.Version -lt [System.Version]'1.7.4') -and (-not $localAccounts)) {
+ Write-Error "`nThis module requires $accountsName version 1.7.4 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
+ }
+ Write-Information "Loaded Module '$($accountsModule.Name)'"
+
+ # Load the private module dll
+ $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.ImageBuilder.private.dll')
+
+ # Get the private module's instance
+ $instance = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module]::Instance
+
+ # Ask for the shared functionality table
+ $VTable = Register-AzModule
+
+ # Tweaks the pipeline on module load
+ $instance.OnModuleLoad = $VTable.OnModuleLoad
+
+ # Tweaks the pipeline per call
+ $instance.OnNewRequest = $VTable.OnNewRequest
+
+ # Gets shared parameter values
+ $instance.GetParameterValue = $VTable.GetParameterValue
+
+ # Allows shared module to listen to events from this module
+ $instance.EventListener = $VTable.EventListener
+
+ # Gets shared argument completers
+ $instance.ArgumentCompleter = $VTable.ArgumentCompleter
+
+ # The name of the currently selected Azure profile
+ $instance.ProfileName = $VTable.ProfileName
+
+
+ # Load the custom module
+ $customModulePath = Join-Path $PSScriptRoot './custom/Az.ImageBuilder.custom.psm1'
+ if(Test-Path $customModulePath) {
+ $null = Import-Module -Name $customModulePath
+ }
+
+ # Export nothing to clear implicit exports
+ Export-ModuleMember
+
+ # Export proxy cmdlet scripts
+ $exportsPath = Join-Path $PSScriptRoot './exports'
+ $directories = Get-ChildItem -Directory -Path $exportsPath
+ $profileDirectory = $null
+ if($instance.ProfileName) {
+ if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) {
+ $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName }
+ } else {
+ # Don't export anything if the profile doesn't exist for the module
+ $exportsPath = $null
+ Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded."
+ }
+ } elseif(($directories | Measure-Object).Count -gt 0) {
+ # Load the last folder if no profile is selected
+ $profileDirectory = $directories | Select-Object -Last 1
+ }
+
+ if($profileDirectory) {
+ Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
+ $exportsPath = $profileDirectory.FullName
+ }
+
+ if($exportsPath) {
+ Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath
+ Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias)
+ }
+
+ # Finalize initialization of this module
+ $instance.Init();
+ Write-Information "Loaded Module '$($instance.Name)'"
+# endregion
diff --git a/src/ImageBuilder/MSSharedLibKey.snk b/src/ImageBuilder/MSSharedLibKey.snk
new file mode 100644
index 000000000000..695f1b38774e
Binary files /dev/null and b/src/ImageBuilder/MSSharedLibKey.snk differ
diff --git a/src/ImageBuilder/build-module.ps1 b/src/ImageBuilder/build-module.ps1
new file mode 100644
index 000000000000..0314441ea2d7
--- /dev/null
+++ b/src/ImageBuilder/build-module.ps1
@@ -0,0 +1,153 @@
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+param([switch]$Isolated, [switch]$Run, [switch]$Test, [switch]$Docs, [switch]$Pack, [switch]$Code, [switch]$Release, [switch]$Debugger, [switch]$NoDocs)
+$ErrorActionPreference = 'Stop'
+
+if($PSEdition -ne 'Core') {
+ Write-Error 'This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell.'
+}
+
+if(-not $Isolated -and -not $Debugger) {
+ Write-Host -ForegroundColor Green 'Creating isolated process...'
+ $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
+ & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated
+
+ if($LastExitCode -ne 0) {
+ # Build failed. Don't attempt to run the module.
+ return
+ }
+
+ if($Test) {
+ . (Join-Path $PSScriptRoot 'test-module.ps1')
+ if($LastExitCode -ne 0) {
+ # Tests failed. Don't attempt to run the module.
+ return
+ }
+ }
+
+ if($Docs) {
+ . (Join-Path $PSScriptRoot 'generate-help.ps1')
+ if($LastExitCode -ne 0) {
+ # Docs generation failed. Don't attempt to run the module.
+ return
+ }
+ }
+
+ if($Pack) {
+ . (Join-Path $PSScriptRoot 'pack-module.ps1')
+ if($LastExitCode -ne 0) {
+ # Packing failed. Don't attempt to run the module.
+ return
+ }
+ }
+
+ $runModulePath = Join-Path $PSScriptRoot 'run-module.ps1'
+ if($Code) {
+ . $runModulePath -Code
+ } elseif($Run) {
+ . $runModulePath
+ } else {
+ 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."
+ }
+ return
+}
+
+$binFolder = Join-Path $PSScriptRoot 'bin'
+$objFolder = Join-Path $PSScriptRoot 'obj'
+
+if(-not $Debugger) {
+ Write-Host -ForegroundColor Green 'Cleaning build folders...'
+ $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path $binFolder, $objFolder
+
+ if((Test-Path $binFolder) -or (Test-Path $objFolder)) {
+ Write-Host -ForegroundColor Cyan 'Did you forget to exit your isolated module session before rebuilding?'
+ Write-Error 'Unable to clean ''bin'' or ''obj'' folder. A process may have an open handle.'
+ }
+
+ Write-Host -ForegroundColor Green 'Compiling module...'
+ $buildConfig = 'Debug'
+ if($Release) {
+ $buildConfig = 'Release'
+ }
+ dotnet publish $PSScriptRoot --verbosity quiet --configuration $buildConfig /nologo
+ if($LastExitCode -ne 0) {
+ Write-Error 'Compilation failed.'
+ }
+
+ $null = Remove-Item -Recurse -ErrorAction SilentlyContinue -Path (Join-Path $binFolder 'Debug'), (Join-Path $binFolder 'Release')
+}
+
+$dll = Join-Path $PSScriptRoot 'bin\Az.ImageBuilder.private.dll'
+if(-not (Test-Path $dll)) {
+ Write-Error "Unable to find output assembly in '$binFolder'."
+}
+
+# Load DLL to use build-time cmdlets
+$null = Import-Module -Name $dll
+
+$modulePaths = $dll
+$customPsm1 = Join-Path $PSScriptRoot 'custom\Az.ImageBuilder.custom.psm1'
+if(Test-Path $customPsm1) {
+ $modulePaths = @($dll, $customPsm1)
+}
+
+$exportsFolder = Join-Path $PSScriptRoot 'exports'
+if(Test-Path $exportsFolder) {
+ $null = Get-ChildItem -Path $exportsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
+}
+$null = New-Item -ItemType Directory -Force -Path $exportsFolder
+
+$internalFolder = Join-Path $PSScriptRoot 'internal'
+if(Test-Path $internalFolder) {
+ $null = Get-ChildItem -Path $internalFolder -Recurse -Exclude '*.psm1', 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
+}
+$null = New-Item -ItemType Directory -Force -Path $internalFolder
+
+$psd1 = Join-Path $PSScriptRoot './Az.ImageBuilder.psd1'
+$guid = Get-ModuleGuid -Psd1Path $psd1
+$moduleName = 'Az.ImageBuilder'
+$examplesFolder = Join-Path $PSScriptRoot 'examples'
+$null = New-Item -ItemType Directory -Force -Path $examplesFolder
+
+if($NoDocs) {
+ Write-Host -ForegroundColor Green 'Creating exports...'
+ Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ExcludeDocs
+} else {
+ Write-Host -ForegroundColor Green 'Creating exports and docs...'
+ $moduleDescription = 'Microsoft Azure PowerShell: ImageBuilder cmdlets'
+ $docsFolder = Join-Path $PSScriptRoot 'docs'
+ if(Test-Path $docsFolder) {
+ $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
+ }
+ $null = New-Item -ItemType Directory -Force -Path $docsFolder
+ Export-ProxyCmdlet -ModuleName $moduleName -ModulePath $modulePaths -ExportsFolder $exportsFolder -InternalFolder $internalFolder -ModuleDescription $moduleDescription -DocsFolder $docsFolder -ExamplesFolder $examplesFolder -ModuleGuid $guid
+}
+
+Write-Host -ForegroundColor Green 'Creating format.ps1xml...'
+$formatPs1xml = Join-Path $PSScriptRoot './Az.ImageBuilder.format.ps1xml'
+Export-FormatPs1xml -FilePath $formatPs1xml
+
+Write-Host -ForegroundColor Green 'Creating psd1...'
+$customFolder = Join-Path $PSScriptRoot 'custom'
+Export-Psd1 -ExportsFolder $exportsFolder -CustomFolder $customFolder -Psd1Path $psd1 -ModuleGuid $guid
+
+Write-Host -ForegroundColor Green 'Creating test stubs...'
+$testFolder = Join-Path $PSScriptRoot 'test'
+$null = New-Item -ItemType Directory -Force -Path $testFolder
+Export-TestStub -ModuleName $moduleName -ExportsFolder $exportsFolder -OutputFolder $testFolder
+
+Write-Host -ForegroundColor Green 'Creating example stubs...'
+Export-ExampleStub -ExportsFolder $exportsFolder -OutputFolder $examplesFolder
+
+Write-Host -ForegroundColor Green '-------------Done-------------'
diff --git a/src/ImageBuilder/check-dependencies.ps1 b/src/ImageBuilder/check-dependencies.ps1
new file mode 100644
index 000000000000..5cd7ab5c808f
--- /dev/null
+++ b/src/ImageBuilder/check-dependencies.ps1
@@ -0,0 +1,62 @@
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+param([switch]$Isolated, [switch]$Accounts, [switch]$Pester, [switch]$Resources)
+$ErrorActionPreference = 'Stop'
+
+if(-not $Isolated) {
+ Write-Host -ForegroundColor Green 'Creating isolated process...'
+ $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
+ & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated
+ return
+}
+
+function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum) {
+ if($predicate) {
+ $module = Get-Module -ListAvailable -Name $moduleName
+ if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) {
+ $null = New-Item -ItemType Directory -Force -Path $path
+ Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..."
+ if($versionMinimum) {
+ Find-Module -Name $moduleName -MinimumVersion $versionMinimum -Repository PSGallery | Save-Module -Path $path
+ } else {
+ Find-Module -Name $moduleName -Repository PSGallery | Save-Module -Path $path
+ }
+ }
+ }
+}
+
+$ProgressPreference = 'SilentlyContinue'
+$all = (@($Accounts.IsPresent, $Pester.IsPresent) | Select-Object -Unique | Measure-Object).Count -eq 1
+
+$localModulesPath = Join-Path $PSScriptRoot 'generated\modules'
+if(Test-Path -Path $localModulesPath) {
+ $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
+}
+
+DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.7.4'
+DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -versionMinimum ''
+
+$tools = Join-Path $PSScriptRoot 'tools'
+$resourceDir = Join-Path $tools 'Resources'
+$resourceModule = Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psm1'
+
+if ($Resources.IsPresent -and (-not (Test-Path -Path $resourceModule))) {
+ Write-Host -ForegroundColor Green "Building local Resource module used for test..."
+ Set-Location $resourceDir
+ $null = autorest-beta .\readme.md --output-folder=$HOME/.PSSharedModules/Resources
+ $null = Copy-Item custom/* $HOME/.PSSharedModules/Resources/custom/
+ Set-Location $HOME/.PSSharedModules/Resources
+ $null = .\build-module.ps1
+ Set-Location $PSScriptRoot
+}
diff --git a/src/ImageBuilder/custom/Az.ImageBuilder.custom.psm1 b/src/ImageBuilder/custom/Az.ImageBuilder.custom.psm1
new file mode 100644
index 000000000000..66de7b0c120e
--- /dev/null
+++ b/src/ImageBuilder/custom/Az.ImageBuilder.custom.psm1
@@ -0,0 +1,17 @@
+# region Generated
+ # Load the private module dll
+ $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.ImageBuilder.private.dll')
+
+ # Load the internal module
+ $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.ImageBuilder.internal.psm1'
+ if(Test-Path $internalModulePath) {
+ $null = Import-Module -Name $internalModulePath
+ }
+
+ # Export nothing to clear implicit exports
+ Export-ModuleMember
+
+ # Export script cmdlets
+ Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
+ Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias)
+# endregion
diff --git a/src/ImageBuilder/custom/New-AzImageBuilderCustomizerObject.ps1 b/src/ImageBuilder/custom/New-AzImageBuilderCustomizerObject.ps1
new file mode 100644
index 000000000000..e3aab6aadb99
--- /dev/null
+++ b/src/ImageBuilder/custom/New-AzImageBuilderCustomizerObject.ps1
@@ -0,0 +1,166 @@
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Describes a unit of image customization
+.Description
+Describes a unit of image customization
+
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderCustomizerObject
+#>
+function New-AzImageBuilderCustomizerObject {
+ [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer')]
+ [CmdletBinding(PositionalBinding=$false, DefaultParameterSetName="ShellCustomizer")]
+ Param(
+ #region CustomizerCommon
+ [Parameter(Mandatory, HelpMessage="Friendly Name to provide context on what this customization step does.")]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${CustomizerName},
+ [Parameter(ParameterSetName='ShellCustomizer', HelpMessage="Array of shell commands to execute.")]
+ [Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="Array of shell commands to execute.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string[]]
+ ${Inline},
+ [Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc.")]
+ [Parameter(ParameterSetName='ShellCustomizer', HelpMessage="URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${ScriptUri},
+ [Parameter(ParameterSetName='ShellCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
+ [Parameter(ParameterSetName='FileCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
+ [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${Sha256Checksum},
+ #endregion CustomizerCommon
+
+ #region FileCustomizer
+ [Parameter(ParameterSetName='FileCustomizer', Mandatory, HelpMessage="Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${FileCustomizer},
+ [Parameter(ParameterSetName='FileCustomizer', HelpMessage="The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${Destination},
+ [Parameter(ParameterSetName='FileCustomizer', HelpMessage="The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${SourceUri},
+ #endregion FileCustomizer
+
+ #region ShellCustomizer
+ [Parameter(ParameterSetName='ShellCustomizer', Mandatory, HelpMessage="Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${ShellCustomizer},
+ #endregion ShellCustomizer
+
+ #region PowerShellCustomizer
+ [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory, HelpMessage="Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${PowerShellCustomizer},
+ [Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="If specified, the PowerShell script will be run with elevated privileges.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Boolean]
+ ${RunElevated},
+ [Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="Valid exit codes for the PowerShell script. [Default: 0].")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [int[]]
+ ${ValidExitCode},
+ #endregion PowerShellCustomizer
+
+ #region WindowsUpdateCustomizer
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer', Mandatory, HelpMessage="Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${WindowsUpdateCustomizer},
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer', HelpMessage="Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above link for examples and detailed description of this field.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string[]]
+ ${Filter},
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer', HelpMessage="Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${SearchCriterion},
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer', HelpMessage="Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [int]
+ ${UpdateLimit},
+ #endregion WindowsUpdateCustomizer
+
+ #region RestartCustomizer
+ [Parameter(ParameterSetName='RestartCustomizer', Mandatory, HelpMessage="Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${RestartCustomizer},
+ [Parameter(ParameterSetName='RestartCustomizer', HelpMessage="Command to check if restart succeeded [Default: ''].")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${RestartCheckCommand},
+ [Parameter(ParameterSetName='RestartCustomizer', HelpMessage="Command to execute the restart [Default: 'shutdown /r /f /t 0 /c packer restart']")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${RestartCommand},
+ [Parameter(ParameterSetName='RestartCustomizer', HelpMessage="Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'].")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${RestartTimeout}
+ #endregion RestartCustomizer
+ )
+
+ process {
+ if ($PSBoundParameters.ContainsKey('PowerShellCustomizer')) {
+ $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePowerShellCustomizer]::New()
+ $Customizer.Type = "PowerShell"
+ $Customizer.Inline = $Inline
+ $Customizer.RunElevated = $RunElevated
+ $Customizer.ScriptUri = $ScriptUri
+ $Customizer.Sha256Checksum = $Sha256Checksum
+ $Customizer.ValidExitCode = $ValidExitCode
+ } elseif ($PSBoundParameters.ContainsKey('RestartCustomizer')) {
+ $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateRestartCustomizer]::New()
+ $Customizer.Type = "WindowsRestart"
+ $Customizer.RestartCheckCommand = $RestartCheckCommand
+ $Customizer.RestartCommand = $RestartCommand
+ $Customizer.RestartTimeout = $RestartTimeout
+ } elseif ($PSBoundParameters.ContainsKey('WindowsUpdateCustomizer')) {
+ $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateWindowsUpdateCustomizer]::New()
+ $Customizer.Type = "WindowsUpdate"
+ $Customizer.Filter = $Filter
+ $Customizer.SearchCriterion = $SearchCriterion
+ $Customizer.UpdateLimit = $UpdateLimit
+ } elseif ($PSBoundParameters.ContainsKey('ShellCustomizer')) {
+ $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateShellCustomizer]::New()
+ $Customizer.Type = "Shell"
+ $Customizer.Inline = $Inline
+ $Customizer.ScriptUri = $ScriptUri
+ $Customizer.Sha256Checksum = $Sha256Checksum
+ } elseif ($PSBoundParameters.ContainsKey('FileCustomizer')) {
+ $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateFileCustomizer]::New()
+ $Customizer.Type = "File"
+ $Customizer.Destination = $Destination
+ $Customizer.Sha256Checksum = $Sha256Checksum
+ $Customizer.SourceUri = $SourceUri
+ }
+ $Customizer.Name = $CustomizerName
+
+ return $Customizer
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/custom/New-AzImageBuilderDistributorObject.ps1 b/src/ImageBuilder/custom/New-AzImageBuilderDistributorObject.ps1
new file mode 100644
index 000000000000..ac2f1aa650ef
--- /dev/null
+++ b/src/ImageBuilder/custom/New-AzImageBuilderDistributorObject.ps1
@@ -0,0 +1,109 @@
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Generic distribution object
+.Description
+Generic distribution object
+
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderDistributorObject
+#>
+function New-AzImageBuilderDistributorObject {
+ [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor')]
+ [CmdletBinding(PositionalBinding=$false, DefaultParameterSetName="ManagedImageDistributor")]
+ Param(
+ #region DistributorCommon
+ [Parameter(Mandatory, HelpMessage="Tags that will be applied to the artifact once it has been created/updated by the distributor.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Collections.Hashtable]
+ ${ArtifactTag},
+ [Parameter(Mandatory, HelpMessage="The name to be used for the associated RunOutput.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${RunOutputName},
+ #endregion DistributorCommon
+
+
+ #region VhdDistributor
+ [Parameter(ParameterSetName='VhdDistributor', Mandatory, HelpMessage="Distribute via VHD in a storage account.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${VhdDistributor},
+ #endregion VhdDistributor
+
+ #region ManagedImageDistributor
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory, HelpMessage="Distribute as a Managed Disk Image.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${ManagedImageDistributor},
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory, HelpMessage="Resource Id of the Managed Disk Image.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${ImageId},
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory, HelpMessage="Azure location for the image, should match if image already exists.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${Location},
+ #endregion ManagedImageDistributor
+
+ #region SharedImageDistributor
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory, HelpMessage="Distribute via Shared Image Gallery.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${SharedImageDistributor},
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory, HelpMessage="Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Boolean]
+ ${ExcludeFromLatest},
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory, HelpMessage="A list of regions that the image will be replicated to.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string[]]
+ ${ReplicationRegion},
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory, HelpMessage="Resource Id of the Shared Image Gallery image.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${GalleryImageId},
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType])]
+ [Parameter(ParameterSetName='SharedImageDistributor', HelpMessage="Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType]
+ ${StorageAccountType}
+ #endregion SharedImageDistributor
+ )
+
+ process {
+ if ($PSBoundParameters.ContainsKey('VhdDistributor')) {
+ $Distributor = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVhdDistributor]::New()
+ $Distributor.Type = "VHD"
+ } elseif ($PSBoundParameters.ContainsKey('ManagedImageDistributor')) {
+ $Distributor = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageDistributor]::New()
+ $Distributor.Type = "ManagedImage"
+ $Distributor.ImageId = $ImageId
+ $Distributor.Location = $Location
+ } elseif ($PSBoundParameters.ContainsKey('SharedImageDistributor')) {
+ $Distributor = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageDistributor]::New()
+ $Distributor.Type = "SharedImage"
+ $Distributor.ExcludeFromLatest = $ExcludeFromLatest
+ $Distributor.GalleryImageId = $GalleryImageId
+ $Distributor.ReplicationRegion = $ReplicationRegion
+ $Distributor.StorageAccountType = $StorageAccountType
+ }
+ $Distributor.ArtifactTag = $ArtifactTag
+ $Distributor.RunOutputName = $RunOutputName
+
+ return $Distributor
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/custom/New-AzImageBuilderSourceObject.ps1 b/src/ImageBuilder/custom/New-AzImageBuilderSourceObject.ps1
new file mode 100644
index 000000000000..790927a4bd4a
--- /dev/null
+++ b/src/ImageBuilder/custom/New-AzImageBuilderSourceObject.ps1
@@ -0,0 +1,117 @@
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Describes a virtual machine image source for building, customizing and distributing.
+.Description
+Describes a virtual machine image source for building, customizing and distributing.
+
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderSourceObject
+#>
+function New-AzImageBuilderSourceObject {
+ [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource')]
+ [CmdletBinding(PositionalBinding=$false, DefaultParameterSetName="ManagedImage")]
+ Param(
+ #region SourceType-PlatformImage
+ [Parameter(ParameterSetName='PlatformImage', Mandatory, HelpMessage="Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory, HelpMessage="Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${SourceTypePlatformImage},
+ [Parameter(ParameterSetName='PlatformImage', HelpMessage="Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', HelpMessage="Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${Offer},
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory, HelpMessage="Name of the purchase plan.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${PlanName},
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory, HelpMessage="Product of the purchase plan.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${PlanProduct},
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory, HelpMessage="Publisher of the purchase plan.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${PlanPublisher},
+ [Parameter(ParameterSetName='PlatformImage', HelpMessage="Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', HelpMessage="Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${Publisher},
+ [Parameter(ParameterSetName='PlatformImage', HelpMessage="Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', HelpMessage="Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${Sku},
+ [Parameter(ParameterSetName='PlatformImage', HelpMessage="Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', HelpMessage="Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${Version},
+ #endregion SourceType-PlatformImage
+
+ #region SourceType-ManagedImage
+ [Parameter(ParameterSetName='ManagedImage', Mandatory, HelpMessage="Describes an image source that is a managed image in customer subscription.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${SourceTypeManagedImage},
+ [Parameter(ParameterSetName='ManagedImage', HelpMessage="ARM resource id of the managed image in customer subscription.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${ImageId},
+ #endregion SourceType-ManagedImage
+
+ #region SourceType-SharedImageVersion
+ [Parameter(ParameterSetName='SharedImageVersion', Mandatory, HelpMessage="Describes an image source that is an image version in a shared image gallery.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Switch]
+ ${SourceTypeSharedImageVersion},
+ [Parameter(ParameterSetName='SharedImageVersion', HelpMessage="ARM resource id of the image version in the shared image gallery.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [string]
+ ${ImageVersionId}
+ #endregion SourceType-SharedImageVersion
+ )
+
+
+ process {
+ if ($PSBoundParameters.ContainsKey('SourceTypePlatformImage')) {
+ $Source = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePlatformImageSource]::New()
+ $Source.Type = "PlatformImage"
+ $Source.Offer = $Offer
+ if ($PSBoundParameters.ContainsKey('PlanName')) {
+ $Source.PlanInfoPlanName = $PlanName
+ $Source.PlanInfoPlanProduct = $PlanProduct
+ $Source.PlanInfoPlanPublisher = $PlanPublisher
+ }
+ $Source.Publisher = $Publisher
+ $Source.Sku = $Sku
+ $Source.Version = $Version
+ } elseif ($PSBoundParameters.ContainsKey('SourceTypeManagedImage')) {
+ $Source = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageSource]::New()
+ $Source.Type = "ManagedImage"
+ $Source.ImageId = $ImageId
+ } elseif ($PSBoundParameters.ContainsKey('SourceTypeSharedImageVersion')) {
+ $Source = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageVersionSource]::New()
+ $Source.Type = "SharedImageVersion"
+ $Source.ImageVersionId = $ImageVersionId
+ }
+
+ return $Source
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/custom/New-AzImagerBuilderTemplate.ps1 b/src/ImageBuilder/custom/New-AzImagerBuilderTemplate.ps1
new file mode 100644
index 000000000000..7b240c3fba43
--- /dev/null
+++ b/src/ImageBuilder/custom/New-AzImagerBuilderTemplate.ps1
@@ -0,0 +1,319 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Create a virtual machine image template
+.Description
+Create a virtual machine image template
+
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderTemplate
+#>
+function New-AzImageBuilderTemplate {
+ [OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])]
+ [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium', DefaultParameterSetName="Name")]
+ param(
+ [Parameter(ParameterSetName='Name', Mandatory, HelpMessage="The name of the image Template.")]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Name', Mandatory, HelpMessage="The name of the resource group.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Name', HelpMessage="Subscription credentials which uniquely identify Microsoft Azure subscription.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(HelpMessage="Resource location.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource location
+ ${Location},
+
+ [Parameter(HelpMessage="Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32]
+ # Maximum duration to wait while building the image template.
+ # Omit or specify 0 to use the default (4 hours).
+ ${BuildTimeoutInMinute},
+
+ [Parameter(HelpMessage="Specifies the properties used to describe the customization steps of the image, like Image source etc.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]]
+ # Specifies the properties used to describe the customization steps of the image, like Image source etc
+ # To construct, see NOTES section for CUSTOMIZE properties and create a hash table.
+ ${Customize},
+
+ [Parameter(Mandatory, HelpMessage="The distribution targets where the image output needs to go to.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]]
+ # The distribution targets where the image output needs to go to.
+ # To construct, see NOTES section for DISTRIBUTE properties and create a hash table.
+ ${Distribute},
+
+ [Parameter(Mandatory, HelpMessage="Describes a virtual machine image source for building, customizing and distributing.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource]
+ ${Source},
+
+ # [Parameter(HelpMessage="The type of identity used for the image template.")]
+ # [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType])]
+ # [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ # [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType]
+ # # The type of identity used for the image template.
+ # # The type 'None' will remove any identities from the image template.
+ # ${IdentityType},
+
+ [Parameter(Mandatory, HelpMessage="The id of user assigned identity.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities]))]
+ [System.String]
+ # The id of user assigned identity.
+ # The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ ${UserAssignedIdentityId},
+
+ [Parameter(HelpMessage="End time of the last run (UTC).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.DateTime]
+ # End time of the last run (UTC)
+ ${LastRunStatusEndTime},
+
+ [Parameter(HelpMessage="Verbose information about the last run state.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Verbose information about the last run state
+ ${LastRunStatusMessage},
+
+ [Parameter(HelpMessage="State of the last run.")]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState]
+ # State of the last run
+ ${LastRunStatusRunState},
+
+ [Parameter(HelpMessage="Sub-state of the last run.")]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState]
+ # Sub-state of the last run
+ ${LastRunStatusRunSubState},
+
+ [Parameter(HelpMessage="Start time of the last run (UTC).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.DateTime]
+ # Start time of the last run (UTC)
+ ${LastRunStatusStartTime},
+
+ [Parameter(HelpMessage="Error code of the provisioning failure.")]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode]
+ # Error code of the provisioning failure
+ ${ProvisioningErrorCode},
+
+ [Parameter(HelpMessage="Verbose error message about the provisioning failure.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Verbose error message about the provisioning failure
+ ${ProvisioningErrorMessage},
+
+ [Parameter(HelpMessage="Resource tags.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags]))]
+ [System.Collections.Hashtable]
+ # Resource tags
+ ${Tag},
+
+ [Parameter(HelpMessage="Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32]
+ # Size of the OS disk in GB.
+ # Omit or specify 0 to use Azure's default OS disk size.
+ ${VMProfileOsdiskSizeInGb},
+
+ [Parameter(HelpMessage="Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2).")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Size of the virtual machine used to build, customize and capture images.
+ # Omit or specify empty string to use the default (Standard_D1_v2).
+ ${VMProfileVmSize},
+
+ [Parameter(HelpMessage="Resource id of a pre-existing subnet.")]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource id of a pre-existing subnet.
+ ${VnetConfigSubnetId},
+
+ #region HideParameter
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+ #endregion HideParameter
+ )
+
+ process {
+ try {
+ $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate]::New()
+
+ $Parameter.Source = $Source
+ $Null = $PSBoundParameters.Remove('Source')
+
+ if ($PSBoundParameters.ContainsKey('Location')) {
+ $Parameter.Location = $Location
+ $Null = $PSBoundParameters.Remove('Location')
+ }
+ if ($PSBoundParameters.ContainsKey('Tag')) {
+ $Parameter.Tag = $Tag
+ $Null = $PSBoundParameters.Remove('Tag')
+ }
+ if ($PSBoundParameters.ContainsKey('BuildTimeoutInMinute')) {
+ $Parameter.BuildTimeoutInMinute = $BuildTimeoutInMinute
+ $Null = $PSBoundParameters.Remove('BuildTimeoutInMinute')
+ }
+ if ($PSBoundParameters.ContainsKey('Customize')) {
+ $Parameter.Customize = $Customize
+ $Null = $PSBoundParameters.Remove('Customize')
+ }
+ if ($PSBoundParameters.ContainsKey('Distribute')) {
+ $Parameter.Distribute = $Distribute
+ $Null = $PSBoundParameters.Remove('Distribute')
+ }
+ $Parameter.IdentityType = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType]::UserAssigned
+ $UserAssignedIdentities = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentities]::new()
+ $UserassignedidentitiesAdditionalproperties = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties](@{})
+ $UserAssignedIdentities.Add($UserAssignedIdentityId, $UserassignedidentitiesAdditionalproperties)
+ $Parameter.IdentityUserAssignedIdentity = $UserAssignedIdentities
+ $Null = $PSBoundParameters.Remove('UserAssignedIdentityId')
+
+ if ($PSBoundParameters.ContainsKey('LastRunStatus')) {
+ $Parameter.LastRunStatus = $LastRunStatus
+ $Null = $PSBoundParameters.Remove('LastRunStatus')
+ }
+ if ($PSBoundParameters.ContainsKey('LastRunStatusEndTime')) {
+ $Parameter.LastRunStatusEndTime = $LastRunStatusEndTime
+ $Null = $PSBoundParameters.Remove('LastRunStatusEndTime')
+ }
+ if ($PSBoundParameters.ContainsKey('LastRunStatusMessage')) {
+ $Parameter.LastRunStatusMessage = $LastRunStatusMessage
+ $Null = $PSBoundParameters.Remove('LastRunStatusMessage')
+ }
+ if ($PSBoundParameters.ContainsKey('LastRunStatusRunState')) {
+ $Parameter.LastRunStatusRunState = $LastRunStatusRunState
+ $Null = $PSBoundParameters.Remove('LastRunStatusRunState')
+ }
+ if ($PSBoundParameters.ContainsKey('LastRunStatusRunSubState')) {
+ $Parameter.LastRunStatusRunSubState = $LastRunStatusRunSubState
+ $Null = $PSBoundParameters.Remove('LastRunStatusRunSubState')
+ }
+ if ($PSBoundParameters.ContainsKey('LastRunStatusStartTime')) {
+ $Parameter.LastRunStatusStartTime = $LastRunStatusStartTime
+ $Null = $PSBoundParameters.Remove('LastRunStatusStartTime')
+ }
+ if ($PSBoundParameters.ContainsKey('ProvisioningErrorCode')) {
+ $Parameter.ProvisioningErrorCode = $ProvisioningErrorCode
+ $Null = $PSBoundParameters.Remove('ProvisioningErrorCode')
+ }
+ if ($PSBoundParameters.ContainsKey('ProvisioningState')) {
+ $Parameter.ProvisioningState = $ProvisioningState
+ $Null = $PSBoundParameters.Remove('ProvisioningState')
+ }
+ if ($PSBoundParameters.ContainsKey('VMProfileOsdiskSizeInGb')) {
+ $Parameter.VMProfileOsdiskSizeGb = $VMProfileOsdiskSizeInGb
+ $null = $PSBoundParameters.Remove('VMProfileOsdiskSizeInGb')
+ }
+ if ($PSBoundParameters.ContainsKey('VMProfileVmSize')) {
+ $Parameter.VMProfileVmsize = $VMProfileVmSize
+ $Null = $PSBoundParameters.Remove('VMProfileVmSize')
+ }
+ if ($PSBoundParameters.ContainsKey('VnetConfigSubnetId')) {
+ $Parameter.VnetConfigSubnetId = $VnetConfigSubnetId
+ $Null = $PSBoundParameters.Remove('VnetConfigSubnetId')
+ }
+ $PSBoundParameters.Add("Parameter", $Parameter)
+
+ Az.ImageBuilder.internal\New-AzImageBuilderTemplate @PSBoundParameters
+ return $source
+ } catch {
+ throw
+ }
+ }
+}
+
\ No newline at end of file
diff --git a/src/ImageBuilder/custom/Update-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/custom/Update-AzImageBuilderTemplate.ps1
new file mode 100644
index 000000000000..029ffec646e4
--- /dev/null
+++ b/src/ImageBuilder/custom/Update-AzImageBuilderTemplate.ps1
@@ -0,0 +1,331 @@
+
+# # ----------------------------------------------------------------------------------
+# #
+# # Copyright Microsoft Corporation
+# # Licensed under the Apache License, Version 2.0 (the "License");
+# # you may not use this file except in compliance with the License.
+# # You may obtain a copy of the License at
+# # http://www.apache.org/licenses/LICENSE-2.0
+# # Unless required by applicable law or agreed to in writing, software
+# # distributed under the License is distributed on an "AS IS" BASIS,
+# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# # See the License for the specific language governing permissions and
+# # limitations under the License.
+# # ----------------------------------------------------------------------------------
+
+# <#
+# .Synopsis
+# Update a virtual machine image template
+# .Description
+# Update a virtual machine image template
+
+# .Link
+# https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/update-AzImageBuilderTemplate
+# #>
+# function Update-AzImageBuilderTemplate {
+# [OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])]
+# [CmdletBinding(DefaultParameterSetName='Name', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+# param(
+# [Parameter(ParameterSetName='Name', Mandatory, HelpMessage="The name of the image Template.")]
+# [Alias('Name')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+# [System.String]
+# # The name of the image Template
+# ${ImageTemplateName},
+
+# [Parameter(ParameterSetName='Name', Mandatory, HelpMessage="The name of the resource group.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+# [System.String]
+# # The name of the resource group.
+# ${ResourceGroupName},
+
+# [Parameter(ParameterSetName='Name', HelpMessage="Subscription credentials which uniquely identify Microsoft Azure subscription.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+# [System.String]
+# # Subscription credentials which uniquely identify Microsoft Azure subscription.
+# # The subscription Id forms part of the URI for every service call.
+# ${SubscriptionId},
+
+# [Parameter(ParameterSetName='InputObject', Mandatory, ValueFromPipeline, HelpMessage="Identity Parameter.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+# # Identity Parameter
+# # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+# ${InputObject},
+
+# [Parameter(HelpMessage="Resource location.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.String]
+# # Resource location
+# ${Location},
+
+# [Parameter(HelpMessage="Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.Int32]
+# # Maximum duration to wait while building the image template.
+# # Omit or specify 0 to use the default (4 hours).
+# ${BuildTimeoutInMinute},
+
+# [Parameter(HelpMessage="Specifies the properties used to describe the customization steps of the image, like Image source etc.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]]
+# # Specifies the properties used to describe the customization steps of the image, like Image source etc
+# # To construct, see NOTES section for CUSTOMIZE properties and create a hash table.
+# ${Customize},
+
+# [Parameter(HelpMessage="The distribution targets where the image output needs to go to.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]]
+# # The distribution targets where the image output needs to go to.
+# # To construct, see NOTES section for DISTRIBUTE properties and create a hash table.
+# ${Distribute},
+
+# [Parameter(Mandatory, HelpMessage="Describes a virtual machine image source for building, customizing and distributing.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource]
+# ${Source},
+
+# [Parameter(HelpMessage="The type of identity used for the image template.")]
+# [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType])]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType]
+# # The type of identity used for the image template.
+# # The type 'None' will remove any identities from the image template.
+# ${IdentityType},
+
+# [Parameter(HelpMessage="The list of user identities associated with the image template.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities]))]
+# [System.Collections.Hashtable]
+# # The list of user identities associated with the image template.
+# # The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+# ${UserAssignedIdentity},
+
+# [Parameter(HelpMessage="End time of the last run (UTC).")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.DateTime]
+# # End time of the last run (UTC)
+# ${LastRunStatusEndTime},
+
+# [Parameter(HelpMessage="Verbose information about the last run state.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.String]
+# # Verbose information about the last run state
+# ${LastRunStatusMessage},
+
+# [Parameter(HelpMessage="State of the last run.")]
+# [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState])]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState]
+# # State of the last run
+# ${LastRunStatusRunState},
+
+# [Parameter(HelpMessage="Sub-state of the last run.")]
+# [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState])]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState]
+# # Sub-state of the last run
+# ${LastRunStatusRunSubState},
+
+# [Parameter(HelpMessage="Start time of the last run (UTC).")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.DateTime]
+# # Start time of the last run (UTC)
+# ${LastRunStatusStartTime},
+
+# [Parameter(HelpMessage="Error code of the provisioning failure.")]
+# [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode])]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode]
+# # Error code of the provisioning failure
+# ${ProvisioningErrorCode},
+
+# [Parameter(HelpMessage="Verbose error message about the provisioning failure.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.String]
+# # Verbose error message about the provisioning failure
+# ${ProvisioningErrorMessage},
+
+# [Parameter(HelpMessage="Specifies the type of source image you want to start with.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.String]
+# # Specifies the type of source image you want to start with.
+# ${SourceType},
+
+# [Parameter(HelpMessage="Resource tags.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags]))]
+# [System.Collections.Hashtable]
+# # Resource tags
+# ${Tag},
+
+# [Parameter(HelpMessage="Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.Int32]
+# # Size of the OS disk in GB.
+# # Omit or specify 0 to use Azure's default OS disk size.
+# ${VMProfileOsdiskSizeInGb},
+
+# [Parameter(HelpMessage="Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2).")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.String]
+# # Size of the virtual machine used to build, customize and capture images.
+# # Omit or specify empty string to use the default (Standard_D1_v2).
+# ${VMProfileVmSize},
+
+# [Parameter(HelpMessage="Resource id of a pre-existing subnet.")]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+# [System.String]
+# # Resource id of a pre-existing subnet.
+# ${VnetConfigSubnetId},
+
+# #region HideParameter
+# [Parameter()]
+# [Alias('AzureRMContext', 'AzureCredential')]
+# [ValidateNotNull()]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+# [System.Management.Automation.PSObject]
+# # The credentials, account, tenant, and subscription used for communication with Azure.
+# ${DefaultProfile},
+
+# [Parameter()]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+# [System.Management.Automation.SwitchParameter]
+# # Run the command as a job
+# ${AsJob},
+
+# [Parameter(DontShow)]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+# [System.Management.Automation.SwitchParameter]
+# # Wait for .NET debugger to attach
+# ${Break},
+
+# [Parameter(DontShow)]
+# [ValidateNotNull()]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+# # SendAsync Pipeline Steps to be appended to the front of the pipeline
+# ${HttpPipelineAppend},
+
+# [Parameter(DontShow)]
+# [ValidateNotNull()]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+# # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+# ${HttpPipelinePrepend},
+
+# [Parameter()]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+# [System.Management.Automation.SwitchParameter]
+# # Run the command asynchronously
+# ${NoWait},
+
+# [Parameter(DontShow)]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+# [System.Uri]
+# # The URI for the proxy server to use
+# ${Proxy},
+
+# [Parameter(DontShow)]
+# [ValidateNotNull()]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+# [System.Management.Automation.PSCredential]
+# # Credentials for a proxy server to use for the remote call
+# ${ProxyCredential},
+
+# [Parameter(DontShow)]
+# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+# [System.Management.Automation.SwitchParameter]
+# # Use the default credentials for the proxy
+# ${ProxyUseDefaultCredentials}
+# #endregion HideParameter
+# )
+
+# process {
+# try {
+# $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate]::New()
+
+# $Parameter.Source = $Source
+# $Null = $PSBoundParameters.Remove('Source')
+
+# if ($PSBoundParameters.ContainsKey('Location')) {
+# $Parameter.Location = $Location
+# $Null = $PSBoundParameters.Remove('Location')
+# }
+# if ($PSBoundParameters.ContainsKey('Tag')) {
+# $Parameter.Tag = $Tag
+# $Null = $PSBoundParameters.Remove('Tag')
+# }
+# if ($PSBoundParameters.ContainsKey('BuildTimeoutInMinute')) {
+# $Parameter.BuildTimeoutInMinute = $BuildTimeoutInMinute
+# $Null = $PSBoundParameters.Remove('BuildTimeoutInMinute')
+# }
+# if ($PSBoundParameters.ContainsKey('Customize')) {
+# $Parameter.Customize = $Customize
+# $Null = $PSBoundParameters.Remove('Customize')
+# }
+# if ($PSBoundParameters.ContainsKey('Distribute')) {
+# $Parameter.Distribute = $Distribute
+# $Null = $PSBoundParameters.Remove('Distribute')
+# }
+# if ($PSBoundParameters.ContainsKey('IdentityType')) {
+# $Parameter.IdentityType = $IdentityType
+# $Null = $PSBoundParameters.Remove('IdentityType')
+# }
+# if ($PSBoundParameters.ContainsKey('UserAssignedIdentity')) {
+# $Parameter.IdentityUserAssignedIdentity = $UserAssignedIdentity
+# $Null = $PSBoundParameters.Remove('UserAssignedIdentity')
+# }
+# if ($PSBoundParameters.ContainsKey('LastRunStatus')) {
+# $Parameter.LastRunStatus = $LastRunStatus
+# $Null = $PSBoundParameters.Remove('LastRunStatus')
+# }
+# if ($PSBoundParameters.ContainsKey('LastRunStatusEndTime')) {
+# $Parameter.LastRunStatusEndTime = $LastRunStatusEndTime
+# $Null = $PSBoundParameters.Remove('LastRunStatusEndTime')
+# }
+# if ($PSBoundParameters.ContainsKey('LastRunStatusMessage')) {
+# $Parameter.LastRunStatusMessage = $LastRunStatusMessage
+# $Null = $PSBoundParameters.Remove('LastRunStatusMessage')
+# }
+# if ($PSBoundParameters.ContainsKey('LastRunStatusRunState')) {
+# $Parameter.LastRunStatusRunState = $LastRunStatusRunState
+# $Null = $PSBoundParameters.Remove('LastRunStatusRunState')
+# }
+# if ($PSBoundParameters.ContainsKey('LastRunStatusRunSubState')) {
+# $Parameter.LastRunStatusRunSubState = $LastRunStatusRunSubState
+# $Null = $PSBoundParameters.Remove('LastRunStatusRunSubState')
+# }
+# if ($PSBoundParameters.ContainsKey('LastRunStatusStartTime')) {
+# $Parameter.LastRunStatusStartTime = $LastRunStatusStartTime
+# $Null = $PSBoundParameters.Remove('LastRunStatusStartTime')
+# }
+# if ($PSBoundParameters.ContainsKey('ProvisioningErrorCode')) {
+# $Parameter.ProvisioningErrorCode = $ProvisioningErrorCode
+# $Null = $PSBoundParameters.Remove('ProvisioningErrorCode')
+# }
+# if ($PSBoundParameters.ContainsKey('ProvisioningState')) {
+# $Parameter.ProvisioningState = $ProvisioningState
+# $Null = $PSBoundParameters.Remove('ProvisioningState')
+# }
+# if ($PSBoundParameters.ContainsKey('VMProfileOsdiskSizeInGb')) {
+# $Parameter.VMProfileOsdiskSizeGb = $VMProfileOsdiskSizeInGb
+# $null = $PSBoundParameters.Remove('VMProfileOsdiskSizeInGb')
+# }
+# if ($PSBoundParameters.ContainsKey('VMProfileVmSize')) {
+# $Parameter.VMProfileVmsize = $VMProfileVmSize
+# $Null = $PSBoundParameters.Remove('VMProfileVmSize')
+# }
+# if ($PSBoundParameters.ContainsKey('VnetConfigSubnetId')) {
+# $Parameter.VnetConfigSubnetId = $VnetConfigSubnetId
+# $Null = $PSBoundParameters.Remove('VnetConfigSubnetId')
+# }
+# $PSBoundParameters.Add("Parameter", $Parameter)
+# Az.ImageBuilder.internal\Update-AzImageBuilderTemplate @PSBoundParameters
+# } catch {
+# throw
+# }
+# }
+# }
+
\ No newline at end of file
diff --git a/src/ImageBuilder/custom/readme.md b/src/ImageBuilder/custom/readme.md
new file mode 100644
index 000000000000..b896468e0e44
--- /dev/null
+++ b/src/ImageBuilder/custom/readme.md
@@ -0,0 +1,41 @@
+# Custom
+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.
+
+## Info
+- Modifiable: yes
+- Generated: partial
+- Committed: yes
+- Packaged: yes
+
+## Details
+For `Az.ImageBuilder` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*.
+
+For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.ImageBuilder.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder.
+
+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.
+
+## Purpose
+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.
+
+## Usage
+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:
+- Break
+- DefaultProfile
+- HttpPipelineAppend
+- HttpPipelinePrepend
+- Proxy
+- ProxyCredential
+- ProxyUseDefaultCredentials
+
+These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.ImageBuilder`. For C#, follow the usage seen in the `ProcessRecordAsync` method.
+
+### Attributes
+For processing the cmdlets, we've created some additional attributes:
+- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.DescriptionAttribute`
+ - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
+- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.DoNotExportAttribute`
+ - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ImageBuilder`.
+- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.InternalExportAttribute`
+ - 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.
+- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.ProfileAttribute`
+ - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
\ No newline at end of file
diff --git a/src/ImageBuilder/examples/Get-AzImageBuilderRunOutput.md b/src/ImageBuilder/examples/Get-AzImageBuilderRunOutput.md
new file mode 100644
index 000000000000..7464f8304b54
--- /dev/null
+++ b/src/ImageBuilder/examples/Get-AzImageBuilderRunOutput.md
@@ -0,0 +1,32 @@
+### Example 1: List all run results under a template
+```powershell
+PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder
+
+Name Type
+---- ----
+image_lucas_1 Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+```
+
+This command lists all run results under a template.
+
+### Example 2: Get a run result under a template
+```powershell
+PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx
+
+Name Type
+---- ----
+runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+```
+This command gets a run result under a template.
+
+### Example 3: Get a run result under a template
+```powershell
+PS C:\> $result = Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx
+PS C:\> Get-AzImageBuilderRunOutput -InputObject $result
+
+Name Type
+---- ----
+runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+```
+This command gets a run result under a template.
+
diff --git a/src/ImageBuilder/examples/Get-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/Get-AzImageBuilderTemplate.md
new file mode 100644
index 000000000000..e3afcfa51599
--- /dev/null
+++ b/src/ImageBuilder/examples/Get-AzImageBuilderTemplate.md
@@ -0,0 +1,55 @@
+### Example 1: List all template under a subscription
+```powershell
+PS C:\> Get-AzImageBuilderTemplate
+
+Location Name Type
+-------- ---- ----
+eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates
+eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates
+eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates
+```
+
+This command lists all template under a subscription.
+
+### Example 2: List all template under a resource group
+```powershell
+PS C:\> Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder
+
+Location Name Type
+-------- ---- ----
+eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-ax01b7 Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-klcuav Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates
+eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-managedimg-managedimg Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-platform-managed Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-shareimg-managedimg Microsoft.VirtualMachineImages/imageTemplates
+```
+
+This command lists all template under a resource group.
+
+### Example 3: Get a template under a resource group
+```powershell
+PS C:\> Get-AzImageBuilderTemplate -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder
+
+Location Name Type
+-------- ---- ----
+eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates
+```
+
+This command gets a template under a resource group.
+
+### Example 4: Get a template under a resource group
+```powershell
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -ImageTemplateName template-name-ep5z7v
+PS C:\> Get-AzImageBuilderTemplate -InputObject $template
+
+Location Name Type
+-------- ---- ----
+eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates
+```
+
+This command gets a template under a resource group.
+
diff --git a/src/ImageBuilder/examples/New-AzImageBuilderCustomizerObject.md b/src/ImageBuilder/examples/New-AzImageBuilderCustomizerObject.md
new file mode 100644
index 000000000000..d5b461385900
--- /dev/null
+++ b/src/ImageBuilder/examples/New-AzImageBuilderCustomizerObject.md
@@ -0,0 +1,57 @@
+### Example 1: Create a windows update customizer
+```powershell
+PS C:\> New-AzImageBuilderCustomizerObject -WindowsUpdateCustomizer -Filter ("BrowseOnly", "IsInstalled") -SearchCriterion "BrowseOnly=0 and IsInstalled=0" -UpdateLimit 100 -CustomizerName 'WindUpdate'
+
+Name Type Filter SearchCriterion UpdateLimit
+---- ---- ------ --------------- -----------
+WindUpdate WindowsUpdate {BrowseOnly, IsInstalled} BrowseOnly=0 and IsInstalled=0 100
+```
+
+This command creates a windows update customizer.
+
+### Example 2: Create a file customizer
+```powershell
+PS C:\> New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName 'filecus' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' -Destination 'c:\\buildArtifacts\\index.html' -SourceUri 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html'
+
+Name Type Destination Sha256Checksum SourceUri
+---- ---- ----------- -------------- ---------
+filecus File c:\\buildArtifacts\\index.html ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html
+
+```
+
+This command creates a file customizer.
+
+### Example 3: Create a powershell customizer
+```powershell
+PS C:\> $inline = @("mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt")
+PS C:\> New-AzImageBuilderCustomizerObject -PowerShellCustomizer -CustomizerName settingUpMgmtAgtPath -RunElevated $false -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 -Inline $inline
+
+Name Type Inline RunElevated ScriptUri Sha256Checksum ValidExitC e
+---- ---- ------ ----------- --------- -------------- --
+settingUpMgmtAgtPath PowerShell {mkdir c:\\buildActions, echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt} False ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+```
+
+This command creates a powershell customizer.
+
+### Example 4: Create a restart customizer
+```powershell
+PS C:\> New-AzImageBuilderCustomizerObject -RestartCustomizer -CustomizerName 'restcus' -RestartCommand 'shutdown /f /r /t 0 /c \"packer restart\"' -RestartCheckCommand 'powershell -command "& {Write-Output "restarted."}"' -RestartTimeout '10m'
+
+Name Type RestartCheckCommand RestartCommand RestartTimeout
+---- ---- ------------------- -------------- --------------
+restcus WindowsRestart powershell -command "& {Write-Output "restarted."}" shutdown /f /r /t 0 /c \"packer restart\" 10m
+```
+
+This command creates a restart customizer.
+
+### Example 5: Create a shell customizer
+```powershell
+PS C:\> New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName downloadBuildArtifacts -ScriptUri "https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh" -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+
+Name Type Inline ScriptUri Sha256Checksum
+---- ---- ------ --------- --------------
+downloadBuildArtifacts Shell https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+```
+
+This command creates a shell customizer.
+
diff --git a/src/ImageBuilder/examples/New-AzImageBuilderDistributorObject.md b/src/ImageBuilder/examples/New-AzImageBuilderDistributorObject.md
new file mode 100644
index 000000000000..2eacd49e27cf
--- /dev/null
+++ b/src/ImageBuilder/examples/New-AzImageBuilderDistributorObject.md
@@ -0,0 +1,35 @@
+### Example 1: Create a managed image distributor
+```powershell
+PS C:\> New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{tag='lucasManage'} -ImageId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare -RunOutputName luacas-runout -Location eastus
+
+RunOutputName Type ImageId Location
+------------- ---- ------- --------
+luacas-runout ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare eastus
+```
+
+This command creates a managed image distributor.
+
+### Example 2: Create a VHD distributor
+```powershell
+PS C:\> New-AzImageBuilderDistributorObject -ArtifactTag @{tag='vhd'} -VhdDistributor -RunOutputName image-vhd
+
+RunOutputName Type
+------------- ----
+image-vhd Vhd
+```
+
+This command creates a VHD distributor.
+
+### Example 3: Create a shared image distributor
+```powershell
+PS C:\> New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share' -ReplicationRegion eastus2 -RunOutputName 'outname' -ExcludeFromLatest $false
+
+RunOutputName Type ExcludeFromLatest GalleryImageId ReplicationRegi
+ on
+------------- ---- ----------------- -------------- ---------------
+outname SharedImage False /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share {eastus2}
+```
+
+This command creates a shared image distributor.
+
+
diff --git a/src/ImageBuilder/examples/New-AzImageBuilderSourceObject.md b/src/ImageBuilder/examples/New-AzImageBuilderSourceObject.md
new file mode 100644
index 000000000000..b7fa532501c5
--- /dev/null
+++ b/src/ImageBuilder/examples/New-AzImageBuilderSourceObject.md
@@ -0,0 +1,34 @@
+### Example 1: Create a managed image source
+```powershell
+PS C:\> $imageid = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image'
+PS C:\> New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $imageid
+
+Type ImageId
+---- -------
+ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image
+```
+
+This command creates a managed image source.
+
+### Example 2: Create a shared image source
+```powershell
+PS C:\> New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0
+
+Type ImageVersionId
+---- --------------
+SharedImageVersion /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0
+```
+
+This command creates a shared image source.
+
+### Example 3: Create a platfrom image source
+```powershell
+PS C:\> New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest'
+
+Type Offer Publisher Sku Version
+---- ----- --------- --- -------
+PlatformImage UbuntuServer Canonical 18.04-LTS latest
+```
+
+This command creates a platfrom image source.
+
diff --git a/src/ImageBuilder/examples/New-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/New-AzImageBuilderTemplate.md
new file mode 100644
index 000000000000..abf1d758fffd
--- /dev/null
+++ b/src/ImageBuilder/examples/New-AzImageBuilderTemplate.md
@@ -0,0 +1,19 @@
+### Example 1: Create a virtual machine image template
+```powershell
+PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest'
+PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false
+PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93'
+PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity'
+PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity
+
+Location Name Type
+-------- ---- ----
+PlanInfoPlanName :
+PlanInfoPlanPublisher :
+Sku : 18.04-LTS
+Version : latest
+PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan
+```
+
+This commands creates a virtual machine image template.
+
diff --git a/src/ImageBuilder/examples/Remove-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/Remove-AzImageBuilderTemplate.md
new file mode 100644
index 000000000000..b82aede7a2d2
--- /dev/null
+++ b/src/ImageBuilder/examples/Remove-AzImageBuilderTemplate.md
@@ -0,0 +1,17 @@
+### Example 1: Remove a image template
+```powershell
+PS C:\> Remove-AzImageBuilderTemplate -ImageTemplateName template-name-dmt6ze -ResourceGroupName wyunchi-imagebuilder
+
+```
+
+This command removes a image template.
+
+### Example 2: Remove a image template
+```powershell
+PS C:\> $template = Get-AzImageBuilderTemplate -ImageTemplateName template-name-3uo8p6 -ResourceGroupName wyunchi-imagebuilder
+PS C:\> Remove-AzImageBuilderTemplate -InputObject $template
+
+```
+
+This command removes a image template.
+
diff --git a/src/ImageBuilder/examples/Start-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/Start-AzImageBuilderTemplate.md
new file mode 100644
index 000000000000..8b7d409c0e77
--- /dev/null
+++ b/src/ImageBuilder/examples/Start-AzImageBuilderTemplate.md
@@ -0,0 +1,17 @@
+### Example 1: Start an image template
+```powershell
+PS C:\> Start-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+
+```
+
+This command starts an image template.
+
+### Example 2: Start an image template
+```powershell
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+PS C:\> Start-AzImageBuilderTemplate -InputObject $template
+
+```
+
+This command starts an image template.
+
diff --git a/src/ImageBuilder/examples/Stop-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/Stop-AzImageBuilderTemplate.md
new file mode 100644
index 000000000000..9da241438e28
--- /dev/null
+++ b/src/ImageBuilder/examples/Stop-AzImageBuilderTemplate.md
@@ -0,0 +1,30 @@
+### Example 1: Stop image template creation
+```powershell
+PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob
+
+Id Name PSJobTypeName State HasMoreData Location Command
+-- ---- ------------- ----- ----------- -------- -------
+1 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp…
+
+PS C:\> Stop-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder
+
+```
+
+This command stops image template creation.
+
+### Example 2: Stop image template creation
+```powershell
+PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob
+
+Id Name PSJobTypeName State HasMoreData Location Command
+-- ---- ------------- ----- ----------- -------- -------
+2 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp…
+
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+PS C:\> Stop-AzImageBuilderTemplate -InputObject $template
+
+```
+
+This command stops image template creation.
+
+
diff --git a/src/ImageBuilder/export-surface.ps1 b/src/ImageBuilder/export-surface.ps1
new file mode 100644
index 000000000000..e18f61403be3
--- /dev/null
+++ b/src/ImageBuilder/export-surface.ps1
@@ -0,0 +1,40 @@
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat)
+$ErrorActionPreference = 'Stop'
+
+$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
+if(-not $Isolated) {
+ Write-Host -ForegroundColor Green 'Creating isolated process...'
+ & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated
+ return
+}
+
+$dll = Join-Path $PSScriptRoot 'bin\Az.ImageBuilder.private.dll'
+if(-not (Test-Path $dll)) {
+ Write-Error "Unable to find output assembly in '$binFolder'."
+}
+$null = Import-Module -Name $dll
+
+$moduleName = 'Az.ImageBuilder'
+$exportsFolder = Join-Path $PSScriptRoot 'exports'
+$resourcesFolder = Join-Path $PSScriptRoot 'resources'
+
+Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent
+Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'"
+
+Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent
+Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'"
+
+Write-Host -ForegroundColor Green '-------------Done-------------'
\ No newline at end of file
diff --git a/src/ImageBuilder/exports/Get-AzImageBuilderRunOutput.ps1 b/src/ImageBuilder/exports/Get-AzImageBuilderRunOutput.ps1
new file mode 100644
index 000000000000..f0485458e991
--- /dev/null
+++ b/src/ImageBuilder/exports/Get-AzImageBuilderRunOutput.ps1
@@ -0,0 +1,186 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Get the specified run output for the specified image template resource
+.Description
+Get the specified run output for the specified image template resource
+.Example
+PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder
+
+Name Type
+---- ----
+image_lucas_1 Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+.Example
+PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx
+
+Name Type
+---- ----
+runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+.Example
+PS C:\> $result = Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx
+PS C:\> Get-AzImageBuilderRunOutput -InputObject $result
+
+Name Type
+---- ----
+runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuilderrunoutput
+#>
+function Get-AzImageBuilderRunOutput {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput])]
+[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
+param(
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Parameter(ParameterSetName='List', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Parameter(ParameterSetName='List', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the run output
+ ${RunOutputName},
+
+ [Parameter(ParameterSetName='Get')]
+ [Parameter(ParameterSetName='List')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String[]]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Get = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_Get';
+ GetViaIdentity = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_GetViaIdentity';
+ List = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_List';
+ }
+ if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/Get-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/Get-AzImageBuilderTemplate.ps1
new file mode 100644
index 000000000000..f27bc0cb9c2a
--- /dev/null
+++ b/src/ImageBuilder/exports/Get-AzImageBuilderTemplate.ps1
@@ -0,0 +1,198 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Get information about a virtual machine image template
+.Description
+Get information about a virtual machine image template
+.Example
+PS C:\> Get-AzImageBuilderTemplate
+
+Location Name Type
+-------- ---- ----
+eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates
+eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates
+eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates
+.Example
+PS C:\> Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder
+
+Location Name Type
+-------- ---- ----
+eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-ax01b7 Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-klcuav Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates
+eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-managedimg-managedimg Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-platform-managed Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-shareimg-managedimg Microsoft.VirtualMachineImages/imageTemplates
+.Example
+PS C:\> Get-AzImageBuilderTemplate -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder
+
+Location Name Type
+-------- ---- ----
+eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates
+.Example
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -ImageTemplateName template-name-ep5z7v
+PS C:\> Get-AzImageBuilderTemplate -InputObject $template
+
+Location Name Type
+-------- ---- ----
+eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuildertemplate
+#>
+function Get-AzImageBuilderTemplate {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])]
+[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
+param(
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Parameter(ParameterSetName='List1', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Get')]
+ [Parameter(ParameterSetName='List')]
+ [Parameter(ParameterSetName='List1')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String[]]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Get = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_Get';
+ GetViaIdentity = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_GetViaIdentity';
+ List = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_List';
+ List1 = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_List1';
+ }
+ if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/New-AzImageBuilderCustomizerObject.ps1 b/src/ImageBuilder/exports/New-AzImageBuilderCustomizerObject.ps1
new file mode 100644
index 000000000000..d9bb62593a9e
--- /dev/null
+++ b/src/ImageBuilder/exports/New-AzImageBuilderCustomizerObject.ps1
@@ -0,0 +1,237 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Describes a unit of image customization
+.Description
+Describes a unit of image customization
+.Example
+PS C:\> New-AzImageBuilderCustomizerObject -WindowsUpdateCustomizer -Filter ("BrowseOnly", "IsInstalled") -SearchCriterion "BrowseOnly=0 and IsInstalled=0" -UpdateLimit 100 -CustomizerName 'WindUpdate'
+
+Name Type Filter SearchCriterion UpdateLimit
+---- ---- ------ --------------- -----------
+WindUpdate WindowsUpdate {BrowseOnly, IsInstalled} BrowseOnly=0 and IsInstalled=0 100
+.Example
+PS C:\> New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName 'filecus' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' -Destination 'c:\\buildArtifacts\\index.html' -SourceUri 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html'
+
+Name Type Destination Sha256Checksum SourceUri
+---- ---- ----------- -------------- ---------
+filecus File c:\\buildArtifacts\\index.html ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html
+
+.Example
+PS C:\> $inline = @("mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt")
+PS C:\> New-AzImageBuilderCustomizerObject -PowerShellCustomizer -CustomizerName settingUpMgmtAgtPath -RunElevated $false -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 -Inline $inline
+
+Name Type Inline RunElevated ScriptUri Sha256Checksum ValidExitC e
+---- ---- ------ ----------- --------- -------------- --
+settingUpMgmtAgtPath PowerShell {mkdir c:\\buildActions, echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt} False ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+.Example
+PS C:\> New-AzImageBuilderCustomizerObject -RestartCustomizer -CustomizerName 'restcus' -RestartCommand 'shutdown /f /r /t 0 /c \"packer restart\"' -RestartCheckCommand 'powershell -command "& {Write-Output "restarted."}"' -RestartTimeout '10m'
+
+Name Type RestartCheckCommand RestartCommand RestartTimeout
+---- ---- ------------------- -------------- --------------
+restcus WindowsRestart powershell -command "& {Write-Output "restarted."}" shutdown /f /r /t 0 /c \"packer restart\" 10m
+.Example
+PS C:\> New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName downloadBuildArtifacts -ScriptUri "https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh" -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+
+Name Type Inline ScriptUri Sha256Checksum
+---- ---- ------ --------- --------------
+downloadBuildArtifacts Shell https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderCustomizerObject
+#>
+function New-AzImageBuilderCustomizerObject {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer])]
+[CmdletBinding(DefaultParameterSetName='ShellCustomizer', PositionalBinding=$false)]
+param(
+ [Parameter(Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Friendly Name to provide context on what this customization step does.
+ ${CustomizerName},
+
+ [Parameter(ParameterSetName='ShellCustomizer', Mandatory)]
+ [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory)]
+ [Parameter(ParameterSetName='FileCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # SHA256 checksum of the shell script provided in the scriptUri field.
+ ${Sha256Checksum},
+
+ [Parameter(ParameterSetName='ShellCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Runs a shell script during the customization phase (Linux).
+ # Corresponds to Packer shell provisioner.
+ # Exactly one of 'scriptUri' or 'inline' can be specified.
+ ${ShellCustomizer},
+
+ [Parameter(ParameterSetName='ShellCustomizer')]
+ [Parameter(ParameterSetName='PowerShellCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String[]]
+ # Array of shell commands to execute.
+ ${Inline},
+
+ [Parameter(ParameterSetName='ShellCustomizer')]
+ [Parameter(ParameterSetName='PowerShellCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # URI of the shell script to be run for customizing.
+ # It can be a github link, SAS URI for Azure Storage, etc.
+ ${ScriptUri},
+
+ [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Runs the specified PowerShell on the VM (Windows).
+ # Corresponds to Packer powershell provisioner.
+ # Exactly one of 'scriptUri' or 'inline' can be specified.
+ ${PowerShellCustomizer},
+
+ [Parameter(ParameterSetName='PowerShellCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Boolean]
+ # If specified, the PowerShell script will be run with elevated privileges.
+ ${RunElevated},
+
+ [Parameter(ParameterSetName='PowerShellCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32[]]
+ # Valid exit codes for the PowerShell script.
+ # [Default: 0].
+ ${ValidExitCode},
+
+ [Parameter(ParameterSetName='FileCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Uploads files to VMs (Linux, Windows).
+ # Corresponds to Packer file provisioner.
+ ${FileCustomizer},
+
+ [Parameter(ParameterSetName='FileCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM.
+ ${Destination},
+
+ [Parameter(ParameterSetName='FileCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # The URI of the file to be uploaded for customizing the VM.
+ # It can be a github link, SAS URI for Azure Storage, etc.
+ ${SourceUri},
+
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Installs Windows Updates.
+ # Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update).
+ ${WindowsUpdateCustomizer},
+
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String[]]
+ # Array of filters to select updates to apply.
+ # Omit or specify empty array to use the default (no filter).
+ # Refer to above link for examples and detailed description of this field.
+ ${Filter},
+
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Criteria to search updates.
+ # Omit or specify empty string to use the default (search all).
+ # Refer to above link for examples and detailed description of this field.
+ ${SearchCriterion},
+
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32]
+ # Maximum number of updates to apply at a time.
+ # Omit or specify 0 to use the default (1000).
+ ${UpdateLimit},
+
+ [Parameter(ParameterSetName='RestartCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Reboots a VM and waits for it to come back online (Windows).
+ # Corresponds to Packer windows-restart provisioner.
+ ${RestartCustomizer},
+
+ [Parameter(ParameterSetName='RestartCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Command to check if restart succeeded [Default: ''].
+ ${RestartCheckCommand},
+
+ [Parameter(ParameterSetName='RestartCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Command to execute the restart [Default: 'shutdown /r /f /t 0 /c packer restart']
+ ${RestartCommand},
+
+ [Parameter(ParameterSetName='RestartCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Restart timeout specified as a string of magnitude and unit, e.g.
+ # '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'].
+ ${RestartTimeout}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ ShellCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ PowerShellCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ FileCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ WindowsUpdateCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ RestartCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/New-AzImageBuilderDistributorObject.ps1 b/src/ImageBuilder/exports/New-AzImageBuilderDistributorObject.ps1
new file mode 100644
index 000000000000..e6a8fdf9196d
--- /dev/null
+++ b/src/ImageBuilder/exports/New-AzImageBuilderDistributorObject.ps1
@@ -0,0 +1,156 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Generic distribution object
+.Description
+Generic distribution object
+.Example
+PS C:\> New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{tag='lucasManage'} -ImageId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare -RunOutputName luacas-runout -Location eastus
+
+RunOutputName Type ImageId Location
+------------- ---- ------- --------
+luacas-runout ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare eastus
+.Example
+PS C:\> New-AzImageBuilderDistributorObject -ArtifactTag @{tag='vhd'} -VhdDistributor -RunOutputName image-vhd
+
+RunOutputName Type
+------------- ----
+image-vhd Vhd
+.Example
+PS C:\> New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share' -ReplicationRegion eastus2 -RunOutputName 'outname' -ExcludeFromLatest $false
+
+RunOutputName Type ExcludeFromLatest GalleryImageId ReplicationRegi
+ on
+------------- ---- ----------------- -------------- ---------------
+outname SharedImage False /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share {eastus2}
+
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderDistributorObject
+#>
+function New-AzImageBuilderDistributorObject {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor])]
+[CmdletBinding(DefaultParameterSetName='ManagedImageDistributor', PositionalBinding=$false)]
+param(
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Collections.Hashtable]
+ # Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ ${ArtifactTag},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # The name to be used for the associated RunOutput.
+ ${RunOutputName},
+
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Distribute as a Managed Disk Image.
+ ${ManagedImageDistributor},
+
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource Id of the Managed Disk Image.
+ ${ImageId},
+
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Azure location for the image, should match if image already exists.
+ ${Location},
+
+ [Parameter(ParameterSetName='VhdDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Distribute via VHD in a storage account.
+ ${VhdDistributor},
+
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Distribute via Shared Image Gallery.
+ ${SharedImageDistributor},
+
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Boolean]
+ # Flag that indicates whether created image version should be excluded from latest.
+ # Omit to use the default (false).
+ ${ExcludeFromLatest},
+
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String[]]
+ # A list of regions that the image will be replicated to.
+ ${ReplicationRegion},
+
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource Id of the Shared Image Gallery image.
+ ${GalleryImageId},
+
+ [Parameter(ParameterSetName='SharedImageDistributor')]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType]
+ # Storage account type to be used to store the shared image.
+ # Omit to use the default (Standard_LRS).
+ ${StorageAccountType}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ ManagedImageDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject';
+ VhdDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject';
+ SharedImageDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject';
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/New-AzImageBuilderSourceObject.ps1 b/src/ImageBuilder/exports/New-AzImageBuilderSourceObject.ps1
new file mode 100644
index 000000000000..07e928016492
--- /dev/null
+++ b/src/ImageBuilder/exports/New-AzImageBuilderSourceObject.ps1
@@ -0,0 +1,165 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Describes a virtual machine image source for building, customizing and distributing.
+.Description
+Describes a virtual machine image source for building, customizing and distributing.
+.Example
+PS C:\> $imageid = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image'
+PS C:\> New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $imageid
+
+Type ImageId
+---- -------
+ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image
+.Example
+PS C:\> New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0
+
+Type ImageVersionId
+---- --------------
+SharedImageVersion /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0
+.Example
+PS C:\> New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest'
+
+Type Offer Publisher Sku Version
+---- ----- --------- --- -------
+PlatformImage UbuntuServer Canonical 18.04-LTS latest
+
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderSourceObject
+#>
+function New-AzImageBuilderSourceObject {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource])]
+[CmdletBinding(DefaultParameterSetName='ManagedImage', PositionalBinding=$false)]
+param(
+ [Parameter(ParameterSetName='ManagedImage', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Describes an image source that is a managed image in customer subscription.
+ ${SourceTypeManagedImage},
+
+ [Parameter(ParameterSetName='ManagedImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # ARM resource id of the managed image in customer subscription.
+ ${ImageId},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)]
+ [Parameter(ParameterSetName='PlatformImage', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${SourceTypePlatformImage},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Name of the purchase plan.
+ ${PlanName},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Product of the purchase plan.
+ ${PlanProduct},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Publisher of the purchase plan.
+ ${PlanPublisher},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo')]
+ [Parameter(ParameterSetName='PlatformImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${Offer},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo')]
+ [Parameter(ParameterSetName='PlatformImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${Publisher},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo')]
+ [Parameter(ParameterSetName='PlatformImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${Sku},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo')]
+ [Parameter(ParameterSetName='PlatformImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${Version},
+
+ [Parameter(ParameterSetName='SharedImageVersion', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Describes an image source that is an image version in a shared image gallery.
+ ${SourceTypeSharedImageVersion},
+
+ [Parameter(ParameterSetName='SharedImageVersion')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # ARM resource id of the image version in the shared image gallery.
+ ${ImageVersionId}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ ManagedImage = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject';
+ PlatformImagePlanInfo = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject';
+ PlatformImage = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject';
+ SharedImageVersion = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject';
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/New-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/New-AzImageBuilderTemplate.ps1
new file mode 100644
index 000000000000..8459e2dd29ff
--- /dev/null
+++ b/src/ImageBuilder/exports/New-AzImageBuilderTemplate.ps1
@@ -0,0 +1,294 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Create a virtual machine image template
+.Description
+Create a virtual machine image template
+.Example
+PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest'
+PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false
+PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93'
+PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity'
+PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity
+
+Location Name Type
+-------- ---- ----
+PlanInfoPlanName :
+PlanInfoPlanPublisher :
+Sku : 18.04-LTS
+Version : latest
+PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan
+
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+CUSTOMIZE : Specifies the properties used to describe the customization steps of the image, like Image source etc.
+ Type : The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer
+ [Name ]: Friendly Name to provide context on what this customization step does
+
+DISTRIBUTE : The distribution targets where the image output needs to go to.
+ RunOutputName : The name to be used for the associated RunOutput.
+ Type : Type of distribution.
+ [ArtifactTag ]: Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ [(Any) ]: This indicates any property can be added to this object.
+
+SOURCE : Describes a virtual machine image source for building, customizing and distributing.
+ Type : Specifies the type of source image you want to start with.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderTemplate
+#>
+function New-AzImageBuilderTemplate {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])]
+[CmdletBinding(DefaultParameterSetName='Name', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+param(
+ [Parameter(Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template.
+ ${ImageTemplateName},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ ${SubscriptionId},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]]
+ # The distribution targets where the image output needs to go to.
+ # To construct, see NOTES section for DISTRIBUTE properties and create a hash table.
+ ${Distribute},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource]
+ # Describes a virtual machine image source for building, customizing and distributing.
+ # To construct, see NOTES section for SOURCE properties and create a hash table.
+ ${Source},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities]))]
+ [System.String]
+ # The id of user assigned identity.
+ ${UserAssignedIdentityId},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource location.
+ ${Location},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32]
+ # Maximum duration to wait while building the image template.
+ # Omit or specify 0 to use the default (4 hours).
+ ${BuildTimeoutInMinute},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]]
+ # Specifies the properties used to describe the customization steps of the image, like Image source etc.
+ # To construct, see NOTES section for CUSTOMIZE properties and create a hash table.
+ ${Customize},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.DateTime]
+ # End time of the last run (UTC).
+ ${LastRunStatusEndTime},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Verbose information about the last run state.
+ ${LastRunStatusMessage},
+
+ [Parameter()]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState]
+ # State of the last run.
+ ${LastRunStatusRunState},
+
+ [Parameter()]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState]
+ # Sub-state of the last run.
+ ${LastRunStatusRunSubState},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.DateTime]
+ # Start time of the last run (UTC).
+ ${LastRunStatusStartTime},
+
+ [Parameter()]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode]
+ # Error code of the provisioning failure.
+ ${ProvisioningErrorCode},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Verbose error message about the provisioning failure.
+ ${ProvisioningErrorMessage},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags]))]
+ [System.Collections.Hashtable]
+ # Resource tags.
+ ${Tag},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32]
+ # Size of the OS disk in GB.
+ # Omit or specify 0 to use Azure's default OS disk size.
+ ${VMProfileOsdiskSizeInGb},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Size of the virtual machine used to build, customize and capture images.
+ # Omit or specify empty string to use the default (Standard_D1_v2).
+ ${VMProfileVmSize},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource id of a pre-existing subnet.
+ ${VnetConfigSubnetId},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # region HideParameter
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ # endregion HideParameter
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Name = 'Az.ImageBuilder.custom\New-AzImageBuilderTemplate';
+ }
+ if (('Name') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/ProxyCmdletDefinitions.ps1 b/src/ImageBuilder/exports/ProxyCmdletDefinitions.ps1
new file mode 100644
index 000000000000..40c96ffd42c2
--- /dev/null
+++ b/src/ImageBuilder/exports/ProxyCmdletDefinitions.ps1
@@ -0,0 +1,1797 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Get the specified run output for the specified image template resource
+.Description
+Get the specified run output for the specified image template resource
+.Example
+PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder
+
+Name Type
+---- ----
+image_lucas_1 Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+.Example
+PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx
+
+Name Type
+---- ----
+runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+.Example
+PS C:\> $result = Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx
+PS C:\> Get-AzImageBuilderRunOutput -InputObject $result
+
+Name Type
+---- ----
+runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuilderrunoutput
+#>
+function Get-AzImageBuilderRunOutput {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput])]
+[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
+param(
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Parameter(ParameterSetName='List', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Parameter(ParameterSetName='List', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the run output
+ ${RunOutputName},
+
+ [Parameter(ParameterSetName='Get')]
+ [Parameter(ParameterSetName='List')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String[]]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Get = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_Get';
+ GetViaIdentity = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_GetViaIdentity';
+ List = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_List';
+ }
+ if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Get information about a virtual machine image template
+.Description
+Get information about a virtual machine image template
+.Example
+PS C:\> Get-AzImageBuilderTemplate
+
+Location Name Type
+-------- ---- ----
+eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates
+eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates
+eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates
+.Example
+PS C:\> Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder
+
+Location Name Type
+-------- ---- ----
+eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-ax01b7 Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-klcuav Microsoft.VirtualMachineImages/imageTemplates
+eastus template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates
+eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-managedimg-managedimg Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-platform-managed Microsoft.VirtualMachineImages/imageTemplates
+eastus tmpl-shareimg-managedimg Microsoft.VirtualMachineImages/imageTemplates
+.Example
+PS C:\> Get-AzImageBuilderTemplate -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder
+
+Location Name Type
+-------- ---- ----
+eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates
+.Example
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -ImageTemplateName template-name-ep5z7v
+PS C:\> Get-AzImageBuilderTemplate -InputObject $template
+
+Location Name Type
+-------- ---- ----
+eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuildertemplate
+#>
+function Get-AzImageBuilderTemplate {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])]
+[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
+param(
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Get', Mandatory)]
+ [Parameter(ParameterSetName='List1', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Get')]
+ [Parameter(ParameterSetName='List')]
+ [Parameter(ParameterSetName='List1')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String[]]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Get = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_Get';
+ GetViaIdentity = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_GetViaIdentity';
+ List = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_List';
+ List1 = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_List1';
+ }
+ if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Delete a virtual machine image template
+.Description
+Delete a virtual machine image template
+.Example
+PS C:\> Remove-AzImageBuilderTemplate -ImageTemplateName template-name-dmt6ze -ResourceGroupName wyunchi-imagebuilder
+
+.Example
+PS C:\> $template = Get-AzImageBuilderTemplate -ImageTemplateName template-name-3uo8p6 -ResourceGroupName wyunchi-imagebuilder
+PS C:\> Remove-AzImageBuilderTemplate -InputObject $template
+
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+System.Boolean
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/remove-azimagebuildertemplate
+#>
+function Remove-AzImageBuilderTemplate {
+[OutputType([System.Boolean])]
+[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+param(
+ [Parameter(ParameterSetName='Delete', Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Delete', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Delete')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Returns true when the command succeeds
+ ${PassThru},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Delete = 'Az.ImageBuilder.private\Remove-AzImageBuilderTemplate_Delete';
+ DeleteViaIdentity = 'Az.ImageBuilder.private\Remove-AzImageBuilderTemplate_DeleteViaIdentity';
+ }
+ if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Create artifacts from a existing image template
+.Description
+Create artifacts from a existing image template
+.Example
+PS C:\> Start-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+
+.Example
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+PS C:\> Start-AzImageBuilderTemplate -InputObject $template
+
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+System.Boolean
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/start-azimagebuildertemplate
+#>
+function Start-AzImageBuilderTemplate {
+[OutputType([System.Boolean])]
+[CmdletBinding(DefaultParameterSetName='Run', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+param(
+ [Parameter(ParameterSetName='Run', Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Run', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Run')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='RunViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Returns true when the command succeeds
+ ${PassThru},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Run = 'Az.ImageBuilder.private\Start-AzImageBuilderTemplate_Run';
+ RunViaIdentity = 'Az.ImageBuilder.private\Start-AzImageBuilderTemplate_RunViaIdentity';
+ }
+ if (('Run') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Cancel the long running image build based on the image template
+.Description
+Cancel the long running image build based on the image template
+.Example
+PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob
+
+Id Name PSJobTypeName State HasMoreData Location Command
+-- ---- ------------- ----- ----------- -------- -------
+1 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp…
+
+PS C:\> Stop-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder
+
+.Example
+PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob
+
+Id Name PSJobTypeName State HasMoreData Location Command
+-- ---- ------------- ----- ----------- -------- -------
+2 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp…
+
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+PS C:\> Stop-AzImageBuilderTemplate -InputObject $template
+
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+System.Boolean
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/stop-azimagebuildertemplate
+#>
+function Stop-AzImageBuilderTemplate {
+[OutputType([System.Boolean])]
+[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+param(
+ [Parameter(ParameterSetName='Cancel', Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Cancel', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Cancel')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Returns true when the command succeeds
+ ${PassThru},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Cancel = 'Az.ImageBuilder.private\Stop-AzImageBuilderTemplate_Cancel';
+ CancelViaIdentity = 'Az.ImageBuilder.private\Stop-AzImageBuilderTemplate_CancelViaIdentity';
+ }
+ if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Describes a unit of image customization
+.Description
+Describes a unit of image customization
+.Example
+PS C:\> New-AzImageBuilderCustomizerObject -WindowsUpdateCustomizer -Filter ("BrowseOnly", "IsInstalled") -SearchCriterion "BrowseOnly=0 and IsInstalled=0" -UpdateLimit 100 -CustomizerName 'WindUpdate'
+
+Name Type Filter SearchCriterion UpdateLimit
+---- ---- ------ --------------- -----------
+WindUpdate WindowsUpdate {BrowseOnly, IsInstalled} BrowseOnly=0 and IsInstalled=0 100
+.Example
+PS C:\> New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName 'filecus' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' -Destination 'c:\\buildArtifacts\\index.html' -SourceUri 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html'
+
+Name Type Destination Sha256Checksum SourceUri
+---- ---- ----------- -------------- ---------
+filecus File c:\\buildArtifacts\\index.html ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html
+
+.Example
+PS C:\> $inline = @("mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt")
+PS C:\> New-AzImageBuilderCustomizerObject -PowerShellCustomizer -CustomizerName settingUpMgmtAgtPath -RunElevated $false -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 -Inline $inline
+
+Name Type Inline RunElevated ScriptUri Sha256Checksum ValidExitC e
+---- ---- ------ ----------- --------- -------------- --
+settingUpMgmtAgtPath PowerShell {mkdir c:\\buildActions, echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt} False ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+.Example
+PS C:\> New-AzImageBuilderCustomizerObject -RestartCustomizer -CustomizerName 'restcus' -RestartCommand 'shutdown /f /r /t 0 /c \"packer restart\"' -RestartCheckCommand 'powershell -command "& {Write-Output "restarted."}"' -RestartTimeout '10m'
+
+Name Type RestartCheckCommand RestartCommand RestartTimeout
+---- ---- ------------------- -------------- --------------
+restcus WindowsRestart powershell -command "& {Write-Output "restarted."}" shutdown /f /r /t 0 /c \"packer restart\" 10m
+.Example
+PS C:\> New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName downloadBuildArtifacts -ScriptUri "https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh" -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+
+Name Type Inline ScriptUri Sha256Checksum
+---- ---- ------ --------- --------------
+downloadBuildArtifacts Shell https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93
+
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderCustomizerObject
+#>
+function New-AzImageBuilderCustomizerObject {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer])]
+[CmdletBinding(DefaultParameterSetName='ShellCustomizer', PositionalBinding=$false)]
+param(
+ [Parameter(Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Friendly Name to provide context on what this customization step does.
+ ${CustomizerName},
+
+ [Parameter(ParameterSetName='ShellCustomizer', Mandatory)]
+ [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory)]
+ [Parameter(ParameterSetName='FileCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # SHA256 checksum of the shell script provided in the scriptUri field.
+ ${Sha256Checksum},
+
+ [Parameter(ParameterSetName='ShellCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Runs a shell script during the customization phase (Linux).
+ # Corresponds to Packer shell provisioner.
+ # Exactly one of 'scriptUri' or 'inline' can be specified.
+ ${ShellCustomizer},
+
+ [Parameter(ParameterSetName='ShellCustomizer')]
+ [Parameter(ParameterSetName='PowerShellCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String[]]
+ # Array of shell commands to execute.
+ ${Inline},
+
+ [Parameter(ParameterSetName='ShellCustomizer')]
+ [Parameter(ParameterSetName='PowerShellCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # URI of the shell script to be run for customizing.
+ # It can be a github link, SAS URI for Azure Storage, etc.
+ ${ScriptUri},
+
+ [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Runs the specified PowerShell on the VM (Windows).
+ # Corresponds to Packer powershell provisioner.
+ # Exactly one of 'scriptUri' or 'inline' can be specified.
+ ${PowerShellCustomizer},
+
+ [Parameter(ParameterSetName='PowerShellCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Boolean]
+ # If specified, the PowerShell script will be run with elevated privileges.
+ ${RunElevated},
+
+ [Parameter(ParameterSetName='PowerShellCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32[]]
+ # Valid exit codes for the PowerShell script.
+ # [Default: 0].
+ ${ValidExitCode},
+
+ [Parameter(ParameterSetName='FileCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Uploads files to VMs (Linux, Windows).
+ # Corresponds to Packer file provisioner.
+ ${FileCustomizer},
+
+ [Parameter(ParameterSetName='FileCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM.
+ ${Destination},
+
+ [Parameter(ParameterSetName='FileCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # The URI of the file to be uploaded for customizing the VM.
+ # It can be a github link, SAS URI for Azure Storage, etc.
+ ${SourceUri},
+
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Installs Windows Updates.
+ # Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update).
+ ${WindowsUpdateCustomizer},
+
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String[]]
+ # Array of filters to select updates to apply.
+ # Omit or specify empty array to use the default (no filter).
+ # Refer to above link for examples and detailed description of this field.
+ ${Filter},
+
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Criteria to search updates.
+ # Omit or specify empty string to use the default (search all).
+ # Refer to above link for examples and detailed description of this field.
+ ${SearchCriterion},
+
+ [Parameter(ParameterSetName='WindowsUpdateCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32]
+ # Maximum number of updates to apply at a time.
+ # Omit or specify 0 to use the default (1000).
+ ${UpdateLimit},
+
+ [Parameter(ParameterSetName='RestartCustomizer', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Reboots a VM and waits for it to come back online (Windows).
+ # Corresponds to Packer windows-restart provisioner.
+ ${RestartCustomizer},
+
+ [Parameter(ParameterSetName='RestartCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Command to check if restart succeeded [Default: ''].
+ ${RestartCheckCommand},
+
+ [Parameter(ParameterSetName='RestartCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Command to execute the restart [Default: 'shutdown /r /f /t 0 /c packer restart']
+ ${RestartCommand},
+
+ [Parameter(ParameterSetName='RestartCustomizer')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Restart timeout specified as a string of magnitude and unit, e.g.
+ # '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'].
+ ${RestartTimeout}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ ShellCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ PowerShellCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ FileCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ WindowsUpdateCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ RestartCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject';
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Generic distribution object
+.Description
+Generic distribution object
+.Example
+PS C:\> New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{tag='lucasManage'} -ImageId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare -RunOutputName luacas-runout -Location eastus
+
+RunOutputName Type ImageId Location
+------------- ---- ------- --------
+luacas-runout ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare eastus
+.Example
+PS C:\> New-AzImageBuilderDistributorObject -ArtifactTag @{tag='vhd'} -VhdDistributor -RunOutputName image-vhd
+
+RunOutputName Type
+------------- ----
+image-vhd Vhd
+.Example
+PS C:\> New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share' -ReplicationRegion eastus2 -RunOutputName 'outname' -ExcludeFromLatest $false
+
+RunOutputName Type ExcludeFromLatest GalleryImageId ReplicationRegi
+ on
+------------- ---- ----------------- -------------- ---------------
+outname SharedImage False /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share {eastus2}
+
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderDistributorObject
+#>
+function New-AzImageBuilderDistributorObject {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor])]
+[CmdletBinding(DefaultParameterSetName='ManagedImageDistributor', PositionalBinding=$false)]
+param(
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Collections.Hashtable]
+ # Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ ${ArtifactTag},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # The name to be used for the associated RunOutput.
+ ${RunOutputName},
+
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Distribute as a Managed Disk Image.
+ ${ManagedImageDistributor},
+
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource Id of the Managed Disk Image.
+ ${ImageId},
+
+ [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Azure location for the image, should match if image already exists.
+ ${Location},
+
+ [Parameter(ParameterSetName='VhdDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Distribute via VHD in a storage account.
+ ${VhdDistributor},
+
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Distribute via Shared Image Gallery.
+ ${SharedImageDistributor},
+
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Boolean]
+ # Flag that indicates whether created image version should be excluded from latest.
+ # Omit to use the default (false).
+ ${ExcludeFromLatest},
+
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String[]]
+ # A list of regions that the image will be replicated to.
+ ${ReplicationRegion},
+
+ [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource Id of the Shared Image Gallery image.
+ ${GalleryImageId},
+
+ [Parameter(ParameterSetName='SharedImageDistributor')]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType]
+ # Storage account type to be used to store the shared image.
+ # Omit to use the default (Standard_LRS).
+ ${StorageAccountType}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ ManagedImageDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject';
+ VhdDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject';
+ SharedImageDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject';
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Describes a virtual machine image source for building, customizing and distributing.
+.Description
+Describes a virtual machine image source for building, customizing and distributing.
+.Example
+PS C:\> $imageid = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image'
+PS C:\> New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $imageid
+
+Type ImageId
+---- -------
+ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image
+.Example
+PS C:\> New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0
+
+Type ImageVersionId
+---- --------------
+SharedImageVersion /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0
+.Example
+PS C:\> New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest'
+
+Type Offer Publisher Sku Version
+---- ----- --------- --- -------
+PlatformImage UbuntuServer Canonical 18.04-LTS latest
+
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderSourceObject
+#>
+function New-AzImageBuilderSourceObject {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource])]
+[CmdletBinding(DefaultParameterSetName='ManagedImage', PositionalBinding=$false)]
+param(
+ [Parameter(ParameterSetName='ManagedImage', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Describes an image source that is a managed image in customer subscription.
+ ${SourceTypeManagedImage},
+
+ [Parameter(ParameterSetName='ManagedImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # ARM resource id of the managed image in customer subscription.
+ ${ImageId},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)]
+ [Parameter(ParameterSetName='PlatformImage', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${SourceTypePlatformImage},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Name of the purchase plan.
+ ${PlanName},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Product of the purchase plan.
+ ${PlanProduct},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Publisher of the purchase plan.
+ ${PlanPublisher},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo')]
+ [Parameter(ParameterSetName='PlatformImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${Offer},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo')]
+ [Parameter(ParameterSetName='PlatformImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${Publisher},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo')]
+ [Parameter(ParameterSetName='PlatformImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${Sku},
+
+ [Parameter(ParameterSetName='PlatformImagePlanInfo')]
+ [Parameter(ParameterSetName='PlatformImage')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).
+ ${Version},
+
+ [Parameter(ParameterSetName='SharedImageVersion', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Management.Automation.SwitchParameter]
+ # Describes an image source that is an image version in a shared image gallery.
+ ${SourceTypeSharedImageVersion},
+
+ [Parameter(ParameterSetName='SharedImageVersion')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # ARM resource id of the image version in the shared image gallery.
+ ${ImageVersionId}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ ManagedImage = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject';
+ PlatformImagePlanInfo = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject';
+ PlatformImage = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject';
+ SharedImageVersion = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject';
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Create a virtual machine image template
+.Description
+Create a virtual machine image template
+.Example
+PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest'
+PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false
+PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93'
+PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity'
+PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity
+
+Location Name Type
+-------- ---- ----
+PlanInfoPlanName :
+PlanInfoPlanPublisher :
+Sku : 18.04-LTS
+Version : latest
+PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan
+
+.Outputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+CUSTOMIZE : Specifies the properties used to describe the customization steps of the image, like Image source etc.
+ Type : The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer
+ [Name ]: Friendly Name to provide context on what this customization step does
+
+DISTRIBUTE : The distribution targets where the image output needs to go to.
+ RunOutputName : The name to be used for the associated RunOutput.
+ Type : Type of distribution.
+ [ArtifactTag ]: Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ [(Any) ]: This indicates any property can be added to this object.
+
+SOURCE : Describes a virtual machine image source for building, customizing and distributing.
+ Type : Specifies the type of source image you want to start with.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderTemplate
+#>
+function New-AzImageBuilderTemplate {
+[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])]
+[CmdletBinding(DefaultParameterSetName='Name', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+param(
+ [Parameter(Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template.
+ ${ImageTemplateName},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ ${SubscriptionId},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]]
+ # The distribution targets where the image output needs to go to.
+ # To construct, see NOTES section for DISTRIBUTE properties and create a hash table.
+ ${Distribute},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource]
+ # Describes a virtual machine image source for building, customizing and distributing.
+ # To construct, see NOTES section for SOURCE properties and create a hash table.
+ ${Source},
+
+ [Parameter(Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities]))]
+ [System.String]
+ # The id of user assigned identity.
+ ${UserAssignedIdentityId},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource location.
+ ${Location},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32]
+ # Maximum duration to wait while building the image template.
+ # Omit or specify 0 to use the default (4 hours).
+ ${BuildTimeoutInMinute},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]]
+ # Specifies the properties used to describe the customization steps of the image, like Image source etc.
+ # To construct, see NOTES section for CUSTOMIZE properties and create a hash table.
+ ${Customize},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.DateTime]
+ # End time of the last run (UTC).
+ ${LastRunStatusEndTime},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Verbose information about the last run state.
+ ${LastRunStatusMessage},
+
+ [Parameter()]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState]
+ # State of the last run.
+ ${LastRunStatusRunState},
+
+ [Parameter()]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState]
+ # Sub-state of the last run.
+ ${LastRunStatusRunSubState},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.DateTime]
+ # Start time of the last run (UTC).
+ ${LastRunStatusStartTime},
+
+ [Parameter()]
+ [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode])]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode]
+ # Error code of the provisioning failure.
+ ${ProvisioningErrorCode},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Verbose error message about the provisioning failure.
+ ${ProvisioningErrorMessage},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags]))]
+ [System.Collections.Hashtable]
+ # Resource tags.
+ ${Tag},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.Int32]
+ # Size of the OS disk in GB.
+ # Omit or specify 0 to use Azure's default OS disk size.
+ ${VMProfileOsdiskSizeInGb},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Size of the virtual machine used to build, customize and capture images.
+ # Omit or specify empty string to use the default (Standard_D1_v2).
+ ${VMProfileVmSize},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')]
+ [System.String]
+ # Resource id of a pre-existing subnet.
+ ${VnetConfigSubnetId},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # region HideParameter
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ # endregion HideParameter
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Name = 'Az.ImageBuilder.custom\New-AzImageBuilderTemplate';
+ }
+ if (('Name') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/Remove-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/Remove-AzImageBuilderTemplate.ps1
new file mode 100644
index 000000000000..52d5fba73206
--- /dev/null
+++ b/src/ImageBuilder/exports/Remove-AzImageBuilderTemplate.ps1
@@ -0,0 +1,183 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Delete a virtual machine image template
+.Description
+Delete a virtual machine image template
+.Example
+PS C:\> Remove-AzImageBuilderTemplate -ImageTemplateName template-name-dmt6ze -ResourceGroupName wyunchi-imagebuilder
+
+.Example
+PS C:\> $template = Get-AzImageBuilderTemplate -ImageTemplateName template-name-3uo8p6 -ResourceGroupName wyunchi-imagebuilder
+PS C:\> Remove-AzImageBuilderTemplate -InputObject $template
+
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+System.Boolean
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/remove-azimagebuildertemplate
+#>
+function Remove-AzImageBuilderTemplate {
+[OutputType([System.Boolean])]
+[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+param(
+ [Parameter(ParameterSetName='Delete', Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Delete', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Delete')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Returns true when the command succeeds
+ ${PassThru},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Delete = 'Az.ImageBuilder.private\Remove-AzImageBuilderTemplate_Delete';
+ DeleteViaIdentity = 'Az.ImageBuilder.private\Remove-AzImageBuilderTemplate_DeleteViaIdentity';
+ }
+ if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/Start-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/Start-AzImageBuilderTemplate.ps1
new file mode 100644
index 000000000000..3ae5604c7174
--- /dev/null
+++ b/src/ImageBuilder/exports/Start-AzImageBuilderTemplate.ps1
@@ -0,0 +1,183 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Create artifacts from a existing image template
+.Description
+Create artifacts from a existing image template
+.Example
+PS C:\> Start-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+
+.Example
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+PS C:\> Start-AzImageBuilderTemplate -InputObject $template
+
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+System.Boolean
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/start-azimagebuildertemplate
+#>
+function Start-AzImageBuilderTemplate {
+[OutputType([System.Boolean])]
+[CmdletBinding(DefaultParameterSetName='Run', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+param(
+ [Parameter(ParameterSetName='Run', Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Run', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Run')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='RunViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Returns true when the command succeeds
+ ${PassThru},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Run = 'Az.ImageBuilder.private\Start-AzImageBuilderTemplate_Run';
+ RunViaIdentity = 'Az.ImageBuilder.private\Start-AzImageBuilderTemplate_RunViaIdentity';
+ }
+ if (('Run') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/Stop-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/Stop-AzImageBuilderTemplate.ps1
new file mode 100644
index 000000000000..554dc8622b64
--- /dev/null
+++ b/src/ImageBuilder/exports/Stop-AzImageBuilderTemplate.ps1
@@ -0,0 +1,195 @@
+
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+
+<#
+.Synopsis
+Cancel the long running image build based on the image template
+.Description
+Cancel the long running image build based on the image template
+.Example
+PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob
+
+Id Name PSJobTypeName State HasMoreData Location Command
+-- ---- ------------- ----- ----------- -------- -------
+1 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp…
+
+PS C:\> Stop-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder
+
+.Example
+PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob
+
+Id Name PSJobTypeName State HasMoreData Location Command
+-- ---- ------------- ----- ----------- -------- -------
+2 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp…
+
+PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg
+PS C:\> Stop-AzImageBuilderTemplate -InputObject $template
+
+
+.Inputs
+Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity
+.Outputs
+System.Boolean
+.Notes
+COMPLEX PARAMETER PROPERTIES
+
+To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.
+
+INPUTOBJECT : Identity Parameter
+ [Id ]: Resource identity path
+ [ImageTemplateName ]: The name of the image Template
+ [ResourceGroupName ]: The name of the resource group.
+ [RunOutputName ]: The name of the run output
+ [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
+.Link
+https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/stop-azimagebuildertemplate
+#>
+function Stop-AzImageBuilderTemplate {
+[OutputType([System.Boolean])]
+[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
+param(
+ [Parameter(ParameterSetName='Cancel', Mandatory)]
+ [Alias('Name')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the image Template
+ ${ImageTemplateName},
+
+ [Parameter(ParameterSetName='Cancel', Mandatory)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [System.String]
+ # The name of the resource group.
+ ${ResourceGroupName},
+
+ [Parameter(ParameterSetName='Cancel')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
+ [System.String]
+ # Subscription credentials which uniquely identify Microsoft Azure subscription.
+ # The subscription Id forms part of the URI for every service call.
+ ${SubscriptionId},
+
+ [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity]
+ # Identity Parameter
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
+ ${InputObject},
+
+ [Parameter()]
+ [Alias('AzureRMContext', 'AzureCredential')]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')]
+ [System.Management.Automation.PSObject]
+ # The credentials, account, tenant, and subscription used for communication with Azure.
+ ${DefaultProfile},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command as a job
+ ${AsJob},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Wait for .NET debugger to attach
+ ${Break},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
+ ${HttpPipelineAppend},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]]
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
+ ${HttpPipelinePrepend},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Run the command asynchronously
+ ${NoWait},
+
+ [Parameter()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Returns true when the command succeeds
+ ${PassThru},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Uri]
+ # The URI for the proxy server to use
+ ${Proxy},
+
+ [Parameter(DontShow)]
+ [ValidateNotNull()]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.PSCredential]
+ # Credentials for a proxy server to use for the remote call
+ ${ProxyCredential},
+
+ [Parameter(DontShow)]
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')]
+ [System.Management.Automation.SwitchParameter]
+ # Use the default credentials for the proxy
+ ${ProxyUseDefaultCredentials}
+)
+
+begin {
+ try {
+ $outBuffer = $null
+ if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {
+ $PSBoundParameters['OutBuffer'] = 1
+ }
+ $parameterSet = $PSCmdlet.ParameterSetName
+ $mapping = @{
+ Cancel = 'Az.ImageBuilder.private\Stop-AzImageBuilderTemplate_Cancel';
+ CancelViaIdentity = 'Az.ImageBuilder.private\Stop-AzImageBuilderTemplate_CancelViaIdentity';
+ }
+ if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
+ $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
+ }
+ $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
+ $scriptCmd = {& $wrappedCmd @PSBoundParameters}
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
+ $steppablePipeline.Begin($PSCmdlet)
+ } catch {
+ throw
+ }
+}
+
+process {
+ try {
+ $steppablePipeline.Process($_)
+ } catch {
+ throw
+ }
+}
+
+end {
+ try {
+ $steppablePipeline.End()
+ } catch {
+ throw
+ }
+}
+}
diff --git a/src/ImageBuilder/exports/readme.md b/src/ImageBuilder/exports/readme.md
new file mode 100644
index 000000000000..385f62508a7c
--- /dev/null
+++ b/src/ImageBuilder/exports/readme.md
@@ -0,0 +1,20 @@
+# Exports
+This directory contains the cmdlets *exported by* `Az.ImageBuilder`. No other cmdlets in this repository are directly exported. What that means is the `Az.ImageBuilder` module will run [Export-ModuleMember](https://docs.microsoft.com/en-us/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.
+
+## Info
+- Modifiable: no
+- Generated: all
+- Committed: no
+- Packaged: yes
+
+## Details
+The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.ImageBuilder.private.dll`) and from the `..\custom\Az.ImageBuilder.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [readme.md](..\internal/readme.md) in the `..\internal` folder.
+
+## Purpose
+We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles.
+
+## Structure
+The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile.
+
+## Usage
+When `./Az.ImageBuilder.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message.
\ No newline at end of file
diff --git a/src/ImageBuilder/generate-help.ps1 b/src/ImageBuilder/generate-help.ps1
new file mode 100644
index 000000000000..c7881937ae5c
--- /dev/null
+++ b/src/ImageBuilder/generate-help.ps1
@@ -0,0 +1,73 @@
+# ----------------------------------------------------------------------------------
+#
+# Copyright Microsoft Corporation
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ----------------------------------------------------------------------------------
+param([switch]$Isolated)
+$ErrorActionPreference = 'Stop'
+
+$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path
+if(-not $Isolated) {
+ Write-Host -ForegroundColor Green 'Creating isolated process...'
+ & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated
+ return
+}
+
+$exportsFolder = Join-Path $PSScriptRoot 'exports'
+if(-not (Test-Path $exportsFolder)) {
+ Write-Error "Exports folder '$exportsFolder' was not found."
+}
+
+$directories = Get-ChildItem -Directory -Path $exportsFolder
+$hasProfiles = ($directories | Measure-Object).Count -gt 0
+if(-not $hasProfiles) {
+ $directories = Get-Item -Path $exportsFolder
+}
+
+$docsFolder = Join-Path $PSScriptRoot 'docs'
+if(Test-Path $docsFolder) {
+ $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue
+}
+$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue
+$examplesFolder = Join-Path $PSScriptRoot 'examples'
+
+$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.ImageBuilder.psd1')
+$modulePath = $modulePsd1.FullName
+$moduleName = $modulePsd1.BaseName
+
+# Load DLL to use build-time cmdlets
+Import-Module -Name $modulePath
+Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.ImageBuilder.private.dll')
+$instance = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module]::Instance
+# Module info is shared per profile
+$moduleInfo = Get-Module -Name $moduleName
+
+foreach($directory in $directories)
+{
+ if($hasProfiles) {
+ Select-AzProfile -Name $directory.Name
+ }
+ # Reload module per profile
+ Import-Module -Name $modulePath -Force
+
+ $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName
+ $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full }
+ $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo
+
+ $docsPath = Join-Path $docsFolder $directory.Name
+ $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue
+ $examplesPath = Join-Path $examplesFolder $directory.Name
+
+ Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath
+ Write-Host -ForegroundColor Green "Created documentation in '$docsPath'"
+}
+
+Write-Host -ForegroundColor Green '-------------Done-------------'
\ No newline at end of file
diff --git a/src/ImageBuilder/generate-info.json b/src/ImageBuilder/generate-info.json
new file mode 100644
index 000000000000..59a7ef6599f2
--- /dev/null
+++ b/src/ImageBuilder/generate-info.json
@@ -0,0 +1,8 @@
+{
+ "autorest_core": "3.0.6282",
+ "swagger_commit": "76b6bd1989a8248987219b840f525b02e07807dc",
+ "autorest_powershell": "2.1.384",
+ "node": "v10.16.3",
+ "autorest": "3.0.6149",
+ "autorest_remodeler": "2.1.27"
+}
diff --git a/src/ImageBuilder/generated/Module.cs b/src/ImageBuilder/generated/Module.cs
new file mode 100644
index 000000000000..a4de434d602f
--- /dev/null
+++ b/src/ImageBuilder/generated/Module.cs
@@ -0,0 +1,158 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+ using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>;
+ using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>;
+ using GetParameterDelegate = global::System.Func;
+ using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>;
+ using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>;
+ using ArgumentCompleterDelegate = global::System.Func;
+ using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>;
+ using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>;
+ using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>;
+
+ /// A class that contains the module-common code and data.
+ public partial class Module
+ {
+ /// The currently selected profile.
+ public string Profile = global::System.String.Empty;
+
+ public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler();
+
+ /// the ISendAsync pipeline instance
+ private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline _pipeline;
+
+ /// the ISendAsync pipeline instance (when proxy is enabled)
+ private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline _pipelineWithProxy;
+
+ public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy();
+
+ /// Gets completion data for azure specific fields
+ public ArgumentCompleterDelegate ArgumentCompleter { get; set; }
+
+ /// The instance of the Client API
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder ClientAPI { get; set; }
+
+ /// A delegate that gets called for each signalled event
+ public EventListenerDelegate EventListener { get; set; }
+
+ /// The delegate to call to get parameter data from a common module.
+ public GetParameterDelegate GetParameterValue { get; set; }
+
+ /// Backing field for property.
+ private static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module _instance;
+
+ /// the singleton of this module class
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module());
+
+ /// The Name of this module
+ public string Name => @"Az.ImageBuilder";
+
+ /// The delegate to call when this module is loaded (supporting a commmon module).
+ public ModuleLoadPipelineDelegate OnModuleLoad { get; set; }
+
+ /// The delegate to call before each new request (supporting a commmon module).
+ public NewRequestPipelineDelegate OnNewRequest { get; set; }
+
+ /// The name of the currently selected Azure profile
+ public global::System.String ProfileName { get; set; }
+
+ /// The ResourceID for this module (azure arm).
+ public string ResourceId => @"Az.ImageBuilder";
+
+ /// The from the cmdlet
+ /// The HttpPipeline for the request
+
+ partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline pipeline);
+
+ /// The from the cmdlet
+ /// The HttpPipeline for the request
+
+ partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline pipeline);
+
+ partial void CustomInit();
+
+ /// Creates an instance of the HttpPipeline for each call.
+ /// The from the cmdlet
+ /// the cmdlet's correlation id.
+ /// the cmdlet's process record correlation id.
+ /// the cmdlet's parameterset name.
+ /// An instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline for the remote call.
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null)
+ {
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline pipeline = null;
+ BeforeCreatePipeline(invocationInfo, ref pipeline);
+ pipeline = (pipeline ?? (_handler.UseProxy ? _pipelineWithProxy : _pipeline)).Clone();
+ AfterCreatePipeline(invocationInfo, ref pipeline);
+ pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync);
+ OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } );
+ return pipeline;
+ }
+
+ /// Gets parameters from a common module.
+ /// The from the cmdlet
+ /// the cmdlet's correlation id.
+ /// The name of the parameter to get the value for.
+ ///
+ /// The parameter value from the common module. (Note: this should be type converted on the way back)
+ ///
+ public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName );
+
+ /// Initialization steps performed after the module is loaded.
+ public void Init()
+ {
+ OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } );
+ OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } );
+ CustomInit();
+ }
+
+ /// Creates the module instance.
+ private Module()
+ {
+ /// constructor
+ ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder();
+ _handler.Proxy = _webProxy;
+ _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient()));
+ _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler)));
+ }
+
+ /// The HTTP Proxy to use.
+ /// The HTTP Proxy Credentials
+ /// True if the proxy should use default credentials
+ public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials)
+ {
+ // set the proxy configuration
+ _webProxy.Address = proxy;
+ _webProxy.BypassProxyOnLocal = false;
+ _webProxy.Credentials = proxyCredential ?.GetNetworkCredential();
+ _webProxy.UseDefaultCredentials = proxyUseDefaultCredentials;
+ _handler.UseProxy = proxy != null;
+ }
+
+ /// Called to dispatch events to the common module listener
+ /// The ID of the event
+ /// The cancellation token for the event
+ /// A delegate to get the detailed event data
+ /// The callback for the event dispatcher
+ /// The from the cmdlet
+ /// the cmdlet's parameterset name.
+ /// the cmdlet's correlation id.
+ /// the cmdlet's process record correlation id.
+ /// the exception that is being thrown (if available)
+ ///
+ /// A that will be complete when handling of the event is completed.
+ ///
+ public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception)
+ {
+ using( NoSynchronizationContext )
+ {
+ await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/ImageBuilder.cs b/src/ImageBuilder/generated/api/ImageBuilder.cs
new file mode 100644
index 000000000000..6825fcf0821b
--- /dev/null
+++ b/src/ImageBuilder/generated/api/ImageBuilder.cs
@@ -0,0 +1,2329 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ ///
+ /// Low-level API implementation for the ImageBuilder service.
+ ///
+ public partial class ImageBuilder
+ {
+
+ /// Lists available operations for the Microsoft.VirtualMachineImages provider
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/providers/Microsoft.VirtualMachineImages/operations"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Lists available operations for the Microsoft.VirtualMachineImages provider
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.VirtualMachineImages/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.VirtualMachineImages/operations'");
+ }
+
+ // replace URI parameters with values from identity
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/providers/Microsoft.VirtualMachineImages/operations"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will get validation
+ /// events back.
+ ///
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+
+ }
+ }
+
+ /// Cancel the long running image build based on the image template
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCancel(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + global::System.Uri.EscapeDataString(imageTemplateName)
+ + "/cancel"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Post, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesCancel_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Cancel the long running image build based on the image template
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCancelViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/cancel'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var imageTemplateName = _match.Groups["imageTemplateName"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + imageTemplateName
+ + "/cancel"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Post, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesCancel_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCancel_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // this operation supports x-ms-long-running-operation
+ var _originalUri = request.RequestUri.AbsoluteUri;
+ // declared final-state-via: azure-async-operation
+ var _finalUri = _response.GetFirstHeader(@"azure-asyncoperation");
+ var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ var location = _response.GetFirstHeader(@"Location");
+ while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+
+ // get the delay before polling. (default to 30 seconds if not present)
+ int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // start the delay timer (we'll await later...)
+ var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token );
+
+ // while we wait, let's grab the headers and get ready to poll.
+ if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) {
+ asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ }
+ if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) {
+ location = _response.GetFirstHeader(@"Location");
+ }
+ var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation;
+ request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // and let's look at the current response body and see if we have some information we can give back to the listener
+ var content = await _response.Content.ReadAsStringAsync();
+ await waiting;
+
+ // check for cancellation
+ if( eventListener.Token.IsCancellationRequested ) { return; }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the polling call
+ _response = await sender.SendAsync(request, eventListener);
+
+ // if we got back an OK, take a peek inside and see if it's done
+ if( _response.StatusCode == global::System.Net.HttpStatusCode.OK)
+ {
+ try {
+ if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status");
+ if( state is null )
+ {
+ // the body doesn't contain any information that has the state of the LRO
+ // we're going to just get out, and let the consumer have the result
+ break;
+ }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ switch( state?.ToString()?.ToLower() )
+ {
+ case "succeeded":
+ case "failed":
+ case "canceled":
+ // we're done polling.
+ break;
+
+ default:
+ // need to keep polling!
+ _response.StatusCode = global::System.Net.HttpStatusCode.Created;
+ continue;
+ }
+ }
+ } catch {
+ // if we run into a problem peeking into the result,
+ // we really don't want to do anything special.
+ }
+ }
+
+ // check for terminal status code
+ if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+ continue;
+ }
+ // we are done polling, do a request on final target?
+ // create a new request with the final uri
+ request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the final call
+ _response = await sender.SendAsync(request, eventListener);
+ break;
+ }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response);
+ break;
+ }
+ case global::System.Net.HttpStatusCode.NoContent:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onNoContent(_response);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you
+ /// will get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCancel_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName);
+ await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$");
+ }
+ }
+
+ /// Create or update a virtual machine image template
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// Parameters supplied to the CreateImageTemplate operation
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCreateOrUpdate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + global::System.Uri.EscapeDataString(imageTemplateName)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Create or update a virtual machine image template
+ ///
+ /// Parameters supplied to the CreateImageTemplate operation
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var imageTemplateName = _match.Groups["imageTemplateName"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + imageTemplateName
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Put, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Actual wire call for method.
+ ///
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // this operation supports x-ms-long-running-operation
+ var _originalUri = request.RequestUri.AbsoluteUri;
+ // declared final-state-via: azure-async-operation
+ var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ var location = _response.GetFirstHeader(@"Location");
+ while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+
+ // get the delay before polling. (default to 30 seconds if not present)
+ int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // start the delay timer (we'll await later...)
+ var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token );
+
+ // while we wait, let's grab the headers and get ready to poll.
+ if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) {
+ asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ }
+ if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) {
+ location = _response.GetFirstHeader(@"Location");
+ }
+ var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation;
+ request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // and let's look at the current response body and see if we have some information we can give back to the listener
+ var content = await _response.Content.ReadAsStringAsync();
+ await waiting;
+
+ // check for cancellation
+ if( eventListener.Token.IsCancellationRequested ) { return; }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the polling call
+ _response = await sender.SendAsync(request, eventListener);
+
+ // if we got back an OK, take a peek inside and see if it's done
+ if( _response.StatusCode == global::System.Net.HttpStatusCode.OK)
+ {
+ try {
+ if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status");
+ if( state is null )
+ {
+ // the body doesn't contain any information that has the state of the LRO
+ // we're going to just get out, and let the consumer have the result
+ break;
+ }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ switch( state?.ToString()?.ToLower() )
+ {
+ case "succeeded":
+ case "failed":
+ case "canceled":
+ // we're done polling.
+ break;
+
+ default:
+ // need to keep polling!
+ _response.StatusCode = global::System.Net.HttpStatusCode.Created;
+ continue;
+ }
+ }
+ } catch {
+ // if we run into a problem peeking into the result,
+ // we really don't want to do anything special.
+ }
+ }
+
+ // check for terminal status code
+ if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+ continue;
+ }
+ // we are done polling, do a request on final target?
+ // create a new request with the final uri
+ request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the final call
+ _response = await sender.SendAsync(request, eventListener);
+ break;
+ }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call,
+ /// but you will get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// Parameters supplied to the CreateImageTemplate operation
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate body, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName);
+ await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$");
+ await eventListener.AssertNotNull(nameof(body), body);
+ await eventListener.AssertObjectIsValid(nameof(body), body);
+ }
+ }
+
+ /// Delete a virtual machine image template
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesDelete(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + global::System.Uri.EscapeDataString(imageTemplateName)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Delete a virtual machine image template
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var imageTemplateName = _match.Groups["imageTemplateName"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + imageTemplateName
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Delete, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // this operation supports x-ms-long-running-operation
+ var _originalUri = request.RequestUri.AbsoluteUri;
+ // declared final-state-via: azure-async-operation
+ var _finalUri = _response.GetFirstHeader(@"azure-asyncoperation");
+ var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ var location = _response.GetFirstHeader(@"Location");
+ while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+
+ // get the delay before polling. (default to 30 seconds if not present)
+ int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // start the delay timer (we'll await later...)
+ var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token );
+
+ // while we wait, let's grab the headers and get ready to poll.
+ if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) {
+ asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ }
+ if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) {
+ location = _response.GetFirstHeader(@"Location");
+ }
+ var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation;
+ request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // and let's look at the current response body and see if we have some information we can give back to the listener
+ var content = await _response.Content.ReadAsStringAsync();
+ await waiting;
+
+ // check for cancellation
+ if( eventListener.Token.IsCancellationRequested ) { return; }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the polling call
+ _response = await sender.SendAsync(request, eventListener);
+
+ // if we got back an OK, take a peek inside and see if it's done
+ if( _response.StatusCode == global::System.Net.HttpStatusCode.OK)
+ {
+ try {
+ if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status");
+ if( state is null )
+ {
+ // the body doesn't contain any information that has the state of the LRO
+ // we're going to just get out, and let the consumer have the result
+ break;
+ }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ switch( state?.ToString()?.ToLower() )
+ {
+ case "succeeded":
+ case "failed":
+ case "canceled":
+ // we're done polling.
+ break;
+
+ default:
+ // need to keep polling!
+ _response.StatusCode = global::System.Net.HttpStatusCode.Created;
+ continue;
+ }
+ }
+ } catch {
+ // if we run into a problem peeking into the result,
+ // we really don't want to do anything special.
+ }
+ }
+
+ // check for terminal status code
+ if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+ continue;
+ }
+ // we are done polling, do a request on final target?
+ // create a new request with the final uri
+ request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the final call
+ _response = await sender.SendAsync(request, eventListener);
+ break;
+ }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response);
+ break;
+ }
+ case global::System.Net.HttpStatusCode.NoContent:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onNoContent(_response);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you
+ /// will get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesDelete_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName);
+ await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$");
+ }
+ }
+
+ /// Get information about a virtual machine image template
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGet(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + global::System.Uri.EscapeDataString(imageTemplateName)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Get the specified run output for the specified image template resource
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// The name of the run output
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetRunOutput(string subscriptionId, string resourceGroupName, string imageTemplateName, string runOutputName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + global::System.Uri.EscapeDataString(imageTemplateName)
+ + "/runOutputs/"
+ + global::System.Uri.EscapeDataString(runOutputName)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesGetRunOutput_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Get the specified run output for the specified image template resource
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetRunOutputViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)/runOutputs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var imageTemplateName = _match.Groups["imageTemplateName"].Value;
+ var runOutputName = _match.Groups["runOutputName"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + imageTemplateName
+ + "/runOutputs/"
+ + runOutputName
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesGetRunOutput_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Actual wire call for method.
+ ///
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetRunOutput_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutput.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call,
+ /// but you will get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// The name of the run output
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetRunOutput_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, string runOutputName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName);
+ await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$");
+ await eventListener.AssertNotNull(nameof(runOutputName),runOutputName);
+ await eventListener.AssertRegEx(nameof(runOutputName),runOutputName,@"^[A-Za-z0-9-_.]{1,64}$");
+ }
+ }
+
+ /// Get information about a virtual machine image template
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var imageTemplateName = _match.Groups["imageTemplateName"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + imageTemplateName
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesGet_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will
+ /// get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGet_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName);
+ await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$");
+ }
+ }
+
+ /// Gets information about the VM image templates associated with the subscription.
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesList_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets information about the VM image templates associated with the specified resource group.
+ ///
+ /// The name of the resource group.
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListByResourceGroup(string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Gets information about the VM image templates associated with the specified resource group.
+ ///
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates'");
+ }
+
+ // replace URI parameters with values from identity
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Actual wire call for method.
+ ///
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual
+ /// call, but you will get validation events back.
+ ///
+ /// The name of the resource group.
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListByResourceGroup_Validate(string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ }
+ }
+
+ /// List all run outputs for the specified Image Template resource
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListRunOutputs(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + global::System.Uri.EscapeDataString(imageTemplateName)
+ + "/runOutputs"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesListRunOutputs_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// List all run outputs for the specified Image Template resource
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListRunOutputsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)/runOutputs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var imageTemplateName = _match.Groups["imageTemplateName"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + imageTemplateName
+ + "/runOutputs"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesListRunOutputs_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ ///
+ /// Actual wire call for method.
+ ///
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListRunOutputs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call,
+ /// but you will get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListRunOutputs_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName);
+ await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$");
+ }
+ }
+
+ /// Gets information about the VM image templates associated with the subscription.
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesList_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you
+ /// will get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ }
+ }
+
+ /// Create artifacts from a existing image template
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesRun(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + global::System.Uri.EscapeDataString(imageTemplateName)
+ + "/run"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Post, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesRun_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Create artifacts from a existing image template
+ ///
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesRunViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var imageTemplateName = _match.Groups["imageTemplateName"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + imageTemplateName
+ + "/run"
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Post, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesRun_Call(request,onOk,onNoContent,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns 204 (NoContent).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesRun_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // this operation supports x-ms-long-running-operation
+ var _originalUri = request.RequestUri.AbsoluteUri;
+ // declared final-state-via: azure-async-operation
+ var _finalUri = _response.GetFirstHeader(@"azure-asyncoperation");
+ var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ var location = _response.GetFirstHeader(@"Location");
+ while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+
+ // get the delay before polling. (default to 30 seconds if not present)
+ int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // start the delay timer (we'll await later...)
+ var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token );
+
+ // while we wait, let's grab the headers and get ready to poll.
+ if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) {
+ asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ }
+ if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) {
+ location = _response.GetFirstHeader(@"Location");
+ }
+ var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation;
+ request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // and let's look at the current response body and see if we have some information we can give back to the listener
+ var content = await _response.Content.ReadAsStringAsync();
+ await waiting;
+
+ // check for cancellation
+ if( eventListener.Token.IsCancellationRequested ) { return; }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the polling call
+ _response = await sender.SendAsync(request, eventListener);
+
+ // if we got back an OK, take a peek inside and see if it's done
+ if( _response.StatusCode == global::System.Net.HttpStatusCode.OK)
+ {
+ try {
+ if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status");
+ if( state is null )
+ {
+ // the body doesn't contain any information that has the state of the LRO
+ // we're going to just get out, and let the consumer have the result
+ break;
+ }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ switch( state?.ToString()?.ToLower() )
+ {
+ case "succeeded":
+ case "failed":
+ case "canceled":
+ // we're done polling.
+ break;
+
+ default:
+ // need to keep polling!
+ _response.StatusCode = global::System.Net.HttpStatusCode.Created;
+ continue;
+ }
+ }
+ } catch {
+ // if we run into a problem peeking into the result,
+ // we really don't want to do anything special.
+ }
+ }
+
+ // check for terminal status code
+ if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+ continue;
+ }
+ // we are done polling, do a request on final target?
+ // create a new request with the final uri
+ request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the final call
+ _response = await sender.SendAsync(request, eventListener);
+ break;
+ }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response);
+ break;
+ }
+ case global::System.Net.HttpStatusCode.NoContent:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onNoContent(_response);
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you will
+ /// get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesRun_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName);
+ await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$");
+ }
+ }
+
+ /// Update the tags for this Virtual Machine Image Template
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// Additional parameters for Image Template update.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesUpdate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + global::System.Uri.EscapeDataString(subscriptionId)
+ + "/resourceGroups/"
+ + global::System.Uri.EscapeDataString(resourceGroupName)
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + global::System.Uri.EscapeDataString(imageTemplateName)
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Patch, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesUpdate_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Update the tags for this Virtual Machine Image Template
+ ///
+ /// Additional parameters for Image Template update.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ var apiVersion = @"2020-02-14";
+ // Constant Parameters
+ using( NoSynchronizationContext )
+ {
+ // verify that Identity format is an exact match for uri
+
+ var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity);
+ if (!_match.Success)
+ {
+ throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}'");
+ }
+
+ // replace URI parameters with values from identity
+ var subscriptionId = _match.Groups["subscriptionId"].Value;
+ var resourceGroupName = _match.Groups["resourceGroupName"].Value;
+ var imageTemplateName = _match.Groups["imageTemplateName"].Value;
+ // construct URL
+ var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace(
+ "https://management.azure.com/subscriptions/"
+ + subscriptionId
+ + "/resourceGroups/"
+ + resourceGroupName
+ + "/providers/Microsoft.VirtualMachineImages/imageTemplates/"
+ + imageTemplateName
+ + "?"
+ + "api-version=" + global::System.Uri.EscapeDataString(apiVersion)
+ ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"));
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // generate request object
+ var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Patch, _url);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // set body content
+ request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8);
+ request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // make the call
+ await this.VirtualMachineImageTemplatesUpdate_Call(request,onOk,onDefault,eventListener,sender);
+ }
+ }
+
+ /// Actual wire call for method.
+ /// the prepared HttpRequestMessage to send.
+ /// a delegate that is called when the remote service returns 200 (OK).
+ /// a delegate that is called when the remote service returns default (any response code not handled
+ /// elsewhere).
+ /// an instance that will receive events.
+ /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender)
+ {
+ using( NoSynchronizationContext )
+ {
+ global::System.Net.Http.HttpResponseMessage _response = null;
+ try
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; }
+ _response = await sender.SendAsync(request, eventListener);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ // this operation supports x-ms-long-running-operation
+ var _originalUri = request.RequestUri.AbsoluteUri;
+ // declared final-state-via: azure-async-operation
+ var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ var location = _response.GetFirstHeader(@"Location");
+ while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+
+ // get the delay before polling. (default to 30 seconds if not present)
+ int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30);
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // start the delay timer (we'll await later...)
+ var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token );
+
+ // while we wait, let's grab the headers and get ready to poll.
+ if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) {
+ asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation");
+ }
+ if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) {
+ location = _response.GetFirstHeader(@"Location");
+ }
+ var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation;
+ request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // and let's look at the current response body and see if we have some information we can give back to the listener
+ var content = await _response.Content.ReadAsStringAsync();
+ await waiting;
+
+ // check for cancellation
+ if( eventListener.Token.IsCancellationRequested ) { return; }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the polling call
+ _response = await sender.SendAsync(request, eventListener);
+
+ // if we got back an OK, take a peek inside and see if it's done
+ if( _response.StatusCode == global::System.Net.HttpStatusCode.OK)
+ {
+ try {
+ if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status");
+ if( state is null )
+ {
+ // the body doesn't contain any information that has the state of the LRO
+ // we're going to just get out, and let the consumer have the result
+ break;
+ }
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+
+ switch( state?.ToString()?.ToLower() )
+ {
+ case "succeeded":
+ case "failed":
+ case "canceled":
+ // we're done polling.
+ break;
+
+ default:
+ // need to keep polling!
+ _response.StatusCode = global::System.Net.HttpStatusCode.Created;
+ continue;
+ }
+ }
+ } catch {
+ // if we run into a problem peeking into the result,
+ // we really don't want to do anything special.
+ }
+ }
+
+ // check for terminal status code
+ if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted )
+ {
+ continue;
+ }
+ // we are done polling, do a request on final target?
+ // create a new request with the final uri
+ request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get);
+
+ // drop the old response
+ _response?.Dispose();
+
+ // make the final call
+ _response = await sender.SendAsync(request, eventListener);
+ break;
+ }
+ var _contentType = _response.Content.Headers.ContentType?.MediaType;
+
+ switch ( _response.StatusCode )
+ {
+ case global::System.Net.HttpStatusCode.OK:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ default:
+ {
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; }
+ await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) ));
+ break;
+ }
+ }
+ }
+ finally
+ {
+ // finally statements
+ await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response);
+ _response?.Dispose();
+ request?.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validation method for method. Call this like the actual call, but you
+ /// will get validation events back.
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription
+ /// Id forms part of the URI for every service call.
+ /// The name of the resource group.
+ /// The name of the image Template
+ /// Additional parameters for Image Template update.
+ /// an instance that will receive events.
+ ///
+ /// A that will be complete when handling of the response is completed.
+ ///
+ internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesUpdate_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters body, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ using( NoSynchronizationContext )
+ {
+ await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId);
+ await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName);
+ await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName);
+ await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$");
+ await eventListener.AssertNotNull(nameof(body), body);
+ await eventListener.AssertObjectIsValid(nameof(body), body);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.PowerShell.cs
new file mode 100644
index 000000000000..2c03070b72a4
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.PowerShell.cs
@@ -0,0 +1,143 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ /// Api error.
+ [System.ComponentModel.TypeConverter(typeof(ApiErrorTypeConverter))]
+ public partial class ApiError
+ {
+
+ ///
+ /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the
+ /// object before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+
+ partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
+
+ ///
+ /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+
+ partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
+
+ ///
+ /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
+
+ ///
+ /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ internal ApiError(global::System.Collections.IDictionary content)
+ {
+ bool returnNow = false;
+ BeforeDeserializeDictionary(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError) content.GetValueForProperty("InnerError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerErrorTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Code, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Message, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Target, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBaseTypeConverter.ConvertFrom));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorExceptionType = (string) content.GetValueForProperty("InnerErrorExceptionType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorExceptionType, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorDetail = (string) content.GetValueForProperty("InnerErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorDetail, global::System.Convert.ToString);
+ AfterDeserializeDictionary(content);
+ }
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ internal ApiError(global::System.Management.Automation.PSObject content)
+ {
+ bool returnNow = false;
+ BeforeDeserializePSObject(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError) content.GetValueForProperty("InnerError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerErrorTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Code, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Message, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Target, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBaseTypeConverter.ConvertFrom));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorExceptionType = (string) content.GetValueForProperty("InnerErrorExceptionType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorExceptionType, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorDetail = (string) content.GetValueForProperty("InnerErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorDetail, global::System.Convert.ToString);
+ AfterDeserializePSObject(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError DeserializeFromDictionary(global::System.Collections.IDictionary content)
+ {
+ return new ApiError(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
+ {
+ return new ApiError(content);
+ }
+
+ ///
+ /// Creates a new instance of , deserializing the content from a json string.
+ ///
+ /// a string containing a JSON serialized instance of this model.
+ /// an instance of the model class.
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText));
+
+ /// Serializes this instance to a json string.
+
+ /// a containing this model serialized to JSON text.
+ public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString();
+ }
+ /// Api error.
+ [System.ComponentModel.TypeConverter(typeof(ApiErrorTypeConverter))]
+ public partial interface IApiError
+
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.TypeConverter.cs
new file mode 100644
index 000000000000..f2da89e2c9c2
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.TypeConverter.cs
@@ -0,0 +1,142 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// A PowerShell PSTypeConverter to support converting to an instance of
+ ///
+ public partial class ApiErrorTypeConverter : global::System.Management.Automation.PSTypeConverter
+ {
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false.
+ ///
+ public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue);
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the instance to check if it can be converted to the type.
+ ///
+ /// true if the instance could be converted to a type, otherwise false
+ ///
+ public static bool CanConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return true;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ // we say yest to PSObjects
+ return true;
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ // we say yest to Hashtables/dictionaries
+ return true;
+ }
+ try
+ {
+ if (null != sourceValue.ToJsonString())
+ {
+ return true;
+ }
+ }
+ catch
+ {
+ // Not one of our objects
+ }
+ try
+ {
+ string text = sourceValue.ToString()?.Trim();
+ return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object;
+ }
+ catch
+ {
+ // Doesn't look like it can be treated as JSON
+ }
+ return false;
+ }
+
+ ///
+ /// Determines if the parameter can be converted to the parameter
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false
+ ///
+ public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false;
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue);
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the value to convert into an instance of .
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError ConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return null;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError).IsAssignableFrom(type))
+ {
+ return sourceValue;
+ }
+ try
+ {
+ return ApiError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());;
+ }
+ catch
+ {
+ // Unable to use JSON pattern
+ }
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ return ApiError.DeserializeFromPSObject(sourceValue);
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ return ApiError.DeserializeFromDictionary(sourceValue);
+ }
+ return null;
+ }
+
+ /// NotImplemented -- this will return null
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ /// will always return null.
+ public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null;
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.cs
new file mode 100644
index 000000000000..08674901fd5c
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.cs
@@ -0,0 +1,137 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ /// Api error.
+ public partial class ApiError :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal
+ {
+
+ /// Backing field for property.
+ private string _code;
+
+ /// The error code.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Code { get => this._code; set => this._code = value; }
+
+ /// Backing field for property.
+ private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[] _detail;
+
+ /// The Api error details
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[] Detail { get => this._detail; set => this._detail = value; }
+
+ /// Backing field for property.
+ private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError _innerError;
+
+ /// The Api inner error
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError InnerError { get => (this._innerError = this._innerError ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError()); set => this._innerError = value; }
+
+ /// The internal error message or exception dump.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public string InnerErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)InnerError).ErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)InnerError).ErrorDetail = value; }
+
+ /// The exception type.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public string InnerErrorExceptionType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)InnerError).ExceptionType; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)InnerError).ExceptionType = value; }
+
+ /// Backing field for property.
+ private string _message;
+
+ /// The error message.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Message { get => this._message; set => this._message = value; }
+
+ /// Internal Acessors for InnerError
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal.InnerError { get => (this._innerError = this._innerError ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError()); set { {_innerError = value;} } }
+
+ /// Backing field for property.
+ private string _target;
+
+ /// The target of the particular error.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Target { get => this._target; set => this._target = value; }
+
+ /// Creates an new instance.
+ public ApiError()
+ {
+
+ }
+ }
+ /// Api error.
+ public partial interface IApiError :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable
+ {
+ /// The error code.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The error code.",
+ SerializedName = @"code",
+ PossibleTypes = new [] { typeof(string) })]
+ string Code { get; set; }
+ /// The Api error details
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The Api error details",
+ SerializedName = @"details",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[] Detail { get; set; }
+ /// The internal error message or exception dump.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The internal error message or exception dump.",
+ SerializedName = @"errorDetail",
+ PossibleTypes = new [] { typeof(string) })]
+ string InnerErrorDetail { get; set; }
+ /// The exception type.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The exception type.",
+ SerializedName = @"exceptionType",
+ PossibleTypes = new [] { typeof(string) })]
+ string InnerErrorExceptionType { get; set; }
+ /// The error message.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The error message.",
+ SerializedName = @"message",
+ PossibleTypes = new [] { typeof(string) })]
+ string Message { get; set; }
+ /// The target of the particular error.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The target of the particular error.",
+ SerializedName = @"target",
+ PossibleTypes = new [] { typeof(string) })]
+ string Target { get; set; }
+
+ }
+ /// Api error.
+ public partial interface IApiErrorInternal
+
+ {
+ /// The error code.
+ string Code { get; set; }
+ /// The Api error details
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[] Detail { get; set; }
+ /// The Api inner error
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError InnerError { get; set; }
+ /// The internal error message or exception dump.
+ string InnerErrorDetail { get; set; }
+ /// The exception type.
+ string InnerErrorExceptionType { get; set; }
+ /// The error message.
+ string Message { get; set; }
+ /// The target of the particular error.
+ string Target { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.json.cs
new file mode 100644
index 000000000000..d48279ddfe5b
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.json.cs
@@ -0,0 +1,117 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ /// Api error.
+ public partial class ApiError
+ {
+
+ ///
+ /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JsonNode that should be deserialized into this object.
+
+ partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json);
+
+ ///
+ /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JSON container that the serialization result will be placed in.
+
+ partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container);
+
+ ///
+ /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of
+ /// the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JsonNode that should be deserialized into this object.
+ /// Determines if the rest of the deserialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow);
+
+ ///
+ /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the
+ /// object before it is serialized.
+ /// If you wish to disable the default serialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JSON container that the serialization result will be placed in.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow);
+
+ ///
+ /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of .
+ ///
+ /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from.
+ internal ApiError(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ bool returnNow = false;
+ BeforeFromJson(json, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ {_innerError = If( json?.PropertyT("innerError"), out var __jsonInnerError) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError.FromJson(__jsonInnerError) : InnerError;}
+ {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;}
+ {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;}
+ {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;}
+ {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase) (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBase.FromJson(__u) )) ))() : null : Detail;}
+ AfterFromJson(json);
+ }
+
+ ///
+ /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError.
+ ///
+ /// a to deserialize from.
+ ///
+ /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node)
+ {
+ return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ApiError(json) : null;
+ }
+
+ ///
+ /// Serializes this instance of into a .
+ ///
+ /// The container to serialize this object into. If the caller
+ /// passes in null, a new instance will be created and returned to the caller.
+ /// Allows the caller to choose the depth of the serialization. See .
+ ///
+ /// a serialized instance of as a .
+ ///
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode)
+ {
+ container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject();
+
+ bool returnNow = false;
+ BeforeToJson(ref container, ref returnNow);
+ if (returnNow)
+ {
+ return container;
+ }
+ AddIf( null != this._innerError ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._innerError.ToJson(null,serializationMode) : null, "innerError" ,container.Add );
+ AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add );
+ AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add );
+ AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add );
+ if (null != this._detail)
+ {
+ var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray();
+ foreach( var __x in this._detail )
+ {
+ AddIf(__x?.ToJson(null, serializationMode) ,__w.Add);
+ }
+ container.Add("details",__w);
+ }
+ AfterToJson(ref container);
+ return container;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.PowerShell.cs
new file mode 100644
index 000000000000..cc27fb9e3bba
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.PowerShell.cs
@@ -0,0 +1,135 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ /// Api error base.
+ [System.ComponentModel.TypeConverter(typeof(ApiErrorBaseTypeConverter))]
+ public partial class ApiErrorBase
+ {
+
+ ///
+ /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the
+ /// object before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+
+ partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
+
+ ///
+ /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+
+ partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
+
+ ///
+ /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
+
+ ///
+ /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ internal ApiErrorBase(global::System.Collections.IDictionary content)
+ {
+ bool returnNow = false;
+ BeforeDeserializeDictionary(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Code, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Message, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Target, global::System.Convert.ToString);
+ AfterDeserializeDictionary(content);
+ }
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ internal ApiErrorBase(global::System.Management.Automation.PSObject content)
+ {
+ bool returnNow = false;
+ BeforeDeserializePSObject(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Code, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Message, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Target, global::System.Convert.ToString);
+ AfterDeserializePSObject(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase DeserializeFromDictionary(global::System.Collections.IDictionary content)
+ {
+ return new ApiErrorBase(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
+ {
+ return new ApiErrorBase(content);
+ }
+
+ ///
+ /// Creates a new instance of , deserializing the content from a json string.
+ ///
+ /// a string containing a JSON serialized instance of this model.
+ /// an instance of the model class.
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText));
+
+ /// Serializes this instance to a json string.
+
+ /// a containing this model serialized to JSON text.
+ public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString();
+ }
+ /// Api error base.
+ [System.ComponentModel.TypeConverter(typeof(ApiErrorBaseTypeConverter))]
+ public partial interface IApiErrorBase
+
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.TypeConverter.cs
new file mode 100644
index 000000000000..ca78771aead4
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.TypeConverter.cs
@@ -0,0 +1,142 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// A PowerShell PSTypeConverter to support converting to an instance of
+ ///
+ public partial class ApiErrorBaseTypeConverter : global::System.Management.Automation.PSTypeConverter
+ {
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false.
+ ///
+ public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue);
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the instance to check if it can be converted to the type.
+ ///
+ /// true if the instance could be converted to a type, otherwise false
+ ///
+ public static bool CanConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return true;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ // we say yest to PSObjects
+ return true;
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ // we say yest to Hashtables/dictionaries
+ return true;
+ }
+ try
+ {
+ if (null != sourceValue.ToJsonString())
+ {
+ return true;
+ }
+ }
+ catch
+ {
+ // Not one of our objects
+ }
+ try
+ {
+ string text = sourceValue.ToString()?.Trim();
+ return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object;
+ }
+ catch
+ {
+ // Doesn't look like it can be treated as JSON
+ }
+ return false;
+ }
+
+ ///
+ /// Determines if the parameter can be converted to the parameter
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false
+ ///
+ public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false;
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue);
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the value to convert into an instance of .
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase ConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return null;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase).IsAssignableFrom(type))
+ {
+ return sourceValue;
+ }
+ try
+ {
+ return ApiErrorBase.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());;
+ }
+ catch
+ {
+ // Unable to use JSON pattern
+ }
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ return ApiErrorBase.DeserializeFromPSObject(sourceValue);
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ return ApiErrorBase.DeserializeFromDictionary(sourceValue);
+ }
+ return null;
+ }
+
+ /// NotImplemented -- this will return null
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ /// will always return null.
+ public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null;
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.cs
new file mode 100644
index 000000000000..695387696c46
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.cs
@@ -0,0 +1,80 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ /// Api error base.
+ public partial class ApiErrorBase :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal
+ {
+
+ /// Backing field for property.
+ private string _code;
+
+ /// The error code.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Code { get => this._code; set => this._code = value; }
+
+ /// Backing field for property.
+ private string _message;
+
+ /// The error message.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Message { get => this._message; set => this._message = value; }
+
+ /// Backing field for property.
+ private string _target;
+
+ /// The target of the particular error.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Target { get => this._target; set => this._target = value; }
+
+ /// Creates an new instance.
+ public ApiErrorBase()
+ {
+
+ }
+ }
+ /// Api error base.
+ public partial interface IApiErrorBase :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable
+ {
+ /// The error code.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The error code.",
+ SerializedName = @"code",
+ PossibleTypes = new [] { typeof(string) })]
+ string Code { get; set; }
+ /// The error message.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The error message.",
+ SerializedName = @"message",
+ PossibleTypes = new [] { typeof(string) })]
+ string Message { get; set; }
+ /// The target of the particular error.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The target of the particular error.",
+ SerializedName = @"target",
+ PossibleTypes = new [] { typeof(string) })]
+ string Target { get; set; }
+
+ }
+ /// Api error base.
+ public partial interface IApiErrorBaseInternal
+
+ {
+ /// The error code.
+ string Code { get; set; }
+ /// The error message.
+ string Message { get; set; }
+ /// The target of the particular error.
+ string Target { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.json.cs
new file mode 100644
index 000000000000..188a81821115
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.json.cs
@@ -0,0 +1,105 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ /// Api error base.
+ public partial class ApiErrorBase
+ {
+
+ ///
+ /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JsonNode that should be deserialized into this object.
+
+ partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json);
+
+ ///
+ /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JSON container that the serialization result will be placed in.
+
+ partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container);
+
+ ///
+ /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of
+ /// the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JsonNode that should be deserialized into this object.
+ /// Determines if the rest of the deserialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow);
+
+ ///
+ /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the
+ /// object before it is serialized.
+ /// If you wish to disable the default serialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JSON container that the serialization result will be placed in.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow);
+
+ ///
+ /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of .
+ ///
+ /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from.
+ internal ApiErrorBase(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ bool returnNow = false;
+ BeforeFromJson(json, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;}
+ {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;}
+ {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;}
+ AfterFromJson(json);
+ }
+
+ ///
+ /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase.
+ ///
+ /// a to deserialize from.
+ ///
+ /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node)
+ {
+ return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ApiErrorBase(json) : null;
+ }
+
+ ///
+ /// Serializes this instance of into a .
+ ///
+ /// The container to serialize this object into. If the caller
+ /// passes in null, a new instance will be created and returned to the caller.
+ /// Allows the caller to choose the depth of the serialization. See .
+ ///
+ /// a serialized instance of as a .
+ ///
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode)
+ {
+ container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject();
+
+ bool returnNow = false;
+ BeforeToJson(ref container, ref returnNow);
+ if (returnNow)
+ {
+ return container;
+ }
+ AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add );
+ AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add );
+ AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add );
+ AfterToJson(ref container);
+ return container;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.PowerShell.cs
new file mode 100644
index 000000000000..df5c01bb7f21
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.PowerShell.cs
@@ -0,0 +1,134 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ [System.ComponentModel.TypeConverter(typeof(ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesTypeConverter))]
+ public partial class ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties
+ {
+
+ ///
+ /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the
+ /// object before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+
+ partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
+
+ ///
+ /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+
+ partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
+
+ ///
+ /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
+
+ ///
+ /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ internal ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(global::System.Collections.IDictionary content)
+ {
+ bool returnNow = false;
+ BeforeDeserializeDictionary(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).ClientId = (string) content.GetValueForProperty("ClientId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).ClientId, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).PrincipalId, global::System.Convert.ToString);
+ AfterDeserializeDictionary(content);
+ }
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ internal ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(global::System.Management.Automation.PSObject content)
+ {
+ bool returnNow = false;
+ BeforeDeserializePSObject(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).ClientId = (string) content.GetValueForProperty("ClientId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).ClientId, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).PrincipalId, global::System.Convert.ToString);
+ AfterDeserializePSObject(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties DeserializeFromDictionary(global::System.Collections.IDictionary content)
+ {
+ return new ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
+ {
+ return new ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(content);
+ }
+
+ ///
+ /// Creates a new instance of , deserializing the content from a json string.
+ ///
+ /// a string containing a JSON serialized instance of this model.
+ /// an instance of the model class.
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText));
+
+ /// Serializes this instance to a json string.
+
+ /// a containing this model serialized to JSON text.
+ public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString();
+ }
+ [System.ComponentModel.TypeConverter(typeof(ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesTypeConverter))]
+ public partial interface IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties
+
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.TypeConverter.cs
new file mode 100644
index 000000000000..5b881d67e96b
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.TypeConverter.cs
@@ -0,0 +1,147 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// A PowerShell PSTypeConverter to support converting to an instance of
+ ///
+ public partial class ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter
+ {
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false.
+ ///
+ public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue);
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the instance to check if it can be converted to the type.
+ ///
+ /// true if the instance could be converted to a type, otherwise false
+ ///
+ public static bool CanConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return true;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ // we say yest to PSObjects
+ return true;
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ // we say yest to Hashtables/dictionaries
+ return true;
+ }
+ try
+ {
+ if (null != sourceValue.ToJsonString())
+ {
+ return true;
+ }
+ }
+ catch
+ {
+ // Not one of our objects
+ }
+ try
+ {
+ string text = sourceValue.ToString()?.Trim();
+ return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object;
+ }
+ catch
+ {
+ // Doesn't look like it can be treated as JSON
+ }
+ return false;
+ }
+
+ ///
+ /// Determines if the parameter can be converted to the parameter
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false
+ ///
+ public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false;
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue);
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the value to convert into an instance of .
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties ConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return null;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties).IsAssignableFrom(type))
+ {
+ return sourceValue;
+ }
+ try
+ {
+ return ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());;
+ }
+ catch
+ {
+ // Unable to use JSON pattern
+ }
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ return ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.DeserializeFromPSObject(sourceValue);
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ return ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.DeserializeFromDictionary(sourceValue);
+ }
+ return null;
+ }
+
+ /// NotImplemented -- this will return null
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ /// will always return null.
+ public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null;
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.cs
new file mode 100644
index 000000000000..058436167fac
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.cs
@@ -0,0 +1,69 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ public partial class ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal
+ {
+
+ /// Backing field for property.
+ private string _clientId;
+
+ /// The client id of user assigned identity.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string ClientId { get => this._clientId; }
+
+ /// Internal Acessors for ClientId
+ string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal.ClientId { get => this._clientId; set { {_clientId = value;} } }
+
+ /// Internal Acessors for PrincipalId
+ string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal.PrincipalId { get => this._principalId; set { {_principalId = value;} } }
+
+ /// Backing field for property.
+ private string _principalId;
+
+ /// The principal id of user assigned identity.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string PrincipalId { get => this._principalId; }
+
+ ///
+ /// Creates an new instance.
+ ///
+ public ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties()
+ {
+
+ }
+ }
+ public partial interface IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable
+ {
+ /// The client id of user assigned identity.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = true,
+ Description = @"The client id of user assigned identity.",
+ SerializedName = @"clientId",
+ PossibleTypes = new [] { typeof(string) })]
+ string ClientId { get; }
+ /// The principal id of user assigned identity.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = true,
+ Description = @"The principal id of user assigned identity.",
+ SerializedName = @"principalId",
+ PossibleTypes = new [] { typeof(string) })]
+ string PrincipalId { get; }
+
+ }
+ public partial interface IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal
+
+ {
+ /// The client id of user assigned identity.
+ string ClientId { get; set; }
+ /// The principal id of user assigned identity.
+ string PrincipalId { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.json.cs
new file mode 100644
index 000000000000..01b29ee9631e
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.json.cs
@@ -0,0 +1,111 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ public partial class ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties
+ {
+
+ ///
+ /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JsonNode that should be deserialized into this object.
+
+ partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json);
+
+ ///
+ /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JSON container that the serialization result will be placed in.
+
+ partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container);
+
+ ///
+ /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of
+ /// the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JsonNode that should be deserialized into this object.
+ /// Determines if the rest of the deserialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow);
+
+ ///
+ /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the
+ /// object before it is serialized.
+ /// If you wish to disable the default serialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JSON container that the serialization result will be placed in.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow);
+
+ ///
+ /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of .
+ ///
+ /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from.
+ internal ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ bool returnNow = false;
+ BeforeFromJson(json, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ {_clientId = If( json?.PropertyT("clientId"), out var __jsonClientId) ? (string)__jsonClientId : (string)ClientId;}
+ {_principalId = If( json?.PropertyT("principalId"), out var __jsonPrincipalId) ? (string)__jsonPrincipalId : (string)PrincipalId;}
+ AfterFromJson(json);
+ }
+
+ ///
+ /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.
+ ///
+ /// a to deserialize from.
+ ///
+ /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node)
+ {
+ return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(json) : null;
+ }
+
+ ///
+ /// Serializes this instance of into a .
+ ///
+ /// The container to serialize this object into. If the caller
+ /// passes in null, a new instance will be created and returned to the caller.
+ /// Allows the caller to choose the depth of the serialization. See .
+ ///
+ /// a serialized instance of as a .
+ ///
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode)
+ {
+ container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject();
+
+ bool returnNow = false;
+ BeforeToJson(ref container, ref returnNow);
+ if (returnNow)
+ {
+ return container;
+ }
+ if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly))
+ {
+ AddIf( null != (((object)this._clientId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._clientId.ToString()) : null, "clientId" ,container.Add );
+ }
+ if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly))
+ {
+ AddIf( null != (((object)this._principalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._principalId.ToString()) : null, "principalId" ,container.Add );
+ }
+ AfterToJson(ref container);
+ return container;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.PowerShell.cs
new file mode 100644
index 000000000000..05bce4f4bd8a
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.PowerShell.cs
@@ -0,0 +1,189 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider
+ ///
+ [System.ComponentModel.TypeConverter(typeof(ImageTemplateTypeConverter))]
+ public partial class ImageTemplate
+ {
+
+ ///
+ /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the
+ /// object before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+
+ partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
+
+ ///
+ /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+
+ partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
+
+ ///
+ /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
+
+ ///
+ /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate DeserializeFromDictionary(global::System.Collections.IDictionary content)
+ {
+ return new ImageTemplate(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
+ {
+ return new ImageTemplate(content);
+ }
+
+ ///
+ /// Creates a new instance of , deserializing the content from a json string.
+ ///
+ /// a string containing a JSON serialized instance of this model.
+ /// an instance of the model class.
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText));
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ internal ImageTemplate(global::System.Collections.IDictionary content)
+ {
+ bool returnNow = false;
+ BeforeDeserializeDictionary(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePropertiesTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTagsTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError) content.GetValueForProperty("ProvisioningError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningErrorTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorMessage = (string) content.GetValueForProperty("ProvisioningErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorMessage, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Source = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Source, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSourceTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfile = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile) content.GetValueForProperty("VMProfile",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfile, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfileTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).BuildTimeoutInMinute = (int?) content.GetValueForProperty("BuildTimeoutInMinute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).BuildTimeoutInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Customize = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]) content.GetValueForProperty("Customize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Customize, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizerTypeConverter.ConvertFrom));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Distribute = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]) content.GetValueForProperty("Distribute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Distribute, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorTypeConverter.ConvertFrom));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatus = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus) content.GetValueForProperty("LastRunStatus",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatus, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatusTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState?) content.GetValueForProperty("LastRunStatusRunState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorCode = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode?) content.GetValueForProperty("ProvisioningErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorCode, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunSubState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState?) content.GetValueForProperty("LastRunStatusRunSubState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunSubState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusStartTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusStartTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusEndTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusEndTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusEndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusMessage = (string) content.GetValueForProperty("LastRunStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusMessage, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).SourceType = (string) content.GetValueForProperty("SourceType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).SourceType, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVnetConfig = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig) content.GetValueForProperty("VMProfileVnetConfig",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVnetConfig, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfigTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileOsdiskSizeGb = (int?) content.GetValueForProperty("VMProfileOsdiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileOsdiskSizeGb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVmsize = (string) content.GetValueForProperty("VMProfileVmsize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVmsize, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VnetConfigSubnetId = (string) content.GetValueForProperty("VnetConfigSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VnetConfigSubnetId, global::System.Convert.ToString);
+ AfterDeserializeDictionary(content);
+ }
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ internal ImageTemplate(global::System.Management.Automation.PSObject content)
+ {
+ bool returnNow = false;
+ BeforeDeserializePSObject(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePropertiesTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTagsTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError) content.GetValueForProperty("ProvisioningError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningErrorTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorMessage = (string) content.GetValueForProperty("ProvisioningErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorMessage, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Source = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Source, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSourceTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfile = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile) content.GetValueForProperty("VMProfile",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfile, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfileTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).BuildTimeoutInMinute = (int?) content.GetValueForProperty("BuildTimeoutInMinute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).BuildTimeoutInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Customize = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]) content.GetValueForProperty("Customize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Customize, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizerTypeConverter.ConvertFrom));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Distribute = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]) content.GetValueForProperty("Distribute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Distribute, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorTypeConverter.ConvertFrom));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatus = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus) content.GetValueForProperty("LastRunStatus",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatus, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatusTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState?) content.GetValueForProperty("LastRunStatusRunState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorCode = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode?) content.GetValueForProperty("ProvisioningErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorCode, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunSubState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState?) content.GetValueForProperty("LastRunStatusRunSubState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunSubState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState.CreateFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusStartTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusStartTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusEndTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusEndTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusEndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusMessage = (string) content.GetValueForProperty("LastRunStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusMessage, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).SourceType = (string) content.GetValueForProperty("SourceType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).SourceType, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVnetConfig = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig) content.GetValueForProperty("VMProfileVnetConfig",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVnetConfig, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfigTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileOsdiskSizeGb = (int?) content.GetValueForProperty("VMProfileOsdiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileOsdiskSizeGb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVmsize = (string) content.GetValueForProperty("VMProfileVmsize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVmsize, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VnetConfigSubnetId = (string) content.GetValueForProperty("VnetConfigSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VnetConfigSubnetId, global::System.Convert.ToString);
+ AfterDeserializePSObject(content);
+ }
+
+ /// Serializes this instance to a json string.
+
+ /// a containing this model serialized to JSON text.
+ public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString();
+ }
+ /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider
+ [System.ComponentModel.TypeConverter(typeof(ImageTemplateTypeConverter))]
+ public partial interface IImageTemplate
+
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.TypeConverter.cs
new file mode 100644
index 000000000000..981d6a6cfd73
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.TypeConverter.cs
@@ -0,0 +1,142 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// A PowerShell PSTypeConverter to support converting to an instance of
+ ///
+ public partial class ImageTemplateTypeConverter : global::System.Management.Automation.PSTypeConverter
+ {
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false.
+ ///
+ public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue);
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the instance to check if it can be converted to the type.
+ ///
+ /// true if the instance could be converted to a type, otherwise false
+ ///
+ public static bool CanConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return true;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ // we say yest to PSObjects
+ return true;
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ // we say yest to Hashtables/dictionaries
+ return true;
+ }
+ try
+ {
+ if (null != sourceValue.ToJsonString())
+ {
+ return true;
+ }
+ }
+ catch
+ {
+ // Not one of our objects
+ }
+ try
+ {
+ string text = sourceValue.ToString()?.Trim();
+ return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object;
+ }
+ catch
+ {
+ // Doesn't look like it can be treated as JSON
+ }
+ return false;
+ }
+
+ ///
+ /// Determines if the parameter can be converted to the parameter
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false
+ ///
+ public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false;
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue);
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the value to convert into an instance of .
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate ConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return null;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate).IsAssignableFrom(type))
+ {
+ return sourceValue;
+ }
+ try
+ {
+ return ImageTemplate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());;
+ }
+ catch
+ {
+ // Unable to use JSON pattern
+ }
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ return ImageTemplate.DeserializeFromPSObject(sourceValue);
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ return ImageTemplate.DeserializeFromDictionary(sourceValue);
+ }
+ return null;
+ }
+
+ /// NotImplemented -- this will return null
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ /// will always return null.
+ public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null;
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.cs
new file mode 100644
index 000000000000..aaa95efeb7c9
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.cs
@@ -0,0 +1,414 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ ///
+ /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider
+ ///
+ public partial class ImageTemplate :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates
+ {
+ ///
+ /// Backing field for Inherited model
+ ///
+ private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Resource();
+
+ ///
+ /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public int? BuildTimeoutInMinute { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).BuildTimeoutInMinute; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).BuildTimeoutInMinute = value; }
+
+ ///
+ /// Specifies the properties used to describe the customization steps of the image, like Image source etc
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Customize; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Customize = value; }
+
+ /// The distribution targets where the image output needs to go to.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Distribute; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Distribute = value; }
+
+ /// Resource Id
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)]
+ public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Id; }
+
+ /// Backing field for property.
+ private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity _identity;
+
+ /// The identity of the image template, if configured.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity()); set => this._identity = value; }
+
+ ///
+ /// The type of identity used for the image template. The type 'None' will remove any identities from the image template.
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).Type = value; }
+
+ ///
+ /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM
+ /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).UserAssignedIdentity; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).UserAssignedIdentity = value; }
+
+ /// End time of the last run (UTC)
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public global::System.DateTime? LastRunStatusEndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusEndTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusEndTime = value; }
+
+ /// Verbose information about the last run state
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public string LastRunStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusMessage = value; }
+
+ /// State of the last run
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusRunState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusRunState = value; }
+
+ /// Sub-state of the last run
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusRunSubState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusRunSubState = value; }
+
+ /// Start time of the last run (UTC)
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public global::System.DateTime? LastRunStatusStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusStartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusStartTime = value; }
+
+ /// Resource location
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)]
+ public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Location = value; }
+
+ /// Internal Acessors for Identity
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity()); set { {_identity = value;} } }
+
+ /// Internal Acessors for LastRunStatus
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.LastRunStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatus = value; }
+
+ /// Internal Acessors for Property
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties()); set { {_property = value;} } }
+
+ /// Internal Acessors for ProvisioningError
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.ProvisioningError { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningError; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningError = value; }
+
+ /// Internal Acessors for ProvisioningState
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningState = value; }
+
+ /// Internal Acessors for Source
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.Source { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Source; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Source = value; }
+
+ /// Internal Acessors for VMProfile
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.VMProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfile = value; }
+
+ /// Internal Acessors for VMProfileVnetConfig
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.VMProfileVnetConfig { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileVnetConfig; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileVnetConfig = value; }
+
+ /// Internal Acessors for Id
+ string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Id = value; }
+
+ /// Internal Acessors for Name
+ string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Name = value; }
+
+ /// Internal Acessors for Type
+ string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Type = value; }
+
+ /// Resource name
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)]
+ public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Name; }
+
+ /// Backing field for property.
+ private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties _property;
+
+ /// The properties of the image template
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties()); set => this._property = value; }
+
+ /// Error code of the provisioning failure
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningErrorCode = value; }
+
+ /// Verbose error message about the provisioning failure
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public string ProvisioningErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningErrorMessage = value; }
+
+ /// Provisioning state of the resource
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningState; }
+
+ /// Specifies the type of source image you want to start with.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public string SourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).SourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).SourceType = value; }
+
+ /// Resource tags
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Tag = value; }
+
+ /// Resource type
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)]
+ public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Type; }
+
+ ///
+ /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public int? VMProfileOsdiskSizeGb { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileOsdiskSizeGb; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileOsdiskSizeGb = value; }
+
+ ///
+ /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default
+ /// (Standard_D1_v2).
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public string VMProfileVmsize { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileVmsize; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileVmsize = value; }
+
+ /// Resource id of a pre-existing subnet.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)]
+ public string VnetConfigSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VnetConfigSubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VnetConfigSubnetId = value; }
+
+ /// Creates an new instance.
+ public ImageTemplate()
+ {
+
+ }
+
+ /// Validates that this object meets the validation criteria.
+ /// an instance that will receive validation
+ /// events.
+ ///
+ /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed.
+ ///
+ public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener)
+ {
+ await eventListener.AssertNotNull(nameof(__resource), __resource);
+ await eventListener.AssertObjectIsValid(nameof(__resource), __resource);
+ }
+ }
+ /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider
+ public partial interface IImageTemplate :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource
+ {
+ ///
+ /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).",
+ SerializedName = @"buildTimeoutInMinutes",
+ PossibleTypes = new [] { typeof(int) })]
+ int? BuildTimeoutInMinute { get; set; }
+ ///
+ /// Specifies the properties used to describe the customization steps of the image, like Image source etc
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Specifies the properties used to describe the customization steps of the image, like Image source etc",
+ SerializedName = @"customize",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get; set; }
+ /// The distribution targets where the image output needs to go to.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = true,
+ ReadOnly = false,
+ Description = @"The distribution targets where the image output needs to go to.",
+ SerializedName = @"distribute",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get; set; }
+ ///
+ /// The type of identity used for the image template. The type 'None' will remove any identities from the image template.
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The type of identity used for the image template. The type 'None' will remove any identities from the image template.",
+ SerializedName = @"type",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get; set; }
+ ///
+ /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM
+ /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
+ SerializedName = @"userAssignedIdentities",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; }
+ /// End time of the last run (UTC)
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"End time of the last run (UTC)",
+ SerializedName = @"endTime",
+ PossibleTypes = new [] { typeof(global::System.DateTime) })]
+ global::System.DateTime? LastRunStatusEndTime { get; set; }
+ /// Verbose information about the last run state
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Verbose information about the last run state",
+ SerializedName = @"message",
+ PossibleTypes = new [] { typeof(string) })]
+ string LastRunStatusMessage { get; set; }
+ /// State of the last run
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"State of the last run",
+ SerializedName = @"runState",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get; set; }
+ /// Sub-state of the last run
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Sub-state of the last run",
+ SerializedName = @"runSubState",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get; set; }
+ /// Start time of the last run (UTC)
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Start time of the last run (UTC)",
+ SerializedName = @"startTime",
+ PossibleTypes = new [] { typeof(global::System.DateTime) })]
+ global::System.DateTime? LastRunStatusStartTime { get; set; }
+ /// Error code of the provisioning failure
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Error code of the provisioning failure",
+ SerializedName = @"provisioningErrorCode",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get; set; }
+ /// Verbose error message about the provisioning failure
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Verbose error message about the provisioning failure",
+ SerializedName = @"message",
+ PossibleTypes = new [] { typeof(string) })]
+ string ProvisioningErrorMessage { get; set; }
+ /// Provisioning state of the resource
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = true,
+ Description = @"Provisioning state of the resource",
+ SerializedName = @"provisioningState",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; }
+ /// Specifies the type of source image you want to start with.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = true,
+ ReadOnly = false,
+ Description = @"Specifies the type of source image you want to start with.",
+ SerializedName = @"type",
+ PossibleTypes = new [] { typeof(string) })]
+ string SourceType { get; set; }
+ ///
+ /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.",
+ SerializedName = @"osDiskSizeGB",
+ PossibleTypes = new [] { typeof(int) })]
+ int? VMProfileOsdiskSizeGb { get; set; }
+ ///
+ /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default
+ /// (Standard_D1_v2).
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2).",
+ SerializedName = @"vmSize",
+ PossibleTypes = new [] { typeof(string) })]
+ string VMProfileVmsize { get; set; }
+ /// Resource id of a pre-existing subnet.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Resource id of a pre-existing subnet.",
+ SerializedName = @"subnetId",
+ PossibleTypes = new [] { typeof(string) })]
+ string VnetConfigSubnetId { get; set; }
+
+ }
+ /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider
+ public partial interface IImageTemplateInternal :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal
+ {
+ ///
+ /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).
+ ///
+ int? BuildTimeoutInMinute { get; set; }
+ ///
+ /// Specifies the properties used to describe the customization steps of the image, like Image source etc
+ ///
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get; set; }
+ /// The distribution targets where the image output needs to go to.
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get; set; }
+ /// The identity of the image template, if configured.
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Identity { get; set; }
+ ///
+ /// The type of identity used for the image template. The type 'None' will remove any identities from the image template.
+ ///
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get; set; }
+ ///
+ /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM
+ /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
+ ///
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; }
+ /// State of 'run' that is currently executing or was last executed.
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus LastRunStatus { get; set; }
+ /// End time of the last run (UTC)
+ global::System.DateTime? LastRunStatusEndTime { get; set; }
+ /// Verbose information about the last run state
+ string LastRunStatusMessage { get; set; }
+ /// State of the last run
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get; set; }
+ /// Sub-state of the last run
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get; set; }
+ /// Start time of the last run (UTC)
+ global::System.DateTime? LastRunStatusStartTime { get; set; }
+ /// The properties of the image template
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties Property { get; set; }
+ /// Provisioning error, if any
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError ProvisioningError { get; set; }
+ /// Error code of the provisioning failure
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get; set; }
+ /// Verbose error message about the provisioning failure
+ string ProvisioningErrorMessage { get; set; }
+ /// Provisioning state of the resource
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; set; }
+ /// Specifies the properties used to describe the source image.
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource Source { get; set; }
+ /// Specifies the type of source image you want to start with.
+ string SourceType { get; set; }
+ /// Describes how virtual machine is set up to build images
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile VMProfile { get; set; }
+ ///
+ /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.
+ ///
+ int? VMProfileOsdiskSizeGb { get; set; }
+ ///
+ /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default
+ /// (Standard_D1_v2).
+ ///
+ string VMProfileVmsize { get; set; }
+ ///
+ /// Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual
+ /// network needs to be used.
+ ///
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig VMProfileVnetConfig { get; set; }
+ /// Resource id of a pre-existing subnet.
+ string VnetConfigSubnetId { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.json.cs
new file mode 100644
index 000000000000..a252b301eaae
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.json.cs
@@ -0,0 +1,107 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ ///
+ /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider
+ ///
+ public partial class ImageTemplate
+ {
+
+ ///
+ /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JsonNode that should be deserialized into this object.
+
+ partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json);
+
+ ///
+ /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JSON container that the serialization result will be placed in.
+
+ partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container);
+
+ ///
+ /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of
+ /// the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JsonNode that should be deserialized into this object.
+ /// Determines if the rest of the deserialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow);
+
+ ///
+ /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the
+ /// object before it is serialized.
+ /// If you wish to disable the default serialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JSON container that the serialization result will be placed in.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow);
+
+ ///
+ /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate.
+ ///
+ /// a to deserialize from.
+ ///
+ /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node)
+ {
+ return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplate(json) : null;
+ }
+
+ ///
+ /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of .
+ ///
+ /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from.
+ internal ImageTemplate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ bool returnNow = false;
+ BeforeFromJson(json, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ __resource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Resource(json);
+ {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity.FromJson(__jsonIdentity) : Identity;}
+ {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties.FromJson(__jsonProperties) : Property;}
+ AfterFromJson(json);
+ }
+
+ ///
+ /// Serializes this instance of into a .
+ ///
+ /// The container to serialize this object into. If the caller
+ /// passes in null, a new instance will be created and returned to the caller.
+ /// Allows the caller to choose the depth of the serialization. See .
+ ///
+ /// a serialized instance of as a .
+ ///
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode)
+ {
+ container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject();
+
+ bool returnNow = false;
+ BeforeToJson(ref container, ref returnNow);
+ if (returnNow)
+ {
+ return container;
+ }
+ __resource?.ToJson(container, serializationMode);
+ AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add );
+ AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add );
+ AfterToJson(ref container);
+ return container;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.PowerShell.cs
new file mode 100644
index 000000000000..402312cd591e
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.PowerShell.cs
@@ -0,0 +1,135 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ /// Describes a unit of image customization
+ [System.ComponentModel.TypeConverter(typeof(ImageTemplateCustomizerTypeConverter))]
+ public partial class ImageTemplateCustomizer
+ {
+
+ ///
+ /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the
+ /// object before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+
+ partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
+
+ ///
+ /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+
+ partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
+
+ ///
+ /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
+
+ ///
+ /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer DeserializeFromDictionary(global::System.Collections.IDictionary content)
+ {
+ return new ImageTemplateCustomizer(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
+ {
+ return new ImageTemplateCustomizer(content);
+ }
+
+ ///
+ /// Creates a new instance of , deserializing the content from a json string.
+ ///
+ /// a string containing a JSON serialized instance of this model.
+ /// an instance of the model class.
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText));
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ internal ImageTemplateCustomizer(global::System.Collections.IDictionary content)
+ {
+ bool returnNow = false;
+ BeforeDeserializeDictionary(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString);
+ AfterDeserializeDictionary(content);
+ }
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ internal ImageTemplateCustomizer(global::System.Management.Automation.PSObject content)
+ {
+ bool returnNow = false;
+ BeforeDeserializePSObject(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString);
+ AfterDeserializePSObject(content);
+ }
+
+ /// Serializes this instance to a json string.
+
+ /// a containing this model serialized to JSON text.
+ public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString();
+ }
+ /// Describes a unit of image customization
+ [System.ComponentModel.TypeConverter(typeof(ImageTemplateCustomizerTypeConverter))]
+ public partial interface IImageTemplateCustomizer
+
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.TypeConverter.cs
new file mode 100644
index 000000000000..ddf39fcf30e7
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.TypeConverter.cs
@@ -0,0 +1,142 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// A PowerShell PSTypeConverter to support converting to an instance of
+ ///
+ public partial class ImageTemplateCustomizerTypeConverter : global::System.Management.Automation.PSTypeConverter
+ {
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false.
+ ///
+ public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue);
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the instance to check if it can be converted to the type.
+ ///
+ /// true if the instance could be converted to a type, otherwise false
+ ///
+ public static bool CanConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return true;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ // we say yest to PSObjects
+ return true;
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ // we say yest to Hashtables/dictionaries
+ return true;
+ }
+ try
+ {
+ if (null != sourceValue.ToJsonString())
+ {
+ return true;
+ }
+ }
+ catch
+ {
+ // Not one of our objects
+ }
+ try
+ {
+ string text = sourceValue.ToString()?.Trim();
+ return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object;
+ }
+ catch
+ {
+ // Doesn't look like it can be treated as JSON
+ }
+ return false;
+ }
+
+ ///
+ /// Determines if the parameter can be converted to the parameter
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false
+ ///
+ public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false;
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue);
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the value to convert into an instance of .
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer ConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return null;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer).IsAssignableFrom(type))
+ {
+ return sourceValue;
+ }
+ try
+ {
+ return ImageTemplateCustomizer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());;
+ }
+ catch
+ {
+ // Unable to use JSON pattern
+ }
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ return ImageTemplateCustomizer.DeserializeFromPSObject(sourceValue);
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ return ImageTemplateCustomizer.DeserializeFromDictionary(sourceValue);
+ }
+ return null;
+ }
+
+ /// NotImplemented -- this will return null
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ /// will always return null.
+ public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null;
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.cs
new file mode 100644
index 000000000000..b0a79491cf87
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.cs
@@ -0,0 +1,69 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ /// Describes a unit of image customization
+ public partial class ImageTemplateCustomizer :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal
+ {
+
+ /// Backing field for property.
+ private string _name;
+
+ /// Friendly Name to provide context on what this customization step does
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Name { get => this._name; set => this._name = value; }
+
+ /// Backing field for property.
+ private string _type;
+
+ ///
+ /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Type { get => this._type; set => this._type = value; }
+
+ /// Creates an new instance.
+ public ImageTemplateCustomizer()
+ {
+
+ }
+ }
+ /// Describes a unit of image customization
+ public partial interface IImageTemplateCustomizer :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable
+ {
+ /// Friendly Name to provide context on what this customization step does
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Friendly Name to provide context on what this customization step does",
+ SerializedName = @"name",
+ PossibleTypes = new [] { typeof(string) })]
+ string Name { get; set; }
+ ///
+ /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = true,
+ ReadOnly = false,
+ Description = @"The type of customization tool you want to use on the Image. For example, ""Shell"" can be shell customizer",
+ SerializedName = @"type",
+ PossibleTypes = new [] { typeof(string) })]
+ string Type { get; set; }
+
+ }
+ /// Describes a unit of image customization
+ public partial interface IImageTemplateCustomizerInternal
+
+ {
+ /// Friendly Name to provide context on what this customization step does
+ string Name { get; set; }
+ ///
+ /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer
+ ///
+ string Type { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.json.cs
new file mode 100644
index 000000000000..75a676bf732f
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.json.cs
@@ -0,0 +1,134 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ /// Describes a unit of image customization
+ public partial class ImageTemplateCustomizer
+ {
+
+ ///
+ /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JsonNode that should be deserialized into this object.
+
+ partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json);
+
+ ///
+ /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JSON container that the serialization result will be placed in.
+
+ partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container);
+
+ ///
+ /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of
+ /// the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JsonNode that should be deserialized into this object.
+ /// Determines if the rest of the deserialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow);
+
+ ///
+ /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the
+ /// object before it is serialized.
+ /// If you wish to disable the default serialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JSON container that the serialization result will be placed in.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow);
+
+ ///
+ /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer.
+ /// Note: the Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer interface is polymorphic,
+ /// and the precise model class that will get deserialized is determined at runtime based on the payload.
+ ///
+ /// a to deserialize from.
+ ///
+ /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node)
+ {
+ if (!(node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json))
+ {
+ return null;
+ }
+ // Polymorphic type -- select the appropriate constructor using the discriminator
+
+ switch ( json.StringProperty("type") )
+ {
+ case "Shell":
+ {
+ return new ImageTemplateShellCustomizer(json);
+ }
+ case "WindowsRestart":
+ {
+ return new ImageTemplateRestartCustomizer(json);
+ }
+ case "WindowsUpdate":
+ {
+ return new ImageTemplateWindowsUpdateCustomizer(json);
+ }
+ case "PowerShell":
+ {
+ return new ImageTemplatePowerShellCustomizer(json);
+ }
+ case "File":
+ {
+ return new ImageTemplateFileCustomizer(json);
+ }
+ }
+ return new ImageTemplateCustomizer(json);
+ }
+
+ ///
+ /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of .
+ ///
+ /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from.
+ internal ImageTemplateCustomizer(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ bool returnNow = false;
+ BeforeFromJson(json, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;}
+ {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;}
+ AfterFromJson(json);
+ }
+
+ ///
+ /// Serializes this instance of into a .
+ ///
+ /// The container to serialize this object into. If the caller
+ /// passes in null, a new instance will be created and returned to the caller.
+ /// Allows the caller to choose the depth of the serialization. See .
+ ///
+ /// a serialized instance of as a .
+ ///
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode)
+ {
+ container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject();
+
+ bool returnNow = false;
+ BeforeToJson(ref container, ref returnNow);
+ if (returnNow)
+ {
+ return container;
+ }
+ AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add );
+ AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add );
+ AfterToJson(ref container);
+ return container;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.PowerShell.cs
new file mode 100644
index 000000000000..17168f36034c
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.PowerShell.cs
@@ -0,0 +1,137 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ /// Generic distribution object
+ [System.ComponentModel.TypeConverter(typeof(ImageTemplateDistributorTypeConverter))]
+ public partial class ImageTemplateDistributor
+ {
+
+ ///
+ /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the
+ /// object before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+
+ partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
+
+ ///
+ /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+
+ partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
+
+ ///
+ /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
+
+ ///
+ /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor DeserializeFromDictionary(global::System.Collections.IDictionary content)
+ {
+ return new ImageTemplateDistributor(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
+ {
+ return new ImageTemplateDistributor(content);
+ }
+
+ ///
+ /// Creates a new instance of , deserializing the content from a json string.
+ ///
+ /// a string containing a JSON serialized instance of this model.
+ /// an instance of the model class.
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText));
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ internal ImageTemplateDistributor(global::System.Collections.IDictionary content)
+ {
+ bool returnNow = false;
+ BeforeDeserializeDictionary(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString);
+ AfterDeserializeDictionary(content);
+ }
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ internal ImageTemplateDistributor(global::System.Management.Automation.PSObject content)
+ {
+ bool returnNow = false;
+ BeforeDeserializePSObject(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom);
+ ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString);
+ AfterDeserializePSObject(content);
+ }
+
+ /// Serializes this instance to a json string.
+
+ /// a containing this model serialized to JSON text.
+ public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString();
+ }
+ /// Generic distribution object
+ [System.ComponentModel.TypeConverter(typeof(ImageTemplateDistributorTypeConverter))]
+ public partial interface IImageTemplateDistributor
+
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.TypeConverter.cs
new file mode 100644
index 000000000000..f225d862b995
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.TypeConverter.cs
@@ -0,0 +1,142 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// A PowerShell PSTypeConverter to support converting to an instance of
+ ///
+ public partial class ImageTemplateDistributorTypeConverter : global::System.Management.Automation.PSTypeConverter
+ {
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false.
+ ///
+ public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue);
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the instance to check if it can be converted to the type.
+ ///
+ /// true if the instance could be converted to a type, otherwise false
+ ///
+ public static bool CanConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return true;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ // we say yest to PSObjects
+ return true;
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ // we say yest to Hashtables/dictionaries
+ return true;
+ }
+ try
+ {
+ if (null != sourceValue.ToJsonString())
+ {
+ return true;
+ }
+ }
+ catch
+ {
+ // Not one of our objects
+ }
+ try
+ {
+ string text = sourceValue.ToString()?.Trim();
+ return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object;
+ }
+ catch
+ {
+ // Doesn't look like it can be treated as JSON
+ }
+ return false;
+ }
+
+ ///
+ /// Determines if the parameter can be converted to the parameter
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false
+ ///
+ public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false;
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue);
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the value to convert into an instance of .
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor ConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return null;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor).IsAssignableFrom(type))
+ {
+ return sourceValue;
+ }
+ try
+ {
+ return ImageTemplateDistributor.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());;
+ }
+ catch
+ {
+ // Unable to use JSON pattern
+ }
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ return ImageTemplateDistributor.DeserializeFromPSObject(sourceValue);
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ return ImageTemplateDistributor.DeserializeFromDictionary(sourceValue);
+ }
+ return null;
+ }
+
+ /// NotImplemented -- this will return null
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ /// will always return null.
+ public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null;
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.cs
new file mode 100644
index 000000000000..cda1b8311d06
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.cs
@@ -0,0 +1,86 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ /// Generic distribution object
+ public partial class ImageTemplateDistributor :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal
+ {
+
+ /// Backing field for property.
+ private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags _artifactTag;
+
+ ///
+ /// Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get => (this._artifactTag = this._artifactTag ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags()); set => this._artifactTag = value; }
+
+ /// Backing field for property.
+ private string _runOutputName;
+
+ /// The name to be used for the associated RunOutput.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string RunOutputName { get => this._runOutputName; set => this._runOutputName = value; }
+
+ /// Backing field for property.
+ private string _type;
+
+ /// Type of distribution.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)]
+ public string Type { get => this._type; set => this._type = value; }
+
+ /// Creates an new instance.
+ public ImageTemplateDistributor()
+ {
+
+ }
+ }
+ /// Generic distribution object
+ public partial interface IImageTemplateDistributor :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable
+ {
+ ///
+ /// Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ ///
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = false,
+ ReadOnly = false,
+ Description = @"Tags that will be applied to the artifact once it has been created/updated by the distributor.",
+ SerializedName = @"artifactTags",
+ PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) })]
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get; set; }
+ /// The name to be used for the associated RunOutput.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = true,
+ ReadOnly = false,
+ Description = @"The name to be used for the associated RunOutput.",
+ SerializedName = @"runOutputName",
+ PossibleTypes = new [] { typeof(string) })]
+ string RunOutputName { get; set; }
+ /// Type of distribution.
+ [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(
+ Required = true,
+ ReadOnly = false,
+ Description = @"Type of distribution.",
+ SerializedName = @"type",
+ PossibleTypes = new [] { typeof(string) })]
+ string Type { get; set; }
+
+ }
+ /// Generic distribution object
+ public partial interface IImageTemplateDistributorInternal
+
+ {
+ ///
+ /// Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ ///
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get; set; }
+ /// The name to be used for the associated RunOutput.
+ string RunOutputName { get; set; }
+ /// Type of distribution.
+ string Type { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.json.cs
new file mode 100644
index 000000000000..695182446f26
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.json.cs
@@ -0,0 +1,128 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ /// Generic distribution object
+ public partial class ImageTemplateDistributor
+ {
+
+ ///
+ /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JsonNode that should be deserialized into this object.
+
+ partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json);
+
+ ///
+ /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The JSON container that the serialization result will be placed in.
+
+ partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container);
+
+ ///
+ /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of
+ /// the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JsonNode that should be deserialized into this object.
+ /// Determines if the rest of the deserialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow);
+
+ ///
+ /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the
+ /// object before it is serialized.
+ /// If you wish to disable the default serialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The JSON container that the serialization result will be placed in.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow);
+
+ ///
+ /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor.
+ /// Note: the Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor interface is polymorphic,
+ /// and the precise model class that will get deserialized is determined at runtime based on the payload.
+ ///
+ /// a to deserialize from.
+ ///
+ /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node)
+ {
+ if (!(node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json))
+ {
+ return null;
+ }
+ // Polymorphic type -- select the appropriate constructor using the discriminator
+
+ switch ( json.StringProperty("type") )
+ {
+ case "ManagedImage":
+ {
+ return new ImageTemplateManagedImageDistributor(json);
+ }
+ case "SharedImage":
+ {
+ return new ImageTemplateSharedImageDistributor(json);
+ }
+ case "VHD":
+ {
+ return new ImageTemplateVhdDistributor(json);
+ }
+ }
+ return new ImageTemplateDistributor(json);
+ }
+
+ ///
+ /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of .
+ ///
+ /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from.
+ internal ImageTemplateDistributor(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)
+ {
+ bool returnNow = false;
+ BeforeFromJson(json, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;}
+ {_artifactTag = If( json?.PropertyT("artifactTags"), out var __jsonArtifactTags) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags.FromJson(__jsonArtifactTags) : ArtifactTag;}
+ {_runOutputName = If( json?.PropertyT("runOutputName"), out var __jsonRunOutputName) ? (string)__jsonRunOutputName : (string)RunOutputName;}
+ AfterFromJson(json);
+ }
+
+ ///
+ /// Serializes this instance of into a .
+ ///
+ /// The container to serialize this object into. If the caller
+ /// passes in null, a new instance will be created and returned to the caller.
+ /// Allows the caller to choose the depth of the serialization. See .
+ ///
+ /// a serialized instance of as a .
+ ///
+ public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode)
+ {
+ container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject();
+
+ bool returnNow = false;
+ BeforeToJson(ref container, ref returnNow);
+ if (returnNow)
+ {
+ return container;
+ }
+ AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add );
+ AddIf( null != this._artifactTag ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._artifactTag.ToJson(null,serializationMode) : null, "artifactTags" ,container.Add );
+ AddIf( null != (((object)this._runOutputName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._runOutputName.ToString()) : null, "runOutputName" ,container.Add );
+ AfterToJson(ref container);
+ return container;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.PowerShell.cs
new file mode 100644
index 000000000000..89c0b635764b
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.PowerShell.cs
@@ -0,0 +1,137 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ ///
+ [System.ComponentModel.TypeConverter(typeof(ImageTemplateDistributorArtifactTagsTypeConverter))]
+ public partial class ImageTemplateDistributorArtifactTags
+ {
+
+ ///
+ /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the
+ /// object before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+
+ partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
+
+ ///
+ /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object
+ /// before it is returned. Implement this method in a partial class to enable this behavior
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+
+ partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
+
+ ///
+ /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
+
+ ///
+ /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization
+ /// of the object before it is deserialized.
+ /// If you wish to disable the default deserialization entirely, return true in the output parameter.
+ /// Implement this method in a partial class to enable this behavior.
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ /// Determines if the rest of the serialization should be processed, or if the method should return
+ /// instantly.
+
+ partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags DeserializeFromDictionary(global::System.Collections.IDictionary content)
+ {
+ return new ImageTemplateDistributorArtifactTags(content);
+ }
+
+ ///
+ /// Deserializes a into an instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ ///
+ /// an instance of .
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
+ {
+ return new ImageTemplateDistributorArtifactTags(content);
+ }
+
+ ///
+ /// Creates a new instance of , deserializing the content from a json string.
+ ///
+ /// a string containing a JSON serialized instance of this model.
+ /// an instance of the model class.
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText));
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Collections.IDictionary content that should be used.
+ internal ImageTemplateDistributorArtifactTags(global::System.Collections.IDictionary content)
+ {
+ bool returnNow = false;
+ BeforeDeserializeDictionary(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ // this type is a dictionary; copy elements from source to here.
+ CopyFrom(content);
+ AfterDeserializeDictionary(content);
+ }
+
+ ///
+ /// Deserializes a into a new instance of .
+ ///
+ /// The global::System.Management.Automation.PSObject content that should be used.
+ internal ImageTemplateDistributorArtifactTags(global::System.Management.Automation.PSObject content)
+ {
+ bool returnNow = false;
+ BeforeDeserializePSObject(content, ref returnNow);
+ if (returnNow)
+ {
+ return;
+ }
+ // actually deserialize
+ // this type is a dictionary; copy elements from source to here.
+ CopyFrom(content);
+ AfterDeserializePSObject(content);
+ }
+
+ /// Serializes this instance to a json string.
+
+ /// a containing this model serialized to JSON text.
+ public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString();
+ }
+ /// Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ [System.ComponentModel.TypeConverter(typeof(ImageTemplateDistributorArtifactTagsTypeConverter))]
+ public partial interface IImageTemplateDistributorArtifactTags
+
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.TypeConverter.cs
new file mode 100644
index 000000000000..e6c7925deca1
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.TypeConverter.cs
@@ -0,0 +1,144 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell;
+
+ ///
+ /// A PowerShell PSTypeConverter to support converting to an instance of
+ ///
+ public partial class ImageTemplateDistributorArtifactTagsTypeConverter : global::System.Management.Automation.PSTypeConverter
+ {
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false.
+ ///
+ public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue);
+
+ ///
+ /// Determines if the converter can convert the parameter to the
+ /// parameter.
+ ///
+ /// the instance to check if it can be converted to the type.
+ ///
+ /// true if the instance could be converted to a type, otherwise
+ /// false
+ ///
+ public static bool CanConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return true;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ // we say yest to PSObjects
+ return true;
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ // we say yest to Hashtables/dictionaries
+ return true;
+ }
+ try
+ {
+ if (null != sourceValue.ToJsonString())
+ {
+ return true;
+ }
+ }
+ catch
+ {
+ // Not one of our objects
+ }
+ try
+ {
+ string text = sourceValue.ToString()?.Trim();
+ return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object;
+ }
+ catch
+ {
+ // Doesn't look like it can be treated as JSON
+ }
+ return false;
+ }
+
+ ///
+ /// Determines if the parameter can be converted to the parameter
+ ///
+ /// the to convert from
+ /// the to convert to
+ ///
+ /// true if the converter can convert the parameter to the
+ /// parameter, otherwise false
+ ///
+ public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false;
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue);
+
+ ///
+ /// Converts the parameter to the parameter using and
+ ///
+ /// the value to convert into an instance of .
+ ///
+ /// an instance of , or null if there is no suitable conversion.
+ ///
+ public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ConvertFrom(dynamic sourceValue)
+ {
+ if (null == sourceValue)
+ {
+ return null;
+ }
+ global::System.Type type = sourceValue.GetType();
+ if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags).IsAssignableFrom(type))
+ {
+ return sourceValue;
+ }
+ try
+ {
+ return ImageTemplateDistributorArtifactTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());;
+ }
+ catch
+ {
+ // Unable to use JSON pattern
+ }
+ if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type))
+ {
+ return ImageTemplateDistributorArtifactTags.DeserializeFromPSObject(sourceValue);
+ }
+ if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type))
+ {
+ return ImageTemplateDistributorArtifactTags.DeserializeFromDictionary(sourceValue);
+ }
+ return null;
+ }
+
+ /// NotImplemented -- this will return null
+ /// the to convert from
+ /// the to convert to
+ /// not used by this TypeConverter.
+ /// when set to true, will ignore the case when converting.
+ /// will always return null.
+ public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null;
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.cs
new file mode 100644
index 000000000000..9dfc8726c222
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.cs
@@ -0,0 +1,32 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ ///
+ /// Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ ///
+ public partial class ImageTemplateDistributorArtifactTags :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTagsInternal
+ {
+
+ /// Creates an new instance.
+ public ImageTemplateDistributorArtifactTags()
+ {
+
+ }
+ }
+ /// Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ public partial interface IImageTemplateDistributorArtifactTags :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable,
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray
+ {
+
+ }
+ /// Tags that will be applied to the artifact once it has been created/updated by the distributor.
+ public partial interface IImageTemplateDistributorArtifactTagsInternal
+
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.dictionary.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.dictionary.cs
new file mode 100644
index 000000000000..10c838d2157d
--- /dev/null
+++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.dictionary.cs
@@ -0,0 +1,70 @@
+namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214
+{
+ using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions;
+
+ public partial class ImageTemplateDistributorArtifactTags :
+ Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray
+ {
+ protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary();
+
+ global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray