Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 8 additions & 14 deletions src/Fleet/Fleet.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,12 @@ require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
- $(repo)/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md

title: Fleet
module-version: 0.1.0
subject-prefix: $(service-name)
disable-transform-identity-type: true
flatten-userassignedidentity: false

directive:
# # # Following is two common directive which are normally required in all the RPs
# # # 1. Remove the unexpanded parameter set
# # # 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
# Fix required parameter missing
- from: swagger-document
where: $.definitions.FleetMember
Expand Down Expand Up @@ -74,15 +66,17 @@ directive:
- from: swagger-document
where: $.definitions.NodeImageSelection.properties.type
transform: $['x-ms-mutability'] = ["read", "update", "create"]
# # # Following is two common directive which are normally required in all the RPs
# # # 1. Remove the unexpanded parameter set
# # # 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
remove: true
# Hide set cmdlet
- where:
verb: Set
remove: true
# Rename IdentityUserAssignedIdentity, UpdateStrategyName
- where:
parameter-name: IdentityUserAssignedIdentity
set:
parameter-name: UserAssignedIdentity
# Rename UpdateStrategyName
- where:
parameter-name: UpdateStrategyName
subject: FleetUpdateStrategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"commands": [
{
"name": "Get-AzFleetUpdateRun",
"description": "Get a GetRun",
"description": "Get a UpdateRun",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}",
"help": {
"learnMore": {
Expand All @@ -26,7 +26,7 @@
},
"examples": [
{
"description": "Get a GetRun",
"description": "Get a UpdateRun",
"parameters": [
{
"name": "-FleetName",
Expand All @@ -50,7 +50,7 @@
},
{
"name": "Remove-AzFleetUpdateRun",
"description": "Delete a DeleteRun",
"description": "Delete a UpdateRun",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}",
"help": {
"learnMore": {
Expand All @@ -69,7 +69,7 @@
},
"examples": [
{
"description": "Delete a DeleteRun",
"description": "Delete a UpdateRun",
"parameters": [
{
"name": "-FleetName",
Expand All @@ -93,7 +93,7 @@
},
{
"name": "Start-AzFleetUpdateRun",
"description": "Starts an StartRun.",
"description": "Starts an UpdateRun.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start",
"help": {
"learnMore": {
Expand All @@ -112,7 +112,7 @@
},
"examples": [
{
"description": "Starts an StartRun.",
"description": "Starts an UpdateRun.",
"parameters": [
{
"name": "-FleetName",
Expand All @@ -136,7 +136,7 @@
},
{
"name": "Stop-AzFleetUpdateRun",
"description": "Stops an StopRun.",
"description": "Stops an UpdateRun.",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop",
"help": {
"learnMore": {
Expand All @@ -155,7 +155,7 @@
},
"examples": [
{
"description": "Stops an StopRun.",
"description": "Stops an UpdateRun.",
"parameters": [
{
"name": "-FleetName",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"commands": [
{
"name": "Get-AzFleetUpdateStrategy",
"description": "Get a FleetGettrategy",
"description": "Get a FleetUpdateStrategy",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}",
"help": {
"learnMore": {
Expand All @@ -26,7 +26,7 @@
},
"examples": [
{
"description": "Get a FleetGettrategy",
"description": "Get a FleetUpdateStrategy",
"parameters": [
{
"name": "-FleetName",
Expand All @@ -50,7 +50,7 @@
},
{
"name": "Remove-AzFleetUpdateStrategy",
"description": "Delete a FleetDeletetrategy",
"description": "Delete a FleetUpdateStrategy",
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}",
"help": {
"learnMore": {
Expand All @@ -69,7 +69,7 @@
},
"examples": [
{
"description": "Delete a FleetDeletetrategy",
"description": "Delete a FleetUpdateStrategy",
"parameters": [
{
"name": "-FleetName",
Expand Down
71 changes: 70 additions & 1 deletion src/Fleet/Fleet.Autorest/examples/New-AzFleet.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Example 1: Creates a Fleet resource
### Example 1: Creates a Fleet resource with none identity type
```powershell
New-AzFleet -Name sss -ResourceGroupName ps1-test -Location eastus
```
Expand Down Expand Up @@ -26,4 +26,73 @@ Tag : {
Type : Microsoft.ContainerService/fleets
```

This command creates a Fleet resource with none identity type.


### Example 2: Creates a Fleet resource with EnableSystemAssignedIdentity
```powershell
New-AzFleet -Name testfleet02 -ResourceGroupName joyer-test -Location eastus -Tag @{"456"="asd"} -EnableSystemAssignedIdentity
```

```output
ETag : "0a006dc9-0000-0100-0000-661cd4f70000"
Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.ContainerService/fleets/testfleet02
IdentityPrincipalId : 978528a9-fa0f-4cdb-8282-95b3b30bb883
IdentityTenantId : 72f988bf-86f1-41af-91ab-2d7cd011db47
IdentityType : SystemAssigned
IdentityUserAssignedIdentity : {
}
Location : eastus
Name : testfleet02
ProvisioningState : Succeeded
ResourceGroupName : joyer-test
SystemDataCreatedAt : 4/15/2024 7:19:15 AM
SystemDataCreatedBy : [email protected]
SystemDataCreatedByType : User
SystemDataLastModifiedAt : 4/15/2024 7:19:15 AM
SystemDataLastModifiedBy : [email protected]
SystemDataLastModifiedByType : User
Tag : {
"456": "asd"
}
Type : Microsoft.ContainerService/fleets
```

This command creates a Fleet resource with system assigned identity type.


### Example 3: Creates a Fleet resource with user assigned identity type
```powershell
$mi = Get-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName joyer-test
New-AzFleet -Name testfleet03 -ResourceGroupName joyer-test -Location eastus -Tag @{"789"="asd"} -UserAssignedIdentity $mi.Id
```

```output
ETag : "0a00e0c9-0000-0100-0000-661cd8010000"
Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.ContainerService/fleets/testflee
t03
IdentityPrincipalId :
IdentityTenantId :
IdentityType : UserAssigned
IdentityUserAssignedIdentity : {
"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-test/providers/Microsoft.ManagedIdentity/userAssignedI
dentities/testUserAssignedMI": {
}
}
Location : eastus
Name : testfleet03
ProvisioningState : Succeeded
ResourceGroupName : joyer-test
SystemDataCreatedAt : 4/15/2024 7:32:16 AM
SystemDataCreatedBy : [email protected]
SystemDataCreatedByType : User
SystemDataLastModifiedAt : 4/15/2024 7:32:16 AM
SystemDataLastModifiedBy : [email protected]
SystemDataLastModifiedByType : User
Tag : {
"789": "asd"
}
Type : Microsoft.ContainerService/fleets
```

This command creates a Fleet resource with a long running operation.
32 changes: 32 additions & 0 deletions src/Fleet/Fleet.Autorest/examples/Update-AzFleet.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,35 @@ Type : Microsoft.ContainerService/fleets

This command updates tag of a fleet.


### Example 2: disable system assigned identity of specified fleet
```powershell
Update-AzFleet -ResourceGroupName joyer-test -Name testfleet03 -EnableSystemAssignedIdentity 0
```

```output
ETag : "0a00e5cc-0000-0100-0000-661cea3b0000"
Id : /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/joyer-test/providers/Microsoft.ContainerService/fleets/testflee
t02
IdentityPrincipalId :
IdentityTenantId :
IdentityType : None
IdentityUserAssignedIdentity : {
}
Location : eastus
Name : testfleet02
ProvisioningState : Succeeded
ResourceGroupName : joyer-test
SystemDataCreatedAt : 4/15/2024 7:19:15 AM
SystemDataCreatedBy : [email protected]
SystemDataCreatedByType : User
SystemDataLastModifiedAt : 4/15/2024 8:50:01 AM
SystemDataLastModifiedBy : [email protected]
SystemDataLastModifiedByType : User
Tag : {
"456": "asd"
}
Type : Microsoft.ContainerService/fleets
```

This command updates EnableSystemAssignedIdentity of a fleet.
4 changes: 2 additions & 2 deletions src/Fleet/Fleet.Autorest/exports/Get-AzFleetUpdateRun.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

<#
.Synopsis
Get a GetRun
Get a UpdateRun
.Description
Get a GetRun
Get a UpdateRun
.Example
Get-AzFleetUpdateRun -FleetName testfleet01 -ResourceGroupName K8sFleet-Test
.Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

<#
.Synopsis
Get a FleetGettrategy
Get a FleetUpdateStrategy
.Description
Get a FleetGettrategy
Get a FleetUpdateStrategy
.Example
Get-AzFleetUpdateStrategy -FleetName testfleet01 -ResourceGroupName K8sFleet-Test
.Example
Expand Down
21 changes: 12 additions & 9 deletions src/Fleet/Fleet.Autorest/exports/New-AzFleet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Create a Fleet.
Create a Fleet.
.Example
New-AzFleet -Name sss -ResourceGroupName ps1-test -Location eastus
.Example
New-AzFleet -Name testfleet02 -ResourceGroupName joyer-test -Location eastus -Tag @{"456"="asd"} -EnableSystemAssignedIdentity
.Example
$mi = Get-AzUserAssignedIdentity -Name testUserAssignedMI -ResourceGroupName joyer-test
New-AzFleet -Name testfleet03 -ResourceGroupName joyer-test -Location eastus -Tag @{"789"="asd"} -UserAssignedIdentity $mi.Id

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity
Expand Down Expand Up @@ -100,11 +105,10 @@ param(

[Parameter(ParameterSetName='CreateExpanded')]
[Parameter(ParameterSetName='CreateViaIdentityExpanded')]
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.PSArgumentCompleterAttribute("None", "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned")]
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Body')]
[System.String]
# Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
${IdentityType},
[System.Management.Automation.SwitchParameter]
# Decides if enable a system assigned identity for the resource.
${EnableSystemAssignedIdentity},

[Parameter(ParameterSetName='CreateExpanded')]
[Parameter(ParameterSetName='CreateViaIdentityExpanded')]
Expand All @@ -116,12 +120,11 @@ param(

[Parameter(ParameterSetName='CreateExpanded')]
[Parameter(ParameterSetName='CreateViaIdentityExpanded')]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IUserAssignedIdentities]))]
[System.Collections.Hashtable]
# The set of user assigned identities associated with the resource.
# The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
# The dictionary values can be empty objects ({}) in requests.
[System.String[]]
# The array of user assigned identities associated with the resource.
# The elements in array will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.'
${UserAssignedIdentity},

[Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)]
Expand Down
4 changes: 2 additions & 2 deletions src/Fleet/Fleet.Autorest/exports/New-AzFleetUpdateRun.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

<#
.Synopsis
Create a CreateRun
Create a UpdateRun
.Description
Create a CreateRun
Create a UpdateRun
.Example
New-AzFleetUpdateRun -FleetName testfleet01 -Name run1 -ResourceGroupName K8sFleet-Test -UpgradeType Full -UpgradeKubernetesVersion "1.26.1" -NodeImageSelectionType Latest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

<#
.Synopsis
Create a FleetCreatetrategy
Create a FleetUpdateStrategy
.Description
Create a FleetCreatetrategy
Create a FleetUpdateStrategy
.Example
$stage = New-AzFleetUpdateStageObject -Name stag1 -Group @{name='group-a'} -AfterStageWaitInSecond 3600
New-AzFleetUpdateStrategy -FleetName testfleet01 -ResourceGroupName K8sFleet-Test -Name strategy1 -StrategyStage $stage
Expand Down
Loading