diff --git a/src/Support/Support.Autorest/README.md b/src/Support/Support.Autorest/README.md index d9ceb6228a61..b6fb5d355554 100644 --- a/src/Support/Support.Autorest/README.md +++ b/src/Support/Support.Autorest/README.md @@ -153,6 +153,14 @@ directive: verb: New subject: FilesNoSubscription hide: true + - where: + verb: Get + subject: SupportTicket + hide: true + - where: + verb: Get + subject: SupportTicketsNoSubscription + hide: true - where: verb: Update subject: File diff --git a/src/Support/Support.Autorest/UX/Microsoft.Support/supportTickets.json b/src/Support/Support.Autorest/UX/Microsoft.Support/supportTickets.json deleted file mode 100644 index a3f9f8a89439..000000000000 --- a/src/Support/Support.Autorest/UX/Microsoft.Support/supportTickets.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "resourceType": "supportTickets", - "apiVersion": "2022-09-01-preview", - "learnMore": { - "url": "https://learn.microsoft.com/powershell/module/az.support" - }, - "commands": [ - { - "name": "Get-AzSupportTicketsNoSubscription", - "description": "Gets details for a specific support ticket.\nSupport ticket data is available for 18 months after ticket creation.\nIf a ticket was created more than 18 months ago, a request for data might cause an error.", - "path": "/providers/Microsoft.Support/supportTickets/{supportTicketName}", - "help": { - "learnMore": { - "url": "https://learn.microsoft.com/powershell/module/az.support/get-azsupportticketsnosubscription" - }, - "parameterSets": [ - { - "parameters": [ - "-SupportTicketName " - ] - } - ] - }, - "examples": [ - { - "description": "Gets details for a specific support ticket. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error.", - "parameters": [ - { - "name": "-SupportTicketName", - "value": "[Path.supportTicketName]" - } - ] - } - ] - }, - { - "name": "Get-AzSupportTicket", - "description": "Get ticket details for an Azure subscription.\nSupport ticket data is available for 18 months after ticket creation.\nIf a ticket was created more than 18 months ago, a request for data might cause an error.", - "path": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}", - "help": { - "learnMore": { - "url": "https://learn.microsoft.com/powershell/module/az.support/get-azsupportticket" - }, - "parameterSets": [ - { - "parameters": [ - "-Name ", - "[-SubscriptionId ]" - ] - } - ] - }, - "examples": [ - { - "description": "Get ticket details for an Azure subscription. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error.", - "parameters": [ - { - "name": "-Name", - "value": "[Path.supportTicketName]" - }, - { - "name": "-SubscriptionId", - "value": "[Path.subscriptionId]" - } - ] - } - ] - } - ] -} diff --git a/src/Support/Support.Autorest/custom/Get-AzSupportTicket.ps1 b/src/Support/Support.Autorest/custom/Get-AzSupportTicket.ps1 new file mode 100644 index 000000000000..41a97097d24c --- /dev/null +++ b/src/Support/Support.Autorest/custom/Get-AzSupportTicket.ps1 @@ -0,0 +1,139 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Get ticket details for an Azure subscription. +Support ticket data is available for 18 months after ticket creation. +If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. +.Description +Get ticket details for an Azure subscription. +Support ticket data is available for 18 months after ticket creation. +If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ISupportTicketDetails +.Link +https://learn.microsoft.com/powershell/module/az.support/get-azsupportticket +#> +function Get-AzSupportTicket { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ISupportTicketDetails])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('SupportTicketName')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Path')] + [System.String] + # Support ticket name. + ${Name}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Azure subscription Id. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ISupportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Query')] + [System.String] + # The filter to apply on the operation. + # We support 'odata v4.0' filter semantics. + # [Learn more](https://docs.microsoft.com/odata/concepts/queryoptions-overview). + # _Status_, _ServiceId_, and _ProblemClassificationId_ filters can only be used with Equals ('eq') operator. + # For _CreatedDate_ filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). + # When using both filters, combine them using the logical 'AND'. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Query')] + [System.Int32] + # The number of values to return in the collection. + # Default is 25 and max is 100. + ${Top}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Support.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(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + If($PSCmdlet.ParameterSetName -eq 'List' -and !$PSBoundParameters.ContainsKey('Top') -and !$PSBoundParameters.ContainsKey('Filter')){ + $OneWeekAgo = (Get-Date).AddDays(-7).ToString("yyyy-MM-ddTHH:mm:ssZ") + $Filter = "CreatedDate ge $($OneWeekAgo)" + $PSBoundParameters.Add('Filter', $Filter) + } + Az.Support.internal\Get-AzSupportTicket @PSBoundParameters +} +} diff --git a/src/Support/Support.Autorest/custom/Get-AzSupportTicketsNoSubscription.ps1 b/src/Support/Support.Autorest/custom/Get-AzSupportTicketsNoSubscription.ps1 new file mode 100644 index 000000000000..a786686dfebb --- /dev/null +++ b/src/Support/Support.Autorest/custom/Get-AzSupportTicketsNoSubscription.ps1 @@ -0,0 +1,130 @@ + +# ---------------------------------------------------------------------------------- +# 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 +Gets details for a specific support ticket. +Support ticket data is available for 18 months after ticket creation. +If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. +.Description +Gets details for a specific support ticket. +Support ticket data is available for 18 months after ticket creation. +If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. +.Example +{{ Add code here }} +.Example +{{ Add code here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Support.Models.IFileDetails +.Link +https://learn.microsoft.com/powershell/module/az.support/get-azsupportticketsnosubscription +#> +function Get-AzSupportTicketsNoSubscription { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ISupportTicketDetails])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Path')] + [System.String] + # Support ticket name. + ${SupportTicketName}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Models.ISupportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Query')] + [System.String] + # The filter to apply on the operation. + # We support 'odata v4.0' filter semantics. + # Learn more
Status , ServiceId, and ProblemClassificationId filters can only be used with 'eq' operator. + # For CreatedDate filter, the supported operators are 'gt' and 'ge'. + # When using both filters, combine them using the logical 'AND'. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Query')] + [System.Int32] + # The number of values to return in the collection. + # Default is 25 and max is 100. + ${Top}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Support.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(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Support.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + If($PSCmdlet.ParameterSetName -eq 'List' -and !$PSBoundParameters.ContainsKey('Top') -and !$PSBoundParameters.ContainsKey('Filter')){ + $OneWeekAgo = (Get-Date).AddDays(-7).ToString("yyyy-MM-ddTHH:mm:ssZ") + $Filter = "CreatedDate ge $($OneWeekAgo)" + $PSBoundParameters.Add('Filter', $Filter) + } + Az.Support.internal\Get-AzSupportTicketsNoSubscription @PSBoundParameters +} +} diff --git a/src/Support/Support.Autorest/docs/Az.Support.md b/src/Support/Support.Autorest/docs/Az.Support.md index 0bcfafb640b2..73f01f49d818 100644 --- a/src/Support/Support.Autorest/docs/Az.Support.md +++ b/src/Support/Support.Autorest/docs/Az.Support.md @@ -48,11 +48,13 @@ Gets a specific Azure service for support ticket creation. Get ticket details for an Azure subscription. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ### [Get-AzSupportTicketsNoSubscription](Get-AzSupportTicketsNoSubscription.md) Gets details for a specific support ticket. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ### [New-AzSupportCommunication](New-AzSupportCommunication.md) Adds a new customer communication to an Azure support ticket. diff --git a/src/Support/Support.Autorest/docs/Get-AzSupportTicket.md b/src/Support/Support.Autorest/docs/Get-AzSupportTicket.md index c05ac4e7201c..976f648cbd57 100644 --- a/src/Support/Support.Autorest/docs/Get-AzSupportTicket.md +++ b/src/Support/Support.Autorest/docs/Get-AzSupportTicket.md @@ -11,6 +11,7 @@ schema: 2.0.0 Get ticket details for an Azure subscription. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ## SYNTAX @@ -35,6 +36,7 @@ Get-AzSupportTicket -InputObject [-DefaultProfile ] Get ticket details for an Azure subscription. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ## EXAMPLES @@ -49,7 +51,8 @@ Name Title 517f2da6-9bc71cda-278fc71b-7b86-4289-baec-922e8be1a04a test 2403080040012292 Minimal Billing 3/8/2024 9:03:26 PM test1-5dda17d0-a60d-4f4c-82e3-0fe3604c0ed4 test ticket - please ignore and close 2403060040007460 Minimal Billing 3/6/2024 3:09:28 PM -Lists all the support tickets for an Azure subscription +Lists all the support tickets for an Azure subscription. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ### Example 2: Get a support ticket at subscription level ```powershell diff --git a/src/Support/Support.Autorest/docs/Get-AzSupportTicketsNoSubscription.md b/src/Support/Support.Autorest/docs/Get-AzSupportTicketsNoSubscription.md index e7a79b91af8a..4198a30bfaeb 100644 --- a/src/Support/Support.Autorest/docs/Get-AzSupportTicketsNoSubscription.md +++ b/src/Support/Support.Autorest/docs/Get-AzSupportTicketsNoSubscription.md @@ -11,6 +11,7 @@ schema: 2.0.0 Gets details for a specific support ticket. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ## SYNTAX @@ -36,6 +37,7 @@ Get-AzSupportTicketsNoSubscription -InputObject [-DefaultProf Gets details for a specific support ticket. Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ## EXAMPLES @@ -55,6 +57,7 @@ test-0d8ee1f2-89d6-4078-8c1a-5845673966a1 test ticket - please ignore and close ``` Lists all the support tickets. +If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ### Example 2: Get support ticket at tenant level ```powershell diff --git a/src/Support/Support.Autorest/examples/Get-AzSupportTicket.md b/src/Support/Support.Autorest/examples/Get-AzSupportTicket.md index 9de5e1e119d7..a49726ec1194 100644 --- a/src/Support/Support.Autorest/examples/Get-AzSupportTicket.md +++ b/src/Support/Support.Autorest/examples/Get-AzSupportTicket.md @@ -9,7 +9,7 @@ Name Title 517f2da6-9bc71cda-278fc71b-7b86-4289-baec-922e8be1a04a test 2403080040012292 Minimal Billing 3/8/2024 9:03:26 PM test1-5dda17d0-a60d-4f4c-82e3-0fe3604c0ed4 test ticket - please ignore and close 2403060040007460 Minimal Billing 3/6/2024 3:09:28 PM -Lists all the support tickets for an Azure subscription +Lists all the support tickets for an Azure subscription. If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ### Example 2: Get a support ticket at subscription level ```powershell diff --git a/src/Support/Support.Autorest/examples/Get-AzSupportTicketsNoSubscription.md b/src/Support/Support.Autorest/examples/Get-AzSupportTicketsNoSubscription.md index 3b5f18f44217..f6204e305c8d 100644 --- a/src/Support/Support.Autorest/examples/Get-AzSupportTicketsNoSubscription.md +++ b/src/Support/Support.Autorest/examples/Get-AzSupportTicketsNoSubscription.md @@ -13,7 +13,7 @@ test-8dad4b97-5ff5-4a1e-bb6e-d323348db3f2 test ticket - please ignore and close test-0d8ee1f2-89d6-4078-8c1a-5845673966a1 test ticket - please ignore and close 2403070040009769 Minimal Billing 3/7/2024 5:02:44 PM ``` -Lists all the support tickets. +Lists all the support tickets. If no parameters are specified, then this command will retrieve all tickets created in the last week by default. ### Example 2: Get support ticket at tenant level ```powershell