|
| 1 | + |
| 2 | +# ---------------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# Unless required by applicable law or agreed to in writing, software |
| 9 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +# See the License for the specific language governing permissions and |
| 12 | +# limitations under the License. |
| 13 | +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code |
| 14 | +# is regenerated. |
| 15 | +# ---------------------------------------------------------------------------------- |
| 16 | + |
| 17 | +<# |
| 18 | +.Synopsis |
| 19 | +Get the advanced platform metrics rule for the storage account by rule type. |
| 20 | +.Description |
| 21 | +Get the advanced platform metrics rule for the storage account by rule type. |
| 22 | +.Example |
| 23 | +Get-AzStorageAdvancedPlatformMetric -AccountName mystorageaccount -ResourceGroupName myresourcegroup |
| 24 | +
|
| 25 | +.Inputs |
| 26 | +Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IStorageIdentity |
| 27 | +.Outputs |
| 28 | +Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IAdvancedPlatformMetricsRule |
| 29 | +.Notes |
| 30 | +COMPLEX PARAMETER PROPERTIES |
| 31 | +
|
| 32 | +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. |
| 33 | +
|
| 34 | +INPUTOBJECT <IStorageIdentity>: Identity Parameter |
| 35 | + [AccountName <String>]: The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. |
| 36 | + [AdvancedPlatformMetricsRuleType <String>]: The type of the advanced platform metrics rule. |
| 37 | + [BlobInventoryPolicyName <String>]: The name of the storage account blob inventory policy. It should always be 'default' |
| 38 | + [ConnectorName <String>]: The name of the Storage Connector. |
| 39 | + [ContainerName <String>]: The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. |
| 40 | + [DataShareName <String>]: The name of the Storage DataShare. |
| 41 | + [DeletedAccountName <String>]: Name of the deleted storage account. |
| 42 | + [EncryptionScopeName <String>]: The name of the encryption scope within the specified storage account. Encryption scope names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. |
| 43 | + [Id <String>]: Resource identity path |
| 44 | + [Location <String>]: The name of the Azure region. |
| 45 | + [ManagementPolicyName <String>]: The name of the Storage Account Management Policy. It should always be 'default' |
| 46 | + [MigrationName <String>]: The name of the Storage Account Migration. It should always be 'default' |
| 47 | + [NetworkSecurityPerimeterConfigurationName <String>]: The name for Network Security Perimeter configuration |
| 48 | + [ObjectReplicationPolicyId <String>]: For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file. |
| 49 | + [PrivateEndpointConnectionName <String>]: The name of the private endpoint connection associated with the Azure resource |
| 50 | + [QueueName <String>]: A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters. |
| 51 | + [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive. |
| 52 | + [ShareName <String>]: The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. |
| 53 | + [StorageTaskAssignmentName <String>]: The name of the storage task assignment within the specified resource group. Storage task assignment names must be between 3 and 24 characters in length and use numbers and lower-case letters only. |
| 54 | + [SubscriptionId <String>]: The ID of the target subscription. The value must be an UUID. |
| 55 | + [TableName <String>]: A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. |
| 56 | + [Username <String>]: The name of local user. The username must contain lowercase letters and numbers only. It must be unique only within the storage account. |
| 57 | +.Link |
| 58 | +https://learn.microsoft.com/powershell/module/az.storage/get-azstorageadvancedplatformmetric |
| 59 | +#> |
| 60 | +function Get-AzStorageAdvancedPlatformMetric { |
| 61 | +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IAdvancedPlatformMetricsRule])] |
| 62 | +[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)] |
| 63 | +param( |
| 64 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 65 | + [Parameter(ParameterSetName='List', Mandatory)] |
| 66 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')] |
| 67 | + [System.String] |
| 68 | + # The name of the storage account within the specified resource group. |
| 69 | + # Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. |
| 70 | + ${AccountName}, |
| 71 | + |
| 72 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 73 | + [Parameter(ParameterSetName='List', Mandatory)] |
| 74 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')] |
| 75 | + [System.String] |
| 76 | + # The name of the resource group. |
| 77 | + # The name is case insensitive. |
| 78 | + ${ResourceGroupName}, |
| 79 | + |
| 80 | + [Parameter(ParameterSetName='Get')] |
| 81 | + [Parameter(ParameterSetName='List')] |
| 82 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')] |
| 83 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] |
| 84 | + [System.String[]] |
| 85 | + # The ID of the target subscription. |
| 86 | + # The value must be an UUID. |
| 87 | + ${SubscriptionId}, |
| 88 | + |
| 89 | + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] |
| 90 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Path')] |
| 91 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Models.IStorageIdentity] |
| 92 | + # Identity Parameter |
| 93 | + ${InputObject}, |
| 94 | + |
| 95 | + [Parameter()] |
| 96 | + [Alias('AzureRMContext', 'AzureCredential')] |
| 97 | + [ValidateNotNull()] |
| 98 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Azure')] |
| 99 | + [System.Management.Automation.PSObject] |
| 100 | + # The DefaultProfile parameter is not functional. |
| 101 | + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. |
| 102 | + ${DefaultProfile}, |
| 103 | + |
| 104 | + [Parameter(DontShow)] |
| 105 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] |
| 106 | + [System.Management.Automation.SwitchParameter] |
| 107 | + # Wait for .NET debugger to attach |
| 108 | + ${Break}, |
| 109 | + |
| 110 | + [Parameter(DontShow)] |
| 111 | + [ValidateNotNull()] |
| 112 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] |
| 113 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.SendAsyncStep[]] |
| 114 | + # SendAsync Pipeline Steps to be appended to the front of the pipeline |
| 115 | + ${HttpPipelineAppend}, |
| 116 | + |
| 117 | + [Parameter(DontShow)] |
| 118 | + [ValidateNotNull()] |
| 119 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] |
| 120 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.SendAsyncStep[]] |
| 121 | + # SendAsync Pipeline Steps to be prepended to the front of the pipeline |
| 122 | + ${HttpPipelinePrepend}, |
| 123 | + |
| 124 | + [Parameter(DontShow)] |
| 125 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] |
| 126 | + [System.Uri] |
| 127 | + # The URI for the proxy server to use |
| 128 | + ${Proxy}, |
| 129 | + |
| 130 | + [Parameter(DontShow)] |
| 131 | + [ValidateNotNull()] |
| 132 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] |
| 133 | + [System.Management.Automation.PSCredential] |
| 134 | + # Credentials for a proxy server to use for the remote call |
| 135 | + ${ProxyCredential}, |
| 136 | + |
| 137 | + [Parameter(DontShow)] |
| 138 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Category('Runtime')] |
| 139 | + [System.Management.Automation.SwitchParameter] |
| 140 | + # Use the default credentials for the proxy |
| 141 | + ${ProxyUseDefaultCredentials} |
| 142 | +) |
| 143 | + |
| 144 | +begin { |
| 145 | + try { |
| 146 | + $outBuffer = $null |
| 147 | + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { |
| 148 | + $PSBoundParameters['OutBuffer'] = 1 |
| 149 | + } |
| 150 | + $parameterSet = $PSCmdlet.ParameterSetName |
| 151 | + |
| 152 | + $testPlayback = $false |
| 153 | + $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } |
| 154 | + |
| 155 | + $context = Get-AzContext |
| 156 | + if (-not $context -and -not $testPlayback) { |
| 157 | + throw "No Azure login detected. Please run 'Connect-AzAccount' to log in." |
| 158 | + } |
| 159 | + |
| 160 | + if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) { |
| 161 | + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString() |
| 162 | + } |
| 163 | + $preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId |
| 164 | + if ($preTelemetryId -eq '') { |
| 165 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId =(New-Guid).ToString() |
| 166 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.module]::Instance.Telemetry.Invoke('Create', $MyInvocation, $parameterSet, $PSCmdlet) |
| 167 | + } else { |
| 168 | + $internalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets |
| 169 | + if ($internalCalledCmdlets -eq '') { |
| 170 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $MyInvocation.MyCommand.Name |
| 171 | + } else { |
| 172 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets += ',' + $MyInvocation.MyCommand.Name |
| 173 | + } |
| 174 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = 'internal' |
| 175 | + } |
| 176 | + |
| 177 | + $mapping = @{ |
| 178 | + Get = 'Az.Storage.private\Get-AzStorageAdvancedPlatformMetric_Get'; |
| 179 | + GetViaIdentity = 'Az.Storage.private\Get-AzStorageAdvancedPlatformMetric_GetViaIdentity'; |
| 180 | + List = 'Az.Storage.private\Get-AzStorageAdvancedPlatformMetric_List'; |
| 181 | + } |
| 182 | + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { |
| 183 | + if ($testPlayback) { |
| 184 | + $PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1') |
| 185 | + } else { |
| 186 | + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id |
| 187 | + } |
| 188 | + } |
| 189 | + $cmdInfo = Get-Command -Name $mapping[$parameterSet] |
| 190 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) |
| 191 | + if ($null -ne $MyInvocation.MyCommand -and [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets -notcontains $MyInvocation.MyCommand.Name -and [Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.MessageAttributeHelper]::ContainsPreviewAttribute($cmdInfo, $MyInvocation)){ |
| 192 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet) |
| 193 | + [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name) |
| 194 | + } |
| 195 | + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) |
| 196 | + if ($wrappedCmd -eq $null) { |
| 197 | + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function) |
| 198 | + } |
| 199 | + $scriptCmd = {& $wrappedCmd @PSBoundParameters} |
| 200 | + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) |
| 201 | + $steppablePipeline.Begin($PSCmdlet) |
| 202 | + } catch { |
| 203 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 204 | + throw |
| 205 | + } |
| 206 | +} |
| 207 | + |
| 208 | +process { |
| 209 | + try { |
| 210 | + $steppablePipeline.Process($_) |
| 211 | + } catch { |
| 212 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 213 | + throw |
| 214 | + } |
| 215 | + |
| 216 | + finally { |
| 217 | + $backupTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId |
| 218 | + $backupInternalCalledCmdlets = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets |
| 219 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 220 | + } |
| 221 | + |
| 222 | +} |
| 223 | +end { |
| 224 | + try { |
| 225 | + $steppablePipeline.End() |
| 226 | + |
| 227 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $backupTelemetryId |
| 228 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::InternalCalledCmdlets = $backupInternalCalledCmdlets |
| 229 | + if ($preTelemetryId -eq '') { |
| 230 | + [Microsoft.Azure.PowerShell.Cmdlets.Storage.module]::Instance.Telemetry.Invoke('Send', $MyInvocation, $parameterSet, $PSCmdlet) |
| 231 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 232 | + } |
| 233 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId = $preTelemetryId |
| 234 | + |
| 235 | + } catch { |
| 236 | + [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::ClearTelemetryContext() |
| 237 | + throw |
| 238 | + } |
| 239 | +} |
| 240 | +} |
0 commit comments