internal/New-AzStackHCIVMMachineExtension.ps1
# ---------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # 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. # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code # is regenerated. # ---------------------------------------------------------------------------------- <# .Synopsis The operation to create or update the extension. .Description The operation to create or update the extension. .Example {{ Add code here }} .Example {{ Add code here }} .Inputs Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.IMachineExtension .Inputs Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.IStackHcivmIdentity .Outputs Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.IMachineExtension .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. EXTENSIONPARAMETER <IMachineExtension>: Describes a Machine Extension. Location <String>: The geo-location where the resource lives [Tag <ITrackedResourceTags>]: Resource tags. [(Any) <String>]: This indicates any property can be added to this object. [AutoUpgradeMinorVersion <Boolean?>]: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. [EnableAutomaticUpgrade <Boolean?>]: Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. [ForceUpdateTag <String>]: How the extension handler should be forced to update even if the extension configuration has not changed. [InstanceViewName <String>]: The machine extension name. [InstanceViewType <String>]: Specifies the type of the extension; an example is "CustomScriptExtension". [InstanceViewTypeHandlerVersion <String>]: Specifies the version of the script handler. [PropertiesType <String>]: Specifies the type of the extension; an example is "CustomScriptExtension". [ProtectedSetting <IMachineExtensionPropertiesProtectedSettings>]: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. [(Any) <Object>]: This indicates any property can be added to this object. [Publisher <String>]: The name of the extension handler publisher. [Setting <IMachineExtensionPropertiesSettings>]: Json formatted public settings for the extension. [(Any) <Object>]: This indicates any property can be added to this object. [StatusCode <String>]: The status code. [StatusDisplayStatus <String>]: The short localizable label for the status. [StatusLevel <String>]: The level code. [StatusMessage <String>]: The detailed status message, including for alerts and error messages. [StatusTime <DateTime?>]: The time of the status. [TypeHandlerVersion <String>]: Specifies the version of the script handler. MACHINEINPUTOBJECT <IStackHcivmIdentity>: Identity Parameter [ExtensionName <String>]: The name of the machine extension. [ExtensionType <String>]: The extensionType of the Extension being received. [GalleryImageName <String>]: Name of the gallery image [Id <String>]: Resource identity path [Location <String>]: The location of the Extension being received. [LogicalNetworkName <String>]: Name of the logical network [MachineName <String>]: The name of the hybrid machine. [MarketplaceGalleryImageName <String>]: Name of the marketplace gallery image [MetadataName <String>]: Name of the HybridIdentityMetadata. [NetworkInterfaceName <String>]: Name of the network interface [NetworkSecurityGroupName <String>]: Name of the network security group [OSType <String>]: Defines the os type. [Publisher <String>]: The publisher of the Extension being received. [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive. [ResourceUri <String>]: The fully qualified Azure Resource manager identifier of the resource. [SecurityRuleName <String>]: Name of the security rule. [StorageContainerName <String>]: Name of the storage container [SubscriptionId <String>]: The ID of the target subscription. The value must be an UUID. [Version <String>]: The version of the Extension being received. [VirtualHardDiskName <String>]: Name of the virtual hard disk .Link https://learn.microsoft.com/powershell/module/azstackhci.vm/new-azstackhcivmmachineextension #> function New-AzStackHCIVMMachineExtension { [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.IMachineExtension])] [CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] [System.String] # The name of the machine extension. ${ExtensionName}, [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] [System.String] # The name of the machine where the extension should be created or updated. ${MachineName}, [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] [System.String] # The name of the resource group. # The name is case insensitive. ${ResourceGroupName}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaJsonFilePath')] [Parameter(ParameterSetName='CreateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] # The ID of the target subscription. # The value must be an UUID. ${SubscriptionId}, [Parameter(ParameterSetName='CreateViaIdentityMachine', Mandatory, ValueFromPipeline)] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.IStackHcivmIdentity] # Identity Parameter ${MachineInputObject}, [Parameter(ParameterSetName='CreateExpanded', Mandatory)] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The geo-location where the resource lives ${Location}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.Management.Automation.SwitchParameter] # Indicates whether the extension should use a newer minor version if one is available at deployment time. # Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. ${AutoUpgradeMinorVersion}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.Management.Automation.SwitchParameter] # Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. ${EnableAutomaticUpgrade}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # How the extension handler should be forced to update even if the extension configuration has not changed. ${ForceUpdateTag}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The machine extension name. ${InstanceViewName}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Specifies the type of the extension; an example is "CustomScriptExtension". ${InstanceViewType}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Specifies the version of the script handler. ${InstanceViewTypeHandlerVersion}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Specifies the type of the extension; an example is "CustomScriptExtension". ${PropertiesType}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.IMachineExtensionPropertiesProtectedSettings]))] [System.Collections.Hashtable] # The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. ${ProtectedSetting}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The name of the extension handler publisher. ${Publisher}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.IMachineExtensionPropertiesSettings]))] [System.Collections.Hashtable] # Json formatted public settings for the extension. ${Setting}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The status code. ${StatusCode}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The short localizable label for the status. ${StatusDisplayStatus}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.PSArgumentCompleterAttribute("Info", "Warning", "Error")] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The level code. ${StatusLevel}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The detailed status message, including for alerts and error messages. ${StatusMessage}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.DateTime] # The time of the status. ${StatusTime}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] # Resource tags. ${Tag}, [Parameter(ParameterSetName='CreateExpanded')] [Parameter(ParameterSetName='CreateViaIdentityMachineExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Specifies the version of the script handler. ${TypeHandlerVersion}, [Parameter(ParameterSetName='CreateViaIdentityMachine', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.IMachineExtension] # Describes a Machine Extension. ${ExtensionParameter}, [Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Path of Json file supplied to the Create operation ${JsonFilePath}, [Parameter(ParameterSetName='CreateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Json string supplied to the Create operation ${JsonString}, [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Azure')] [System.Management.Automation.PSObject] # The DefaultProfile parameter is not functional. # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Runtime')] [System.Management.Automation.SwitchParameter] # Run the command as a job ${AsJob}, [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Runtime')] [System.Management.Automation.SwitchParameter] # Wait for .NET debugger to attach ${Break}, [Parameter(DontShow)] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Runtime')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Runtime.SendAsyncStep[]] # SendAsync Pipeline Steps to be appended to the front of the pipeline ${HttpPipelineAppend}, [Parameter(DontShow)] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Runtime')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Runtime.SendAsyncStep[]] # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Runtime')] [System.Management.Automation.SwitchParameter] # Run the command asynchronously ${NoWait}, [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Runtime')] [System.Uri] # The URI for the proxy server to use ${Proxy}, [Parameter(DontShow)] [ValidateNotNull()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Runtime')] [System.Management.Automation.PSCredential] # Credentials for a proxy server to use for the remote call ${ProxyCredential}, [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.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 = @{ CreateExpanded = 'AzStackHci.VM.private\New-AzStackHCIVMMachineExtension_CreateExpanded'; CreateViaIdentityMachine = 'AzStackHci.VM.private\New-AzStackHCIVMMachineExtension_CreateViaIdentityMachine'; CreateViaIdentityMachineExpanded = 'AzStackHci.VM.private\New-AzStackHCIVMMachineExtension_CreateViaIdentityMachineExpanded'; CreateViaJsonFilePath = 'AzStackHci.VM.private\New-AzStackHCIVMMachineExtension_CreateViaJsonFilePath'; CreateViaJsonString = 'AzStackHci.VM.private\New-AzStackHCIVMMachineExtension_CreateViaJsonString'; } if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { $testPlayback = $false $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } if ($testPlayback) { $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') } else { $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 } } } |