-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Feature firmwareanalysis ps #24138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
msJinLei
merged 13 commits into
Azure:generation
from
kalpeshbhatia000:feature-firmwareanalysis-ps
Feb 21, 2024
Merged
Feature firmwareanalysis ps #24138
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0abe015
Onboard firmwareanalysis commands to powwershell
kalpeshbhatia000 72732ad
add test cases and doc
kalpeshbhatia000 31fd199
add docs
kalpeshbhatia000 e322a53
add outputs
kalpeshbhatia000 c25e1ae
update command
kalpeshbhatia000 b62accc
fix test
kalpeshbhatia000 8bb1622
update doc
kalpeshbhatia000 9f3b584
Merge branch 'generation' of https://github.com/kalpeshbhatia000/azur…
kalpeshbhatia000 1ea28a4
update doc
kalpeshbhatia000 87b4e5c
fix errors
kalpeshbhatia000 7f98c7d
add recording
kalpeshbhatia000 85ab40a
remove command
kalpeshbhatia000 5a540f4
update tests
kalpeshbhatia000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * text=auto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
23
src/FirmwareAnalysis/FirmwareAnalysis.Autorest/Az.FirmwareAnalysis.psd1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| @{ | ||
| GUID = 'e097ff3f-acb2-48da-86fe-937d86006ea5' | ||
| RootModule = './Az.FirmwareAnalysis.psm1' | ||
| ModuleVersion = '0.1.0' | ||
| CompatiblePSEditions = 'Core', 'Desktop' | ||
| Author = 'Microsoft Corporation' | ||
| CompanyName = 'Microsoft Corporation' | ||
| Copyright = 'Microsoft Corporation. All rights reserved.' | ||
| Description = 'Microsoft Azure PowerShell: FirmwareAnalysis cmdlets' | ||
| PowerShellVersion = '5.1' | ||
| DotNetFrameworkVersion = '4.7.2' | ||
| RequiredAssemblies = './bin/Az.FirmwareAnalysis.private.dll' | ||
| FormatsToProcess = './Az.FirmwareAnalysis.format.ps1xml' | ||
| FunctionsToExport = 'Get-AzFirmwareAnalysisWorkspace', 'New-AzFirmwareAnalysisFirmwareDownloadUrl', 'New-AzFirmwareAnalysisFirmwareFilesystemDownloadUrl', 'New-AzFirmwareAnalysisWorkspace', 'New-AzFirmwareAnalysisWorkspaceUploadUrl', 'Remove-AzFirmwareAnalysisWorkspace', 'Update-AzFirmwareAnalysisWorkspace' | ||
| PrivateData = @{ | ||
| PSData = @{ | ||
| Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'FirmwareAnalysis' | ||
| LicenseUri = 'https://aka.ms/azps-license' | ||
| ProjectUri = 'https://github.com/Azure/azure-powershell' | ||
| ReleaseNotes = '' | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| <!-- region Generated --> | ||
| # Az.FirmwareAnalysis | ||
| This directory contains the PowerShell module for the FirmwareAnalysis service. | ||
|
|
||
| --- | ||
| ## Status | ||
| [](https://www.powershellgallery.com/packages/Az.FirmwareAnalysis/) | ||
|
|
||
| ## 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.FirmwareAnalysis`, 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: ef348fed285ae01b78cf6afd394ad2c4c8b6da7e | ||
| require: | ||
| # readme.azure.noprofile.md is the common configuration file | ||
| - $(this-folder)/../../readme.azure.noprofile.md | ||
| # - /swagger/fist/resource-manager/readme.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/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/firmwares.json | ||
| - $(repo)/specification/fist/resource-manager/Microsoft.IoTFirmwareDefense/stable/2024-01-10/workspaces.json | ||
|
|
||
| try-require: | ||
| - /swagger/fist/resource-manager/readme.powershell.md | ||
|
|
||
| # For new RP, the version is 0.1.0 | ||
| module-version: 0.1.0 | ||
| # Normally, title is the service name | ||
| title: FirmwareAnalysis | ||
| 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: | ||
| # 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) | ||
| 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 | ||
|
|
||
| - where: | ||
| parameter-name: Id | ||
| set: | ||
| default: | ||
| name: Id | ||
| description: Gets the Id from the current context. | ||
| script: 'str(uuid.uuid4())' | ||
| ``` | ||
41 changes: 41 additions & 0 deletions
41
src/FirmwareAnalysis/FirmwareAnalysis.Autorest/custom/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Custom | ||
| This directory contains custom implementation for non-generated cmdlets for the `Az.FirmwareAnalysis` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `../exports` folder. The only generated file into this folder is the `Az.FirmwareAnalysis.custom.psm1`. This file should not be modified. | ||
|
|
||
| ## Info | ||
| - Modifiable: yes | ||
| - Generated: partial | ||
| - Committed: yes | ||
| - Packaged: yes | ||
|
|
||
| ## Details | ||
| For `Az.FirmwareAnalysis` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. | ||
|
|
||
| For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.FirmwareAnalysis.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. | ||
|
|
||
| For script cmdlets, these are loaded via the `Az.FirmwareAnalysis.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. | ||
|
|
||
| ## Purpose | ||
| This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `../exports` folder. | ||
|
|
||
| ## Usage | ||
| The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `../exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: | ||
| - Break | ||
| - DefaultProfile | ||
| - HttpPipelineAppend | ||
| - HttpPipelinePrepend | ||
| - Proxy | ||
| - ProxyCredential | ||
| - ProxyUseDefaultCredentials | ||
|
|
||
| These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.FirmwareAnalysis`. For C#, follow the usage seen in the `ProcessRecordAsync` method. | ||
|
|
||
| ### Attributes | ||
| For processing the cmdlets, we've created some additional attributes: | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.FirmwareAnalysis.DescriptionAttribute` | ||
| - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.FirmwareAnalysis.DoNotExportAttribute` | ||
| - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.FirmwareAnalysis`. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.FirmwareAnalysis.InternalExportAttribute` | ||
| - Used in C# cmdlets to route exported cmdlets to the `../internal`, which are *not exposed* by `Az.FirmwareAnalysis`. For more information, see [README.md](../internal/README.md) in the `../internal` folder. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.FirmwareAnalysis.ProfileAttribute` | ||
| - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. |
46 changes: 46 additions & 0 deletions
46
src/FirmwareAnalysis/FirmwareAnalysis.Autorest/docs/Az.FirmwareAnalysis.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| Module Name: Az.FirmwareAnalysis | ||
| Module Guid: e097ff3f-acb2-48da-86fe-937d86006ea5 | ||
| Download Help Link: https://learn.microsoft.com/powershell/module/az.firmwareanalysis | ||
| Help Version: 1.0.0.0 | ||
| Locale: en-US | ||
| --- | ||
|
|
||
| # Az.FirmwareAnalysis Module | ||
| ## Description | ||
| Microsoft Azure PowerShell: FirmwareAnalysis cmdlets | ||
|
|
||
| ## Az.FirmwareAnalysis Cmdlets | ||
| ### [Get-AzFirmwareAnalysisFirmware](Get-AzFirmwareAnalysisFirmware.md) | ||
| Get firmware. | ||
|
|
||
| ### [Get-AzFirmwareAnalysisWorkspace](Get-AzFirmwareAnalysisWorkspace.md) | ||
| Get firmware analysis workspace. | ||
|
|
||
| ### [New-AzFirmwareAnalysisFirmware](New-AzFirmwareAnalysisFirmware.md) | ||
| The operation to create a firmware. | ||
|
|
||
| ### [New-AzFirmwareAnalysisFirmwareDownloadUrl](New-AzFirmwareAnalysisFirmwareDownloadUrl.md) | ||
| The operation to a url for file download. | ||
|
|
||
| ### [New-AzFirmwareAnalysisFirmwareFilesystemDownloadUrl](New-AzFirmwareAnalysisFirmwareFilesystemDownloadUrl.md) | ||
| The operation to a url for tar file download. | ||
|
|
||
| ### [New-AzFirmwareAnalysisWorkspace](New-AzFirmwareAnalysisWorkspace.md) | ||
| The operation to Create a firmware analysis workspace. | ||
|
|
||
| ### [New-AzFirmwareAnalysisWorkspaceUploadUrl](New-AzFirmwareAnalysisWorkspaceUploadUrl.md) | ||
| The operation to get a url for file upload. | ||
|
|
||
| ### [Remove-AzFirmwareAnalysisFirmware](Remove-AzFirmwareAnalysisFirmware.md) | ||
| The operation to delete a firmware. | ||
|
|
||
| ### [Remove-AzFirmwareAnalysisWorkspace](Remove-AzFirmwareAnalysisWorkspace.md) | ||
| The operation to delete a firmware analysis workspace. | ||
|
|
||
| ### [Update-AzFirmwareAnalysisFirmware](Update-AzFirmwareAnalysisFirmware.md) | ||
| The operation to update firmware. | ||
|
|
||
| ### [Update-AzFirmwareAnalysisWorkspace](Update-AzFirmwareAnalysisWorkspace.md) | ||
| The operation to update a firmware analysis workspaces. | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.