Skip to content
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

Feature firmwareanalysis fix #24188

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/FirmwareAnalysis/FirmwareAnalysis.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ 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
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ Get an analysis result summary of a firmware by name.

## SYNTAX

### List (Default)
```
Get-AzFirmwareAnalysisSummary -FirmwareId <String> -ResourceGroupName <String> -WorkspaceName <String>
[-SubscriptionId <String[]>] [-DefaultProfile <PSObject>] [<CommonParameters>]
```

### Get
### Get (Default)
```
Get-AzFirmwareAnalysisSummary -FirmwareId <String> -Name <String> -ResourceGroupName <String>
-WorkspaceName <String> [-SubscriptionId <String[]>] [-DefaultProfile <PSObject>] [<CommonParameters>]
Expand Down Expand Up @@ -47,13 +41,12 @@ Get an analysis result summary of a firmware by name.

## EXAMPLES

### Example 1: {{ List all the analysis results summary for a firmware by analysis type CVE. }}
### Example 1: List all the analysis results summary for a firmware by analysis type CVE.
```powershell
{{ Get-AzFirmwareAnalysisSummary -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName -Name Type }}
Get-AzFirmwareAnalysisSummary -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName -Name Type
```

```output
{{
Id :
Name :
Property :
Expand All @@ -66,19 +59,17 @@ SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
Type : Microsoft.IoTFirmwareDefense/workspaces/firmwares/summaries
}}
```

{{ List all the analysis results summary for a firmware by analysis type CVE.
kalpeshbhatia000 marked this conversation as resolved.
Show resolved Hide resolved
}}
kalpeshbhatia000 marked this conversation as resolved.
Show resolved Hide resolved

### Example 2: {{ List all the analysis results summary for a firmware by analysis type Firmware. }}
### Example 2: List all the analysis results summary for a firmware by analysis type Firmware.
```powershell
{{ Get-AzFirmwareAnalysisSummary -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName -Name Type }}
Get-AzFirmwareAnalysisSummary -FirmwareId FirmwareId -ResourceGroupName ResourceGroupName -WorkspaceName WorkspaceName -Name Type
```

```output
{{
Id :
Name :
Property :
Expand All @@ -91,11 +82,9 @@ SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
Type : Microsoft.IoTFirmwareDefense/workspaces/firmwares/summaries
}}
```

{{ List all the analysis results summary for a firmware by analysis type Firmware.
}}
List all the analysis results summary for a firmware by analysis type Firmware.

## PARAMETERS

Expand All @@ -120,7 +109,7 @@ The id of the firmware.

```yaml
Type: System.String
Parameter Sets: Get, GetViaIdentityWorkspace, List
Parameter Sets: Get, GetViaIdentityWorkspace
Aliases:

Required: True
Expand Down Expand Up @@ -183,7 +172,7 @@ The name is case insensitive.

```yaml
Type: System.String
Parameter Sets: Get, List
Parameter Sets: Get
Aliases:

Required: True
Expand All @@ -199,7 +188,7 @@ The value must be an UUID.

```yaml
Type: System.String[]
Parameter Sets: Get, List
Parameter Sets: Get
Aliases:

Required: False
Expand Down Expand Up @@ -230,7 +219,7 @@ The name of the firmware analysis workspace.

```yaml
Type: System.String
Parameter Sets: Get, List
Parameter Sets: Get
Aliases:

Required: True
Expand Down
Loading
Loading