Skip to content

Commit

Permalink
Temporary/sync generation to future #26323 (#26364)
Browse files Browse the repository at this point in the history
* Rename test resource group and additional fixes (#26323)

* fix parameter issues

* fix

* rename test group

* adapt

---------

Co-authored-by: Arulvel Muralidharan <[email protected]>
  • Loading branch information
VeryEarly and ArulvelMuralidharan authored Oct 17, 2024
1 parent cbbedfa commit 1acda83
Show file tree
Hide file tree
Showing 34 changed files with 507 additions and 182 deletions.
26 changes: 26 additions & 0 deletions src/AksArc/AksArc.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the ""License"");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an ""AS IS"" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - AksArc")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.1")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
14 changes: 14 additions & 0 deletions src/AksArc/AksArc.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ directive:
transform: >-
$["operationId"] = "KubernetesVersions_Create"
# Fix fields in Get-KubernetesVersion
- from: swagger-document
where: $.definitions.KubernetesVersionReadiness.properties.osType
transform: >-
delete $.readOnly
- from: swagger-document
where: $.definitions.KubernetesVersionReadiness.properties.ready
transform: >-
delete $.readOnly
- from: swagger-document
where: $.definitions.KubernetesVersionReadiness.properties.errorMessage
transform: >-
delete $.readOnly
# Rename Subjects
- where:
subject: AgentPool
Expand Down
18 changes: 10 additions & 8 deletions src/AksArc/AksArc.Autorest/custom/Remove-AzAksArcCluster.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,20 @@ param(
)

process {
$APIVersion = "2024-01-01"
$null = Invoke-AzRestMethod -Path "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Kubernetes/connectedClusters/$ClusterName/?api-version=$APIVersion" -Method DELETE

# Query status until delete is complete
$stopLoop = $false
do
{
$response = Invoke-AzRestMethod -Path "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Kubernetes/connectedClusters/$ClusterName/?api-version=$APIVersion" -Method GET

if ($response.StatusCode -eq 404) {
$stopLoop = $true
return
try {
$null = Invoke-AzRestMethod -Path "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Kubernetes/connectedClusters/$ClusterName/?api-version=$ConnectedClusterAPIVersion" -Method DELETE
$response = Invoke-AzRestMethod -Path "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Kubernetes/connectedClusters/$ClusterName/?api-version=$ConnectedClusterAPIVersion" -Method GET
if (!$response -or ($response.StatusCode -eq 404)) {
$stopLoop = $true
return
}
}
catch {
Write-Error $_
}

Start-Sleep -Seconds 30
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ process {

if ($ShouldUpdateConnectedCluster) {
UpdateConnectedCluster -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -ClusterName $ClusterName -AdminGroupObjectID $AdminGroupObjectID
$null = $PSBoundParameters.Remove("AdminGroupObjectID")
}

# Update Default Nodepool
Expand Down
7 changes: 2 additions & 5 deletions src/AksArc/AksArc.Autorest/custom/helpers/Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function CreateConnectedCluster {
$EnableAzureRbacStr = "true"
}

$APIVersion = "2024-01-01"
$json =
@"
{
Expand All @@ -75,7 +74,7 @@ function CreateConnectedCluster {
}
}
"@
$null = Invoke-AzRestMethod -Path "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Kubernetes/connectedClusters/$ClusterName/?api-version=$APIVersion" -Method PUT -payload $json
$null = Invoke-AzRestMethod -Path "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Kubernetes/connectedClusters/$ClusterName/?api-version=$ConnectedClusterAPIVersion" -Method PUT -payload $json
}

function UpdateConnectedCluster {
Expand All @@ -87,9 +86,7 @@ function UpdateConnectedCluster {
[System.String[]] ${AdminGroupObjectID}
)


$APIVersion = "2024-01-01"
$ConnectedClusterResource = Invoke-AzRestMethod -Path "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Kubernetes/connectedClusters/$ClusterName/?api-version=$APIVersion" -Method GET
$ConnectedClusterResource = Invoke-AzRestMethod -Path "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Kubernetes/connectedClusters/$ClusterName/?api-version=$ConnectedClusterAPIVersion" -Method GET

$Location = ($ConnectedClusterResource.Content | ConvertFrom-Json).location
$EnableAzureRbac = ($ConnectedClusterResource.Content | ConvertFrom-Json).properties.aadProfile.enableAzureRBAC
Expand Down
2 changes: 2 additions & 0 deletions src/AksArc/AksArc.Autorest/custom/helpers/Variables.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Connected Cluster API Version to use
$ConnectedClusterAPIVersion = "2024-01-01"
2 changes: 1 addition & 1 deletion src/AksArc/AksArc.Autorest/docs/Az.AksArc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.AksArc
Module Guid: 0e2f96c9-10b2-4c68-b181-d29e3bdfdeed
Module Guid: 9bdff771-dd3c-4dc4-b925-f0b25b86632f
Download Help Link: https://learn.microsoft.com/powershell/module/az.aksarc
Help Version: 1.0.0.0
Locale: en-US
Expand Down
2 changes: 1 addition & 1 deletion src/AksArc/AksArc.Autorest/generate-info.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"generate_Id": "130c6d2b-3c59-4e19-8a4b-fc7168e2d444"
"generate_Id": "1409febf-3784-4f36-bc5f-d7a3be3ae4f2"
}
11 changes: 11 additions & 0 deletions src/AksArc/AksArc.Autorest/resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Resources
This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder.

## Info
- Modifiable: yes
- Generated: no
- Committed: yes
- Packaged: no

## Purpose
Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact.
Loading

0 comments on commit 1acda83

Please sign in to comment.