Skip to content

Commit

Permalink
Feature firmwareanalysis fix (#24188)
Browse files Browse the repository at this point in the history
* Fix documentation for firmwareanalysis ps

* Regenerate FirmwareAnalysis

* remove commands and some variants

* update doc

---------

Co-authored-by: Lei Jin <[email protected]>
  • Loading branch information
kalpeshbhatia000 and msJinLei authored Feb 22, 2024
1 parent a2140dd commit 67d6122
Show file tree
Hide file tree
Showing 39 changed files with 169 additions and 261 deletions.
13 changes: 12 additions & 1 deletion src/FirmwareAnalysis/FirmwareAnalysis.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,21 @@ directive:
verb: Set
remove: true

- where:
verb: New
subject: FirmwareDownloadUrl
remove: true

- where:
verb: Get
subject: Summary
variant: List
remove: true

- where:
parameter-name: Id
verb: New
subject: AzFirmwareAnalysisFirmware
subject: Firmware
set:
default:
name: Id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 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.
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
Expand All @@ -15,10 +15,10 @@ For C# cmdlets, they are compiled with the rest of the generated low-level cmdle
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.
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:
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
Expand All @@ -36,6 +36,6 @@ For processing the cmdlets, we've created some additional attributes:
- `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.
- 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.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ Lists binary hardening analysis results of a firmware.

## EXAMPLES

### Example 1: {{ List all the binary hardening analysis results for a firmware.}}
### Example 1: List all the binary hardening analysis results for a firmware.
```powershell
{{ Get-AzFirmwareAnalysisBinaryHardening -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json }}
Get-AzFirmwareAnalysisBinaryHardening -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json
```

```output
{{
[
{
"Architecture": "",
Expand All @@ -53,11 +52,9 @@ Lists binary hardening analysis results of a firmware.
"Type": "Microsoft.IoTFirmwareDefense/workspaces/firmwares/binaryHardeningResults"
}
]
}}
```

{{ List all the binary hardening analysis results for a firmware.
}}
List all the binary hardening analysis results for a firmware.

## PARAMETERS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ Lists cryptographic certificate analysis results found in a firmware.

## EXAMPLES

### Example 1: {{ List all the crypto certificate analysis results for a firmware. }}
### Example 1: List all the crypto certificate analysis results for a firmware.
```powershell
{{ Get-AzFirmwareAnalysisCryptoCertificate -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json }}
Get-AzFirmwareAnalysisCryptoCertificate -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json
```

```output
{{
[
{
"CryptoCertId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
Expand Down Expand Up @@ -71,11 +70,9 @@ Lists cryptographic certificate analysis results found in a firmware.
"Usage": []
}
]
}}
```

{{ List all the crypto certificate analysis results for a firmware.
}}
List all the crypto certificate analysis results for a firmware.

## PARAMETERS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ Lists cryptographic key analysis results found in a firmware.

## EXAMPLES

### Example 1: {{ List all the crypto key analysis results for a firmware. }}
### Example 1: List all the crypto key analysis results for a firmware.
```powershell
{{ Get-AzFirmwareAnalysisCryptoKey -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json}}
Get-AzFirmwareAnalysisCryptoKey -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json
```

```output
{{
[
{
"CryptoKeyId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
Expand All @@ -53,11 +52,9 @@ Lists cryptographic key analysis results found in a firmware.
]
}
]
}}
```

{{ List all the crypto key analysis results for a firmware.
}}
List all the crypto key analysis results for a firmware.

## PARAMETERS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ Lists CVE analysis results of a firmware.

## EXAMPLES

### Example 1: {{ List all the cve analysis results for a firmware. }}
### Example 1: List all the cve analysis results for a firmware.
```powershell
{{ Get-AzFirmwareAnalysisCve -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json }}
Get-AzFirmwareAnalysisCve -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json
```

```output
{{
[
{
"ComponentId": ,
Expand Down Expand Up @@ -57,11 +56,9 @@ Lists CVE analysis results of a firmware.
"Type": "Microsoft.IoTFirmwareDefense/workspaces/firmwares/cves"
}
]
}}
```

{{ List all the cve analysis results for a firmware.
}}
List all the cve analysis results for a firmware.

## PARAMETERS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ Get firmware.

## EXAMPLES

### Example 1: {{ List all the firmwares inside a workspace. }}
### Example 1: List all the firmwares inside a workspace.
```powershell
{{ Get-AzFirmwareAnalysisFirmware -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName }}
Get-AzFirmwareAnalysisFirmware -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName
```

```output
{{
Description :
FileName :
FileSize :
Expand All @@ -67,19 +66,16 @@ SystemDataLastModifiedByType :
Type : microsoft.iotfirmwaredefense/workspaces/firmwares
Vendor :
Version :
}}
```

{{ List all the firmwares inside a workspace.
}}
List all the firmwares inside a workspace.

### Example 2: {{ Get a firmware inside a workspace. }}
### Example 2: Get a firmware inside a workspace.
```powershell
{{ Get-AzFirmwareAnalysisFirmware -Id FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName }}
Get-AzFirmwareAnalysisFirmware -Id FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName
```

```output
{{
Description :
FileName :
FileSize :
Expand All @@ -99,11 +95,9 @@ SystemDataLastModifiedByType :
Type : microsoft.iotfirmwaredefense/workspaces/firmwares
Vendor :
Version :
}}
```

{{ Get a firmware inside a workspace.
}}
Get a firmware inside a workspace.

## PARAMETERS

Expand Down Expand Up @@ -140,7 +134,7 @@ Accept wildcard characters: False
### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
.
```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.FirmwareAnalysis.Models.IFirmwareAnalysisIdentity
Expand Down Expand Up @@ -188,7 +182,7 @@ Accept wildcard characters: False
### -WorkspaceInputObject
Identity Parameter
To construct, see NOTES section for WORKSPACEINPUTOBJECT properties and create a hash table.
.
```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.FirmwareAnalysis.Models.IFirmwareAnalysisIdentity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ Lists password hash analysis results of a firmware.

## EXAMPLES

### Example 1: {{ List all the password hash analysis results for a firmware. }}
### Example 1: List all the password hash analysis results for a firmware.
```powershell
{{ Get-AzFirmwareAnalysisPasswordHash -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json }}
Get-AzFirmwareAnalysisPasswordHash -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json
```

```output
{{
[
{
"Algorithm": "",
Expand All @@ -49,11 +48,9 @@ Lists password hash analysis results of a firmware.
"Username": ""
}
]
}}
```

{{ List all the password hash analysis results for a firmware.
}}
List all the password hash analysis results for a firmware.

## PARAMETERS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ Lists SBOM analysis results of a firmware.

## EXAMPLES

### Example 1: {{ List all the sbom component analysis results for a firmware. }}
### Example 1: List all the sbom component analysis results for a firmware.
```powershell
{{ Get-AzFirmwareAnalysisSbomComponent -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json}}
Get-AzFirmwareAnalysisSbomComponent -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName | ConvertTo-Json
```

```output
{{
[
{
"ComponentId": "",
Expand All @@ -47,11 +46,9 @@ Lists SBOM analysis results of a firmware.
"Version": ""
}
]
}}
```

{{ List all the sbom component analysis results for a firmware.
}}
List all the sbom component analysis results for a firmware.

## PARAMETERS

Expand Down
Loading

0 comments on commit 67d6122

Please sign in to comment.