Skip to content

Commit

Permalink
[Az.Support] generate Az.Support with autorest (#24843)
Browse files Browse the repository at this point in the history
* init add powershell cmdlet

* add customization for filedetails

* correct readme to include file workspace create

* add custom cmdlet for creating and uploading the file

* chunking logic for larger files

* add error for custom cmdlet when file too big

* combined cmdlets

* edit custom file upload command to not use default subscriptionid

* no default value for subid in custom file upload

* separate subscription and no subscription commands

* remove comments from combined cmd for file

* fix cmd

* custom no subscription file upload commands

* autogen docs for no sub file upload

* hide individual file commands

* add back workspace commands

* add name as alias for fileworkspacename fileworkspacesnosubscription

* remove update files and add alias for nosubscription file commands

* tests for get service

* tests for problem classification

* try adding erroractionpreference = stop

* tests for new file workspace

* tests for get file workspace

* more tests

* add tests for new file and upload, removefile name as a parameter

* remove new files no subscription

* tests for get file

* erroraction stop

* remove unnecessary comments and print statements

* docs for get support service

* problem classification docs

* add titles

* documentation for file workspace commands

* documentation for file/file workspace cmdlets

* documentation for checkNameAvailability

* added tests and documentation for operations, support ticket, communication and chat transcript cmdlets

* added examples for operations, support ticket, communication and chat transcript cmdlets

* resolve merge conflicts

* resolved PR comments

* get conflict file changes from grhuang/azsupport-autorest

* resolved merge conflict

* removed update communication sub and no sub scenarios

* Revert "removed update communication sub and no sub scenarios"

This reverts commit ccbfdee.

* removed update communication sub and no sub scenarios , updated readme

* make communiation and support ticket properties required in readme, edit get operation file name, edit calling internal cmdlets for file upload

* fix documentation

* fix top query

* add custom error handler

* consolidate list and get communicationsnosubscription and chattranscriptsnosubscription

* init changes to allow no subscription recording tests-need to use csp partner account in tenant 2e6a0c9f-986d-480e-ad4b-bdfddc047aba

* changes to not create new resources in playback

* remove custom error handler csharp

* init add changes to split subscription and no subscription tests

* update skip

* Update recordings

* update recordings

* add more examples to new-azsupportticket documentation

* update documentation and readme

* add directive back in

* make advanced diagnostic consent required

* Add custom error handling for New- and Update- cmdlets to print full details of error (#9)

* Add custom error handler

* Add default filter to retrieve tickets from the past week for Get-AzSupportTickets and Get-AzSupportTicketsNoSubscription (#10)

* add custom filtering for list support ticket if no filter is applied

* make transformations in swagger in readme to make enrollment id not readonly and show isTempTicket (#11)

* Add argument completer (#12)

* add argument completers

* add quotes to argument completers

* remove repeated time zone

* Regenerate powershell module with GA swagger (#13)

* Rerecord tests using GA version (#14)

* add tests for file size (will add recordings once Ga swagger available)

* Regenerate powershell module with GA swagger

* Rerecord tests with GA version

* Fix documentation

* fix url for file upload

---------

Co-authored-by: Grace Huang (from Dev Box) <[email protected]>
Co-authored-by: grhuangmsft <[email protected]>
Co-authored-by: Shreya Kumar <[email protected]>
Co-authored-by: Yunchi Wang <[email protected]>
  • Loading branch information
5 people authored May 8, 2024
1 parent 23eee73 commit c3604ec
Show file tree
Hide file tree
Showing 157 changed files with 14,155 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Support/Support.Autorest/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
16 changes: 16 additions & 0 deletions src/Support/Support.Autorest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bin
obj
.vs
generated
internal
exports
tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
/*.ps1
/*.ps1xml
/*.psm1
/*.snk
/*.csproj
/*.nuspec
23 changes: 23 additions & 0 deletions src/Support/Support.Autorest/Az.Support.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@{
GUID = 'ca38d4b0-fe38-4f55-b9e1-66df3d985f20'
RootModule = './Az.Support.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: Support cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Support.private.dll'
FormatsToProcess = './Az.Support.format.ps1xml'
FunctionsToExport = 'Get-AzSupportChatTranscript', 'Get-AzSupportChatTranscriptsNoSubscription', 'Get-AzSupportCommunication', 'Get-AzSupportCommunicationsNoSubscription', 'Get-AzSupportFile', 'Get-AzSupportFilesNoSubscription', 'Get-AzSupportFileWorkspace', 'Get-AzSupportFileWorkspacesNoSubscription', 'Get-AzSupportOperation', 'Get-AzSupportProblemClassification', 'Get-AzSupportService', 'Get-AzSupportTicket', 'Get-AzSupportTicketsNoSubscription', 'New-AzSupportCommunication', 'New-AzSupportCommunicationsNoSubscription', 'New-AzSupportFileAndUpload', 'New-AzSupportFileAndUploadNoSubscription', 'New-AzSupportFileWorkspace', 'New-AzSupportFileWorkspacesNoSubscription', 'New-AzSupportTicket', 'New-AzSupportTicketsNoSubscription', 'Test-AzSupportCommunicationNameAvailability', 'Test-AzSupportCommunicationsNoSubscriptionNameAvailability', 'Test-AzSupportTicketNameAvailability', 'Test-AzSupportTicketsNoSubscriptionNameAvailability', 'Update-AzSupportTicket', 'Update-AzSupportTicketsNoSubscription'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Support'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}
}
234 changes: 234 additions & 0 deletions src/Support/Support.Autorest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
<!-- region Generated -->
# Az.Support
This directory contains the PowerShell module for the Support service.

---
## Status
[![Az.Support](https://img.shields.io/powershellgallery/v/Az.Support.svg?style=flat-square&label=Az.Support "Az.Support")](https://www.powershellgallery.com/packages/Az.Support/)

## Info
- Modifiable: yes
- Generated: all
- Committed: yes
- Packaged: yes

---
## Detail
This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension.

## Module Requirements
- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater

## Authentication
AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.

## Development
For information on how to develop for `Az.Support`, see [how-to.md](how-to.md).
<!-- endregion -->

### AutoRest Configuration
> see https://aka.ms/autorest
```yaml
# pin the swagger version by using the commit id instead of branch name
commit: 791ef5476e10bb15ab9ad46e2c2d8835ac24ac24
require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
# - (this-folder)/relative-path-to-your-local-readme.md
input-file:
- $(repo)/specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/support.json

# For new RP, the version is 0.1.0
module-version: 0.1.0
# Normally, title is the service name
title: Support
subject-prefix: $(service-name)

# The next three configurations are exclusive to v3, and in v4, they are activated by default. If you are still using v3, please uncomment them.
# identity-correction-for-post: true
# resourcegroup-append: true
# nested-object-to-string: true

directive:
- where:
model-name: ProblemClassification
set:
format-table:
properties:
- DisplayName
- Name
- SecondaryConsentEnabled
- where:
model-name: Service
set:
format-table:
properties:
- DisplayName
- Name
- ResourceType
- where:
model-name: FileDetails
set:
format-table:
properties:
- Name
- CreatedOn
- ChunkSize
- FileSize
- NumberOfChunks
- where:
model-name: SupportTicketDetails
set:
format-table:
properties:
- Name
- Title
- SupportTicketId
- Severity
- ServiceDisplayName
- CreatedDate
- where:
model-name: CommunicationDetails
set:
format-table:
properties:
- Name
- Sender
- Subject
- CreatedDate
- where:
model-name: ChatTranscriptDetails
set:
format-table:
properties:
- Name
- StartTime
- where:
subject: CommunicationsNoSubscription
parameter-name: CommunicationName
set:
alias: Name
- where:
subject: SupportTicketsNoSubscription
parameter-name: SupportTicketName
set:
alias: Name
- where:
subject: ChatTranscriptsNoSubscription
parameter-name: ChatTranscriptName
set:
alias: Name
- where:
subject: UploadFile
parameter-name: FileWorkspaceName
set:
alias: WorkspaceName
- where:
subject: UploadFilesNoSubscription
parameter-name: FileWorkspaceName
set:
alias: WorkspaceName
- where:
subject: FileWorkspacesNoSubscription
parameter-name: FileWorkspaceName
set:
alias: Name
- where:
subject: FilesNoSubscription
parameter-name: FileName
set:
alias: Name
- where:
subject: FilesNoSubscription
parameter-name: FileWorkspaceName
set:
alias: WorkspaceName
- where:
parameter-name: ContactDetailPreferredTimeZone
set:
completer:
name: Time Zone Completer
description: Gets the list of valid time zones
script: "'\"Afghanistan Standard Time\"', '\"Alaskan Standard Time\"', '\"Arab Standard Time\"', '\"Arabian Standard Time\"', '\"Arabic Standard Time\"', '\"Argentina Standard Time\"', '\"Atlantic Standard Time\"', '\"AUS Central Standard Time\"', '\"AUS Eastern Standard Time\"', '\"Azerbaijan Standard Time\"', '\"Azores Standard Time\"','\"Canada Central Standard Time\"','\"Cape Verde Standard Time\"','\"Caucasus Standard Time\"','\"Cen. Australia Standard Time\"','\"Central America Standard Time\"','\"Central Asia Standard Time\"','\"Central Brazilian Standard Time\"','\"Central Europe Standard Time\"','\"Central European Standard Time\"','\"Central Pacific Standard Time\"','\"Central Standard Time\"','\"Central Standard Time (Mexico)\"','\"China Standard Time\"','\"Dateline Standard Time\"','\"E. Africa Standard Time\"','\"E. Australia Standard Time\"','\"E. Europe Standard Time\"','\"E. South America Standard Time\"','\"Eastern Standard Time\"','\"Eastern Standard Time (Mexico)\"','\"Egypt Standard Time\"','\"Ekaterinburg Standard Time\"','\"Fiji Standard Time\"','\"FLE Standard Time\"','\"Georgian Standard Time\"','\"GMT Standard Time\"','\"Greenland Standard Time\"','\"Greenwich Standard Time\"','\"GTB Standard Time\"','\"Hawaiian Standard Time\"','\"India Standard Time\"','\"Iran Standard Time\"','\"Israel Standard Time\"','\"Jordan Standard Time\"','\"Korea Standard Time\"','\"Mauritius Standard Time\"','\"Mid-Atlantic Standard Time\"','\"Middle East Standard Time\"','\"Montevideo Standard Time\"','\"Morocco Standard Time\"','\"Mountain Standard Time\"','\"Mountain Standard Time (Mexico)\"','\"Myanmar Standard Time\"','\"N. Central Asia Standard Time\"','\"Namibia Standard Time\"','\"Nepal Standard Time\"','\"New Zealand Standard Time\"','\"Newfoundland Standard Time\"','\"North Asia East Standard Time\"','\"North Asia Standard Time\"','\"Pacific SA Standard Time\"','\"Pacific Standard Time\"','\"Pacific Standard Time (Mexico)\"','\"Pakistan Standard Time\"','\"Romance Standard Time\"','\"Russian Standard Time\"','\"SA Eastern Standard Time\"','\"SA Pacific Standard Time\"','\"SA Western Standard Time\"','\"Samoa Standard Time\"','\"SE Asia Standard Time\"','\"Singapore Standard Time\"','\"South Africa Standard Time\"','\"Sri Lanka Standard Time\"','\"Taipei Standard Time\"','\"Tasmania Standard Time\"','\"Tokyo Standard Time\"','\"Tonga Standard Time\"','\"Turkey Standard Time\"','\"US Eastern Standard Time\"','\"US Mountain Standard Time\"','\"UTC\"','\"Venezuela Standard Time\"','\"Vladivostok Standard Time\"','\"W. Australia Standard Time\"','\"W. Central Africa Standard Time\"','\"W. Europe Standard Time\"','\"West Asia Standard Time\"','\"West Pacific Standard Time\"','\"Yakutsk Standard Time\"'"
- where:
parameter-name: ContactDetailPreferredSupportLanguage
set:
completer:
name: Support Language Completer
description: Gets the list of valid support languages
script: "'\"en-us\"','\"es-es\"','\"fr-fr\"','\"de-de\"','\"it-it\"','\"ja-jp\"','\"ko-kr\"','\"ru-ru\"','\"pt-br\"','\"zh-tw\"','\"zh-hans\"'"
- where:
verb: New
subject: File
hide: true
- where:
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
remove: true
- where:
verb: Update
subject: FilesNoSubscription
remove: true
- where:
verb: Invoke
subject: UploadFile
hide: true
- where:
verb: Invoke
subject: UploadFilesNoSubscription
hide: true
- where:
verb: Update
subject: Communication
remove: true
- where:
verb: Update
subject: CommunicationsNoSubscription
remove: true
- from: GetAzSupportTicket_List.cs
where: $
transform: $ = $.replace("!String.IsNullOrEmpty(_nextLink)" ,"!String.IsNullOrEmpty(_nextLink) && this._top <= 0");
- from: GetAzSupportTicketsNoSubscription_List.cs
where: $
transform: $ = $.replace("!String.IsNullOrEmpty(_nextLink)" ,"!String.IsNullOrEmpty(_nextLink) && this._top <= 0");
- from: GetAzSupportCommunication_List.cs
where: $
transform: $ = $.replace("!String.IsNullOrEmpty(_nextLink)" ,"!String.IsNullOrEmpty(_nextLink) && this._top <= 0");
- from: GetAzSupportCommunicationsNoSubscription_List.cs
where: $
transform: $ = $.replace("!String.IsNullOrEmpty(_nextLink)" ,"!String.IsNullOrEmpty(_nextLink) && this._top <= 0");
# Following are common directives which are normally required in all the RPs
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required
# Following two directives are v4 specific
- where:
variant: ^(Create|Update)(?!.*?Expanded|JsonFilePath|JsonString)
subject: ^(?!FileWorkspace|FileWorkspacesNoSubscription$).*
remove: true
- where:
variant: ^CreateViaIdentity.*$
remove: true
# Follow directive is v3 specific. If you are using v3, uncomment following directive and comments out two directives above
#- where:
# variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
# remove: true

# Remove the set-* cmdlet
# - where:
# verb: Set
# remove: true
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"resourceType": "fileWorkspaces/files",
"apiVersion": "2024-04-01",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.support"
},
"commands": [
{
"name": "Get-AzSupportFilesNoSubscription",
"description": "Returns details of a specific file in a work space.",
"path": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.support/get-azsupportfilesnosubscription"
},
"parameterSets": [
{
"parameters": [
"-FileName <String>",
"-FileWorkspaceName <String>"
]
}
]
},
"examples": [
{
"description": "Returns details of a specific file in a work space.",
"parameters": [
{
"name": "-FileName",
"value": "[Path.fileName]"
},
{
"name": "-FileWorkspaceName",
"value": "[Path.fileWorkspaceName]"
}
]
}
]
},
{
"name": "Get-AzSupportFile",
"description": "Returns details of a specific file in a work space.",
"path": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.support/get-azsupportfile"
},
"parameterSets": [
{
"parameters": [
"-Name <String>",
"[-SubscriptionId <String[]>]",
"-WorkspaceName <String>"
]
}
]
},
"examples": [
{
"description": "Returns details of a specific file in a work space.",
"parameters": [
{
"name": "-Name",
"value": "[Path.fileName]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
},
{
"name": "-WorkspaceName",
"value": "[Path.fileWorkspaceName]"
}
]
}
]
}
]
}
Loading

0 comments on commit c3604ec

Please sign in to comment.