Skip to content

Adding SpotPlacementRecommender API cmdlets - version 2024-03-01-preview #24352

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
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e75f709
Initial commit
Elina-L Mar 15, 2024
a615455
Update files after setting directives to add remove cmdlets
Elina-L Mar 15, 2024
ca118f4
Add initial tests for Invoke-SpotPlacementRecommender cmdlet and some…
Elina-L Mar 16, 2024
1f374cc
Add examples to Invoke-Spot examples md file
Elina-L Mar 16, 2024
223be11
Remove unnecessary test.ps1 files
Elina-L Mar 16, 2024
0ba5794
Readding some removed files that should not be deleted (1)
Elina-L Mar 16, 2024
465a952
Readding some removed files that should not be deleted (2)
Elina-L Mar 16, 2024
ae2f3ea
Readding some removed files that should not be deleted (3)
Elina-L Mar 16, 2024
31ad076
Adding older deleted cmds to FunctionsToExport
Elina-L Mar 18, 2024
a7c604b
Removing Get SpotPlacementRecommender files
Elina-L Mar 18, 2024
a2f3a9f
Remove Get-AzSpotPlacementRecommender.Tests.ps1, update failing test …
Elina-L Mar 18, 2024
827d4bd
Rever changes to docs/Az.Compute.md
Elina-L Mar 18, 2024
855624b
Only remove new functions from diagnostic.json
Elina-L Mar 18, 2024
ddf994e
Reverting changes to docs of other cmdlets
Elina-L Mar 18, 2024
b6aa52c
Update README.md to point to remote swagger
Elina-L Mar 18, 2024
db52c11
Readd removed Get-AzGalleryApplication Get-AzGalleryApplicationVersio…
Elina-L Mar 18, 2024
d08b128
Update README.md commit to the commit version that includes Spot Plac…
Elina-L Mar 18, 2024
4660338
Update Az.Compute.psd1 to remove Get-AzSpotPlacementRecommender funct…
Elina-L Mar 19, 2024
3c6028c
Update test cases, response should not be null or empty, update env.j…
Elina-L Mar 19, 2024
116b7b1
Add recording file and fix invalid input desired size
Elina-L Apr 11, 2024
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
2 changes: 1 addition & 1 deletion src/Compute/Compute.Autorest/Az.Compute.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.Compute.private.dll'
FormatsToProcess = './Az.Compute.format.ps1xml'
FunctionsToExport = 'Get-AzGalleryApplication', 'Get-AzGalleryApplicationVersion', 'New-AzGalleryApplication', 'New-AzGalleryApplicationVersion', 'Remove-AzGalleryApplication', 'Remove-AzGalleryApplicationVersion', 'Remove-AzVMRunCommand', 'Remove-AzVmssVMRunCommand', 'Set-AzVMRunCommand', 'Set-AzVmssVMRunCommand', 'Update-AzGalleryApplication', 'Update-AzGalleryApplicationVersion', '*'
FunctionsToExport = 'Get-AzSpotPlacementRecommender', 'Invoke-AzSpotPlacementRecommender', 'Get-AzGalleryApplication', 'Get-AzGalleryApplicationVersion', 'New-AzGalleryApplication', 'New-AzGalleryApplicationVersion', 'Remove-AzGalleryApplication', 'Remove-AzGalleryApplicationVersion', 'Remove-AzVMRunCommand', 'Remove-AzVmssVMRunCommand', 'Set-AzVMRunCommand', 'Set-AzVmssVMRunCommand', 'Update-AzGalleryApplication', 'Update-AzGalleryApplicationVersion', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Expand Down
30 changes: 30 additions & 0 deletions src/Compute/Compute.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ input-file:
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2022-01-03/gallery.json
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2023-07-01/runCommand.json
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/common-types/v1/common.json
- $(repo)/specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/preview/2024-03-01-preview/diagnostic.json
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
module-version: 0.3.0
# Normally, title is the service name
Expand Down Expand Up @@ -235,4 +236,33 @@ directive:
subject: VMRunCommand|VmssVMRunCommand
verb: Get
remove: true
### Remove All Diagnostic cmdlets aside from Invoke Spot Placement Recommender - generate ONLY SpotPlacementRecommender cmdlets
- where:
verb: Get
subject: Diagnostic
remove: true
- where:
verb: Get
subject: DiskInspection
remove: true
- where:
verb: New
subject: DiskInspection
remove: true
- where:
verb: Read
subject: DiagnosticOperation
remove: true
- where:
verb: Register
subject: DiskInspectionStorageConfiguration
remove: true
- where:
verb: Test
subject: DiskInspectionStorageConfiguration
remove: true
- where:
verb: Get
subject: SpotPlacementRecommender
remove: true
```
42 changes: 42 additions & 0 deletions src/Compute/Compute.Autorest/UX/Microsoft.Compute/locations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"resourceType": "locations",
"apiVersion": "2021-06-01-preview",
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.compute"
},
"commands": [
{
"name": "Invoke-AzSpotPlacementRecommender",
"description": "Generates placement scores for Spot VM skus.",
"path": "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/diagnostics/spotPlacementRecommender/generate",
"help": {
"learnMore": {
"url": "https://learn.microsoft.com/powershell/module/az.compute/invoke-azspotplacementrecommender"
},
"parameterSets": [
{
"parameters": [
"-Location <String>",
"[-SubscriptionId <String>]"
]
}
]
},
"examples": [
{
"description": "Generates placement scores for Spot VM skus.",
"parameters": [
{
"name": "-Location",
"value": "[Path.location]"
},
{
"name": "-SubscriptionId",
"value": "[Path.subscriptionId]"
}
]
}
]
}
]
}
3 changes: 3 additions & 0 deletions src/Compute/Compute.Autorest/docs/Az.Compute.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Locale: en-US
Microsoft Azure PowerShell: Compute cmdlets

## Az.Compute Cmdlets
### [Invoke-AzSpotPlacementRecommender](Invoke-AzSpotPlacementRecommender.md)
Generates placement scores for Spot VM skus.

### [Get-AzGalleryApplication](Get-AzGalleryApplication.md)
Retrieves information about a gallery Application Definition.

Expand Down
272 changes: 272 additions & 0 deletions src/Compute/Compute.Autorest/docs/Invoke-AzSpotPlacementRecommender.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
---
external help file:
Module Name: Az.Compute
online version: https://learn.microsoft.com/powershell/module/az.compute/invoke-azspotplacementrecommender
schema: 2.0.0
---

# Invoke-AzSpotPlacementRecommender

## SYNOPSIS
Generates placement scores for Spot VM skus.

## SYNTAX

### PostExpanded (Default)
```
Invoke-AzSpotPlacementRecommender -Location <String> [-SubscriptionId <String>] [-AvailabilityZone]
[-DesiredCount <Int32>] [-DesiredLocation <String[]>] [-DesiredSize <IResourceSize[]>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
```

## DESCRIPTION
Generates placement scores for Spot VM skus.

## EXAMPLES

### Example 1: Regionally scoped Spot Placement Recommender scores
```powershell
$resourceSku1 = @{sku = "Standard_D2_v3"}
$resourceSku2 = @{sku = "Standard_D2_v2"}
$resourceSku3 = @{sku = "Standard_D4_v3"}
$desiredSizes = $resourceSku1,$resourceSku2,$resourceSku3
$desiredLocations = 'japaneast','southcentralus','centralus'

$response = Invoke-AzSpotPlacementRecommender -Location eastus -DesiredCount 1 -DesiredLocation $desiredLocations -DesiredSize $desiredSizes
$response.PlacementScore
```

```output
AvailabilityZone IsQuotaAvailable Region Score Sku
---------------- ---------------- ------ ----- ---
True japaneast RestrictedSkuNotAvailable Standard_D2_v3
True japaneast RestrictedSkuNotAvailable Standard_D2_v2
True japaneast RestrictedSkuNotAvailable Standard_D4_v3
True southcentralus High Standard_D2_v3
True southcentralus High Standard_D2_v2
True southcentralus High Standard_D4_v3
True centralus RestrictedSkuNotAvailable Standard_D2_v3
True centralus RestrictedSkuNotAvailable Standard_D2_v2
True centralus RestrictedSkuNotAvailable Standard_D4_v3
```

Returns regionally scoped spot placement recommender scores for the input.

### Example 2: Zonally scoped Spot Placement Recommender scores
```powershell
$resourceSku1 = @{sku = "Standard_D2_v3"}
$resourceSku2 = @{sku = "Standard_D2_v2"}
$resourceSku3 = @{sku = "Standard_D4_v3"}
$desiredSizes = $resourceSku1,$resourceSku2,$resourceSku3
$desiredLocations = 'japaneast','southcentralus','centralus'

$response = Invoke-AzSpotPlacementRecommender -Location eastus -DesiredCount 1 -DesiredLocation $desiredLocations -DesiredSize $desiredSizes -AvailabilityZone
$response.PlacementScore
```

```output
AvailabilityZone IsQuotaAvailable Region Score Sku
---------------- ---------------- ------ ----- ---
1 True japaneast High Standard_D2_v3
2 True japaneast High Standard_D2_v3
3 True japaneast High Standard_D2_v3
1 True japaneast High Standard_D2_v2
2 True japaneast High Standard_D2_v2
3 True japaneast High Standard_D2_v2
1 True japaneast High Standard_D4_v3
2 True japaneast High Standard_D4_v3
3 True japaneast High Standard_D4_v3
1 True southcentralus High Standard_D2_v3
2 True southcentralus High Standard_D2_v3
3 True southcentralus High Standard_D2_v3
1 True southcentralus High Standard_D2_v2
2 True southcentralus High Standard_D2_v2
3 True southcentralus High Standard_D2_v2
1 True southcentralus High Standard_D4_v3
2 True southcentralus High Standard_D4_v3
3 True southcentralus High Standard_D4_v3
1 True centralus DataNotFoundOrStale Standard_D2_v3
2 True centralus High Standard_D2_v3
3 True centralus High Standard_D2_v3
1 True centralus DataNotFoundOrStale Standard_D2_v2
2 True centralus High Standard_D2_v2
3 True centralus High Standard_D2_v2
1 True centralus DataNotFoundOrStale Standard_D4_v3
2 True centralus High Standard_D4_v3
3 True centralus High Standard_D4_v3
```

Returns zonally scoped spot placement recommender scores for the input.

## PARAMETERS

### -AvailabilityZone
Defines if the scope is zonal or regional.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: PostExpanded, PostViaIdentityExpanded
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultProfile
The DefaultProfile parameter is not functional.
Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

```yaml
Type: System.Management.Automation.PSObject
Parameter Sets: (All)
Aliases: AzureRMContext, AzureCredential

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DesiredCount
Desired instance count per region/zone based on the scope.

```yaml
Type: System.Int32
Parameter Sets: PostExpanded, PostViaIdentityExpanded
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DesiredLocation
The desired regions

```yaml
Type: System.String[]
Parameter Sets: PostExpanded, PostViaIdentityExpanded
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DesiredSize
The desired resource SKUs.
To construct, see NOTES section for DESIREDSIZE properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210601Preview.IResourceSize[]
Parameter Sets: PostExpanded, PostViaIdentityExpanded
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
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.Compute.Models.IComputeIdentity
Parameter Sets: PostViaIdentity, PostViaIdentityExpanded
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -Location
The name of the Azure region.

```yaml
Type: System.String
Parameter Sets: Post, PostExpanded
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SubscriptionId
Subscription credentials which uniquely identify Microsoft Azure subscription.
The subscription ID forms part of the URI for every service call.

```yaml
Type: System.String
Parameter Sets: Post, PostExpanded
Aliases:

Required: False
Position: Named
Default value: (Get-AzContext).Subscription.Id
Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.IComputeIdentity

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210601Preview.ISpotPlacementRecommenderResponse

## NOTES

## RELATED LINKS

Loading