internal/Set-AzStackHCIVMSecurityRule.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 Update a security rule in the specified resource group. .Description Update a security rule in the specified resource group. .Example {{ Add code here }} .Example {{ Add code here }} .Outputs Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.ISecurityRule .Link https://learn.microsoft.com/powershell/module/azstackhci.vm/set-azstackhcivmsecurityrule #> function Set-AzStackHCIVMSecurityRule { [OutputType([Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Models.ISecurityRule])] [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] [Alias('SecurityRuleName')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] [System.String] # Name of the security rule. ${Name}, [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] [System.String] # Name of the network security group ${NetworkSecurityGroupName}, [Parameter(Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Path')] [System.String] # The name of the resource group. # The name is case insensitive. ${ResourceGroupName}, [Parameter()] [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='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.PSArgumentCompleterAttribute("Allow", "Deny")] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The network traffic is allowed or denied. ${Access}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # A description for this rule. # Restricted to 140 chars. ${Description}, [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String[]] # The destination address prefixes. # CIDR or destination IP ranges. ${DestinationAddressPrefix}, [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String[]] # The destination port ranges. # Integer or range between 0 and 65535. # Asterisk '*' can also be used to match all ports. ${DestinationPortRange}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.PSArgumentCompleterAttribute("Inbound", "Outbound")] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The direction of the rule. # The direction specifies if rule will be evaluated on incoming or outgoing traffic. ${Direction}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The name of the extended location. ${ExtendedLocationName}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.PSArgumentCompleterAttribute("CustomLocation")] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # The type of the extended location. ${ExtendedLocationType}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.Int32] # The priority of the rule. # The value can be between 100 and 4096. # The priority number must be unique for each rule in the collection. # The lower the priority number, the higher the priority of the rule. ${Priority}, [Parameter(ParameterSetName='UpdateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.PSArgumentCompleterAttribute("Tcp", "Udp", "Icmp", "*")] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Network protocol this rule applies to. ${Protocol}, [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String[]] # The CIDR or source IP ranges. ${SourceAddressPrefix}, [Parameter(ParameterSetName='UpdateExpanded')] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String[]] # The source port ranges. # Integer or range between 0 and 65535. # Asterisk '*' can also be used to match all ports. ${SourcePortRange}, [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Path of Json file supplied to the Update operation ${JsonFilePath}, [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.StackHCIVM.Category('Body')] [System.String] # Json string supplied to the Update 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 = @{ UpdateExpanded = 'AzStackHci.VM.private\Set-AzStackHCIVMSecurityRule_UpdateExpanded'; UpdateViaJsonFilePath = 'AzStackHci.VM.private\Set-AzStackHCIVMSecurityRule_UpdateViaJsonFilePath'; UpdateViaJsonString = 'AzStackHci.VM.private\Set-AzStackHCIVMSecurityRule_UpdateViaJsonString'; } if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -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 } } } |