azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

SpotPlacementRecommender resource split

Open Elina-L opened this issue 1 year ago • 2 comments

…b4e701938dd79df2b and new swagger file specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/preview/2024-06-01-preview/diagnostic.json

Description

Update the spot placement recommender API URI to the new API: https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{region}/placementScores/spot/generate

The new API URI is defined in Swagger: https://github.com/Azure/azure-rest-api-specs/blob/259fe9abaed3b55b600dc82d79323f046501e87f/specification/compute/resource-manager/Microsoft.Compute/DiagnosticRP/preview/2024-06-01-preview/diagnostic.json#L405

The old API "Invoke-AzSpotPlacementRecommender" will be deprecated and replaced with "Invoke-AzSpotPlacementScore" instead. The behavior of the cmdlet will be the same, the only difference will be the cmdlet name and parameter names (all instances of 'Recommender' is replaced with 'Score').

Note: after running autorest and build-module, there are many changes in other files that are not related to my PR (Invoke-AzSpotPlacementRecommender -> Invoke-AzSpotPlacementScore). Those are not intentional but I am adding them to the PR to retain auto-generated changes. If these changes should not be included, please let me know and I will remove them, thanks in advance.

Mandatory Checklist

  • Please choose the target release of Azure PowerShell. (⚠️Target release is a different concept from API readiness. Please click below links for details.)

    • [X] General release
    • [ ] Public preview
    • [ ] Private preview
    • [ ] Engineering build
    • [ ] No need for a release
  • [X] Check this box to confirm: I have read the Submitting Changes section of CONTRIBUTING.md and reviewed the following information:

  • SHOULD update ChangeLog.md file(s) appropriately
    • For SDK-based development mode, update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • For autorest-based development mode, include the changelog in the PR description.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Elina-L avatar Jun 24 '24 16:06 Elina-L

️✔️Az.Accounts
️✔️Build
️✔️PowerShell Core - Windows
⚠️Az.Compute
️✔️Build
️✔️PowerShell Core - Windows
️✔️Breaking Change Check
️✔️PowerShell Core - Windows
️✔️Signature Check
️✔️PowerShell Core - Windows
️✔️Help Example Check
️✔️PowerShell Core - Windows
️✔️Help File Existence Check
️✔️PowerShell Core - Windows
⚠️File Change Check
⚠️PowerShell Core - Windows
Type Cmdlet Description Remediation
⚠️ It is required to update ChangeLog.md if you want to release a new version for Az.Compute. Add a changelog record under Upcoming Release section with past tense.
️✔️UX Metadata Check
️✔️PowerShell Core - Windows
⚠️Test
⚠️ - Linux
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.40 % Test coverage for the module cannot be lower than 50%.
⚠️ - MacOS
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.40% Test coverage for the module cannot be lower than 50%.
⚠️PowerShell Core - Windows
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.40% Test coverage for the module cannot be lower than 50%.
️✔️Az.KeyVault
️✔️Build
️✔️PowerShell Core - Windows

To the author of the pull request, This PR was labeled "Breaking Change Release" because it contains breaking changes.

  • According to our policy, breaking changes can only take place during major release and they must be preannounced.
  • Please follow our guide on the detailed steps.
  • [ ] Required: Please fill in the task below to facilitate our contact,you will receive notifications related to breaking changes.

github-actions[bot] avatar Jun 27 '24 17:06 github-actions[bot]

Validated that all permutations of the cmdlet is working successfully:

  1. Invoke-AzSpotPlacementScore -SpotPlacementScoresInput
PS C:\One\azure-powershell-codegen-directory\azure-powershell\src\Compute\Compute.Autorest [Az.Compute]> $response = Invoke-AzSpotPlacementScore -Location eastus -SpotPlacementScoresInput $spotPlacementScoresInput
PS C:\One\azure-powershell-codegen-directory\azure-powershell\src\Compute\Compute.Autorest [Az.Compute]> $response.PlacementScore

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 Medium                    Standard_D2_v3
                 True             southcentralus Medium                    Standard_D2_v2
                 True             southcentralus Medium                    Standard_D4_v3
                 True             centralus      RestrictedSkuNotAvailable Standard_D2_v3
                 True             centralus      RestrictedSkuNotAvailable Standard_D2_v2
                 True             centralus      RestrictedSkuNotAvailable Standard_D4_v3
  1. Invoke-AzSpotPlacementRecommender -SpotPlacementScoresInput
PS C:\One\azure-powershell-codegen-directory\azure-powershell\src\Compute\Compute.Autorest [Az.Compute]> $response = Invoke-AzSpotPlacementRecommender -Location eastus -SpotPlacementScoresInput $spotPlacementScoresInput
PS C:\One\azure-powershell-codegen-directory\azure-powershell\src\Compute\Compute.Autorest [Az.Compute]> $response.PlacementScore

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 Medium                    Standard_D2_v3
                 True             southcentralus Medium                    Standard_D2_v2
                 True             southcentralus Medium                    Standard_D4_v3
                 True             centralus      RestrictedSkuNotAvailable Standard_D2_v3
                 True             centralus      RestrictedSkuNotAvailable Standard_D2_v2
                 True             centralus      RestrictedSkuNotAvailable Standard_D4_v3

  1. Invoke-AzSpotPlacementRecommender -SpotPlacementRecommenderInput
PS C:\One\azure-powershell-codegen-directory\azure-powershell\src\Compute\Compute.Autorest [Az.Compute]> $response = Invoke-AzSpotPlacementRecommender -Location eastus -SpotPlacementRecommenderInput $spotPlacementScoresInput
PS C:\One\azure-powershell-codegen-directory\azure-powershell\src\Compute\Compute.Autorest [Az.Compute]> $response.PlacementScore

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 Medium                    Standard_D2_v3
                 True             southcentralus Medium                    Standard_D2_v2
                 True             southcentralus Medium                    Standard_D4_v3
                 True             centralus      RestrictedSkuNotAvailable Standard_D2_v3
                 True             centralus      RestrictedSkuNotAvailable Standard_D2_v2
                 True             centralus      RestrictedSkuNotAvailable Standard_D4_v3

Elina-L avatar Jul 01 '24 20:07 Elina-L

@Elina-L , needs the changelog update.

Sandido avatar Jul 01 '24 21:07 Sandido

ChangeLog:

Adding "Invoke-AzSpotPlacementScore" cmdlet. This cmdlet calls the latest Spot Placement Score API https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{region}/placementScores/spot/generate Remove the "Invoke-AzSpotPlacementRecommender" cmdlet. This cmdlet calls the soon to be deprecated Spot Placement Recommender API: https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{region}/diagnostics/spotPlacementRecommender/generate

Elina-L avatar Jul 01 '24 21:07 Elina-L