|
| 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 ticket details for an Azure subscription. |
| 20 | +Support ticket data is available for 18 months after ticket creation. |
| 21 | +If a ticket was created more than 18 months ago, a request for data might cause an error. |
| 22 | +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. |
| 23 | +.Description |
| 24 | +Get ticket details for an Azure subscription. |
| 25 | +Support ticket data is available for 18 months after ticket creation. |
| 26 | +If a ticket was created more than 18 months ago, a request for data might cause an error. |
| 27 | +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. |
| 28 | +.Example |
| 29 | +{{ Add code here }} |
| 30 | +.Example |
| 31 | +{{ Add code here }} |
| 32 | +
|
| 33 | +.Outputs |
| 34 | +Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ISupportTicketDetails |
| 35 | +.Link |
| 36 | +https://learn.microsoft.com/powershell/module/az.support/get-azsupportticket |
| 37 | +#> |
| 38 | +function Get-AzSupportTicket { |
| 39 | +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ISupportTicketDetails])] |
| 40 | +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] |
| 41 | +param( |
| 42 | + [Parameter(ParameterSetName='Get', Mandatory)] |
| 43 | + [Alias('SupportTicketName')] |
| 44 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Path')] |
| 45 | + [System.String] |
| 46 | + # Support ticket name. |
| 47 | + ${Name}, |
| 48 | + |
| 49 | + [Parameter(ParameterSetName='Get')] |
| 50 | + [Parameter(ParameterSetName='List')] |
| 51 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Path')] |
| 52 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] |
| 53 | + [System.String[]] |
| 54 | + # Azure subscription Id. |
| 55 | + ${SubscriptionId}, |
| 56 | + |
| 57 | + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] |
| 58 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Path')] |
| 59 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ISupportIdentity] |
| 60 | + # Identity Parameter |
| 61 | + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. |
| 62 | + ${InputObject}, |
| 63 | + |
| 64 | + [Parameter(ParameterSetName='List')] |
| 65 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Query')] |
| 66 | + [System.String] |
| 67 | + # The filter to apply on the operation. |
| 68 | + # We support 'odata v4.0' filter semantics. |
| 69 | + # [Learn more](https://docs.microsoft.com/odata/concepts/queryoptions-overview). |
| 70 | + # _Status_, _ServiceId_, and _ProblemClassificationId_ filters can only be used with Equals ('eq') operator. |
| 71 | + # For _CreatedDate_ filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). |
| 72 | + # When using both filters, combine them using the logical 'AND'. |
| 73 | + ${Filter}, |
| 74 | + |
| 75 | + [Parameter(ParameterSetName='List')] |
| 76 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Query')] |
| 77 | + [System.Int32] |
| 78 | + # The number of values to return in the collection. |
| 79 | + # Default is 25 and max is 100. |
| 80 | + ${Top}, |
| 81 | + |
| 82 | + [Parameter()] |
| 83 | + [Alias('AzureRMContext', 'AzureCredential')] |
| 84 | + [ValidateNotNull()] |
| 85 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Azure')] |
| 86 | + [System.Management.Automation.PSObject] |
| 87 | + # The DefaultProfile parameter is not functional. |
| 88 | + # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. |
| 89 | + ${DefaultProfile}, |
| 90 | + |
| 91 | + [Parameter(DontShow)] |
| 92 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] |
| 93 | + [System.Management.Automation.SwitchParameter] |
| 94 | + # Wait for .NET debugger to attach |
| 95 | + ${Break}, |
| 96 | + |
| 97 | + [Parameter(DontShow)] |
| 98 | + [ValidateNotNull()] |
| 99 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] |
| 100 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Runtime.SendAsyncStep[]] |
| 101 | + # SendAsync Pipeline Steps to be appended to the front of the pipeline |
| 102 | + ${HttpPipelineAppend}, |
| 103 | + |
| 104 | + [Parameter(DontShow)] |
| 105 | + [ValidateNotNull()] |
| 106 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] |
| 107 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Runtime.SendAsyncStep[]] |
| 108 | + # SendAsync Pipeline Steps to be prepended to the front of the pipeline |
| 109 | + ${HttpPipelinePrepend}, |
| 110 | + |
| 111 | + [Parameter(DontShow)] |
| 112 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] |
| 113 | + [System.Uri] |
| 114 | + # The URI for the proxy server to use |
| 115 | + ${Proxy}, |
| 116 | + |
| 117 | + [Parameter(DontShow)] |
| 118 | + [ValidateNotNull()] |
| 119 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] |
| 120 | + [System.Management.Automation.PSCredential] |
| 121 | + # Credentials for a proxy server to use for the remote call |
| 122 | + ${ProxyCredential}, |
| 123 | + |
| 124 | + [Parameter(DontShow)] |
| 125 | + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] |
| 126 | + [System.Management.Automation.SwitchParameter] |
| 127 | + # Use the default credentials for the proxy |
| 128 | + ${ProxyUseDefaultCredentials} |
| 129 | +) |
| 130 | + |
| 131 | +process { |
| 132 | + If($PSCmdlet.ParameterSetName -eq 'List' -and !$PSBoundParameters.ContainsKey('Top') -and !$PSBoundParameters.ContainsKey('Filter')){ |
| 133 | + $OneWeekAgo = (Get-Date).AddDays(-7).ToString("yyyy-MM-ddTHH:mm:ssZ") |
| 134 | + $Filter = "CreatedDate ge $($OneWeekAgo)" |
| 135 | + $PSBoundParameters.Add('Filter', $Filter) |
| 136 | + } |
| 137 | + Az.Support.internal\Get-AzSupportTicket @PSBoundParameters |
| 138 | +} |
| 139 | +} |
0 commit comments