Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ImageBuilder] Upgrade API verision from 2020-02-14 to 2022-02-14 #19156

Merged
merged 5 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/ImageBuilder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bin
obj
.vs
generated
internal
exports
tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
/*.ps1
/*.ps1xml
/*.psm1
/*.snk
/*.csproj
/*.nuspec
135 changes: 10 additions & 125 deletions src/ImageBuilder/Az.ImageBuilder.psd1
Original file line number Diff line number Diff line change
@@ -1,139 +1,24 @@
#
# Module manifest for module 'Az.ImageBuilder'
#
# Generated by: Microsoft Corporation
#
# Generated on: 2021-03-11
#

@{

# Script module or binary module file associated with this manifest.
GUID = 'bdedc683-d9b6-41ea-b310-d068b8c72305'
RootModule = './Az.ImageBuilder.psm1'

# Version number of this module.
ModuleVersion = '0.2.0'

# Supported PSEditions
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'

# ID used to uniquely identify this module
GUID = 'bdedc683-d9b6-41ea-b310-d068b8c72305'

# Author of this module
Author = 'Microsoft Corporation'

# Company or vendor of this module
CompanyName = 'Microsoft Corporation'

# Copyright statement for this module
Copyright = 'Microsoft Corporation. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Microsoft Azure PowerShell: ImageBuilder cmdlets'

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '5.1'

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
DotNetFrameworkVersion = '4.7.2'

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.2.8'; })

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = './bin/Az.ImageBuilder.private.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = './Az.ImageBuilder.format.ps1xml'

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Get-AzImageBuilderRunOutput', 'Get-AzImageBuilderTemplate',
'New-AzImageBuilderCustomizerObject',
'New-AzImageBuilderDistributorObject',
'New-AzImageBuilderSourceObject', 'New-AzImageBuilderTemplate',
'Remove-AzImageBuilderTemplate', 'Start-AzImageBuilderTemplate',
'Stop-AzImageBuilderTemplate'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
# VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
FunctionsToExport = 'Get-AzImageBuilderTemplate', 'Get-AzImageBuilderTemplateRunOutput', 'New-AzImageBuilderTemplate', 'New-AzImageBuilderTemplateCustomizerObject', 'New-AzImageBuilderTemplateDistributorObject', 'New-AzImageBuilderTemplateSourceObject', 'New-AzImageBuilderTemplateValidatorObject', 'Remove-AzImageBuilderTemplate', 'Start-AzImageBuilderTemplate', 'Stop-AzImageBuilderTemplate', '*'
AliasesToExport = '*'

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'Azure','ResourceManager','ARM','PSModule','ImageBuilder'

# A URL to the license for this module.
LicenseUri = 'https://aka.ms/azps-license'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/Azure/azure-powershell'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Added support for runAsSystem parameter in `New-AzImageBuilderCustomizerObject` [#13163]
* Added support to create template basing on imported json in `New-AzImageBuilderTemplate`. [#12634]'

# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false

# External dependent modules of this module
# ExternalModuleDependencies = @()

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'ImageBuilder'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}


}
131 changes: 85 additions & 46 deletions src/ImageBuilder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This directory contains the PowerShell module for the ImageBuilder service.
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.

## Module Requirements
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 1.8.1 or greater
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater

## Authentication
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.
Expand Down Expand Up @@ -50,66 +50,105 @@ In this directory, run AutoRest:
require:
- $(this-folder)/../readme.azure.noprofile.md
input-file:
- $(repo)/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2020-02-14/imagebuilder.json
branch: 94ec975d860d4f62525c2381d1cbf7de3e24df2b
- $(repo)/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/imagebuilder.json
branch: 9f3ac7b135ac83007b7f3f68ca8ca9705284cff9
title: ImageBuilder
module-version: 0.1.0
subject-prefix: ''
subject-prefix: $(service-name)

identity-correction-for-post: true
resourcegroup-append: true

directive:
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
verb: Set|Update
subject: VirtualMachineImageTemplate
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$
remove: true
# Remove the set-* cmdlet
- where:
subject: VirtualMachineImageTemplateRunOutput
verb: Set
remove: true

# 1. Field 'identity' is required => IdentityType and IdentityUserAssignedIdentity are required
# 2. Field 'properties' is required => Source, Customize and Distribute are required
- where:
variant: ^CreateExpanded$
hide: true

# Rename IdentityUserAssignedIdentity to UserAssignedIdentity
- where:
parameter-name: IdentityUserAssignedIdentity
set:
subject: ImageBuilderRunOutput
parameter-name: UserAssignedIdentity

# Rename *-AzImageBuildVirtualMachineImage(.*) -> *-AzImageBuild(.*)
- where:
subject: VirtualMachineImageTemplate
subject: (.*)Image(.*)
set:
subject: ImageBuilderTemplate
subject: $2

# Update/Upgrade of image template is not supported
- where:
verb: New
subject: ImageBuilderTemplate
hide: true
verb: Update
subject: Template
remove: true

# Rename ImageTemplateName -> Name and keep ImageTemplateName as alias in *-AzImageBuildTemplate
- where:
subject: ImageBuilderTemplate
subject: Template
parameter-name: ImageTemplateName
set:
alias: Name
# - where:
# variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
# remove: true
parameter-name: Name
alias: ImageTemplateName

# Rename RunOutputName -> Name and keep RunOutputName as alias in *-AzImageBuildTemplateRunOutput
- where:
variant: ^CreateExpanded$|^CreateViaIdentityExpanded$
remove: true
- from: source-file-csharp
where: $
transform: $ = $.replace(/internal partial interface/, 'public partial interface');
- from: source-file-csharp
where: $
transform: $ = $.replace(/Azure-AsyncOperation/g, 'azure-asyncoperation');
- from: swagger-document
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run"].post.responses
transform: >-
return {
"200": {
"description": "The operation was successful."
},
"204": {
"description": "The operation was successful."
},
"202": {
"description": "The operation will be completed asynchronously."
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ApiError"
}
}
}
subject: TemplateRunOutput
parameter-name: RunOutputName
set:
parameter-name: Name
alias: RunOutputName

# Rename ValidateInVMValidation to Validator
- where:
parameter-name: ValidateInVMValidation
set:
parameter-name: Validator

# Collapse model with discriminator
- no-inline:
- ImageTemplateCustomizer
- ImageTemplateDistributor
- ImageTemplateSource
- ImageTemplateInVMValidator

# Generate models and combine them as 1 cmdlet
# - model-cmdlet:
############ ImageTemplateCustomizer ############
# Combine as 1 cmdlet named New-AzImageBuilderTemplateCustomizerObject
# # - ImageTemplateCustomizer
# - ImageTemplateShellCustomizer
# - ImageTemplateRestartCustomizer
# - ImageTemplateWindowsUpdateCustomizer
# - ImageTemplatePowerShellCustomizer
# - ImageTemplateFileCustomizer
########### ImageTemplateDistributor ###########
# Combine as 1 cmdlet named New-AzImageBuilderTemplateDistributorObject
# # - ImageTemplateDistributor
# - ImageTemplateManagedImageDistributor
# - ImageTemplateSharedImageDistributor
# - ImageTemplateVhdDistributor
############## ImageTemplateSource ##############
# Combine as 1 cmdlet named New-AzImageBuilderTemplateSourceObject
# # - ImageTemplateSource
# Note: publisher, offer, sku and version are required
# - ImageTemplatePlatformImageSource
# - ImageTemplateManagedImageSource
# - ImageTemplateSharedImageVersionSource
########### ImageTemplateInVMValidator ###########
# Combine as 1 cmdlet named New-AzImageBuilderTemplateValidatorObject
# # - ImageTemplateInVMValidator
# - ImageTemplateShellValidator
# - ImageTemplatePowerShellValidator
```
Loading