-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[PS] Migrate ManagedServices module to autorest v4 #27929
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
base: main
Are you sure you want to change the base?
Changes from all commits
ce2e1b7
37eb0ba
8f20cf8
656cc7c
2b22440
4524c95
df898ee
73c24b0
aabd806
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,14 +38,6 @@ title: ManagedServices | |||||||||||
| module-version: 2.0.0 | ||||||||||||
| subject-prefix: $(service-name) | ||||||||||||
|
|
||||||||||||
| identity-correction-for-post: true | ||||||||||||
| resourcegroup-append: true | ||||||||||||
| nested-object-to-string: true | ||||||||||||
|
|
||||||||||||
| # For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option | ||||||||||||
| use-extension: | ||||||||||||
| "@autorest/powershell": "3.x" | ||||||||||||
|
|
||||||||||||
| directive: | ||||||||||||
| - where: | ||||||||||||
| verb: New|Get | ||||||||||||
|
|
@@ -139,8 +131,7 @@ directive: | |||||||||||
|
|
||||||||||||
| # Remove variant of the cmdlet | ||||||||||||
| - where: | ||||||||||||
| verb: New | ||||||||||||
| variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$ | ||||||||||||
| variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))|^CreateViaIdentityExpanded$ | ||||||||||||
| remove: true | ||||||||||||
|
|
||||||||||||
| # Hide cmdlet | ||||||||||||
|
|
@@ -162,18 +153,12 @@ directive: | |||||||||||
| default: | ||||||||||||
| script: '"subscriptions/" + (Get-AzContext).Subscription.Id' | ||||||||||||
|
|
||||||||||||
| # The regex(^/(?<scope>[^/]+)/) mathch failed because the scope inlcude '/' character. | ||||||||||||
| # Replace regex to fixed it. | ||||||||||||
| - from: source-file-csharp | ||||||||||||
| where: $ | ||||||||||||
| transform: $ = $.replace(/global::System.Text.RegularExpressions.Regex\(\"\^\/\(\?\<scope\>\[\^\/\]\+\)/g, 'global::System.Text.RegularExpressions.Regex("^/(?<scope>.+)'); | ||||||||||||
|
|
||||||||||||
| # Generate memory object as parameter of the cmelet. | ||||||||||||
| - model-cmdlet: | ||||||||||||
| # - Authorization | ||||||||||||
| - EligibleApprover | ||||||||||||
| - model-name: Authorization | ||||||||||||
|
||||||||||||
| - model-name: Authorization | |
| # Do not generate Authorization because a hand-maintained | |
| # New-AzManagedServicesAuthorizationObject already exists under custom/. | |
| # Generating it here would create a duplicate implementation under | |
| # custom/autogen-model-cmdlets/ and lead to non-deterministic exports. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,66 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ---------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # ---------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .Synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Create an in-memory object for Authorization. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Create an in-memory object for Authorization. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .Outputs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .Link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| https://learn.microsoft.com/powershell/module/Az.ManagedServices/new-azmanagedservicesauthorizationobject | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function New-AzManagedServicesAuthorizationObject { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.ModelCmdletAttribute()] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization')] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [CmdletBinding(PositionalBinding=$false)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Param( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+28
to
+33
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Parameter(HelpMessage="The delegatedRoleDefinitionIds field is required when the roleDefinitionId refers to the User Access Administrator Role. It is the list of role definition ids which define all the permissions that the user in the authorization can assign to other principals.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [string[]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $DelegatedRoleDefinitionId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Parameter(Mandatory, HelpMessage="The identifier of the Azure Active Directory principal.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [string] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $PrincipalId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Parameter(HelpMessage="The display name of the Azure Active Directory principal.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [string] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $PrincipalIdDisplayName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Parameter(Mandatory, HelpMessage="The identifier of the Azure built-in role that defines the permissions that the Azure Active Directory principal will have on the projected scope.")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [string] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $RoleDefinitionId | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| process { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $Object = [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization]::New() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($PSBoundParameters.ContainsKey('DelegatedRoleDefinitionId')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $Object.DelegatedRoleDefinitionId = $DelegatedRoleDefinitionId | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($PSBoundParameters.ContainsKey('PrincipalId')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $Object.PrincipalId = $PrincipalId | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($PSBoundParameters.ContainsKey('PrincipalIdDisplayName')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $Object.PrincipalIdDisplayName = $PrincipalIdDisplayName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($PSBoundParameters.ContainsKey('RoleDefinitionId')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $Object.RoleDefinitionId = $RoleDefinitionId | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return $Object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+66
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <# | |
| .Synopsis | |
| Create an in-memory object for Authorization. | |
| .Description | |
| Create an in-memory object for Authorization. | |
| .Outputs | |
| Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization | |
| .Link | |
| https://learn.microsoft.com/powershell/module/Az.ManagedServices/new-azmanagedservicesauthorizationobject | |
| #> | |
| function New-AzManagedServicesAuthorizationObject { | |
| [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.ModelCmdletAttribute()] | |
| [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization')] | |
| [CmdletBinding(PositionalBinding=$false)] | |
| Param( | |
| [Parameter(HelpMessage="The delegatedRoleDefinitionIds field is required when the roleDefinitionId refers to the User Access Administrator Role. It is the list of role definition ids which define all the permissions that the user in the authorization can assign to other principals.")] | |
| [string[]] | |
| $DelegatedRoleDefinitionId, | |
| [Parameter(Mandatory, HelpMessage="The identifier of the Azure Active Directory principal.")] | |
| [string] | |
| $PrincipalId, | |
| [Parameter(HelpMessage="The display name of the Azure Active Directory principal.")] | |
| [string] | |
| $PrincipalIdDisplayName, | |
| [Parameter(Mandatory, HelpMessage="The identifier of the Azure built-in role that defines the permissions that the Azure Active Directory principal will have on the projected scope.")] | |
| [string] | |
| $RoleDefinitionId | |
| ) | |
| process { | |
| $Object = [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization]::New() | |
| if ($PSBoundParameters.ContainsKey('DelegatedRoleDefinitionId')) { | |
| $Object.DelegatedRoleDefinitionId = $DelegatedRoleDefinitionId | |
| } | |
| if ($PSBoundParameters.ContainsKey('PrincipalId')) { | |
| $Object.PrincipalId = $PrincipalId | |
| } | |
| if ($PSBoundParameters.ContainsKey('PrincipalIdDisplayName')) { | |
| $Object.PrincipalIdDisplayName = $PrincipalIdDisplayName | |
| } | |
| if ($PSBoundParameters.ContainsKey('RoleDefinitionId')) { | |
| $Object.RoleDefinitionId = $RoleDefinitionId | |
| } | |
| return $Object | |
| } | |
| } | |
| # Intentionally left without a cmdlet definition. | |
| # The single supported implementation of New-AzManagedServicesAuthorizationObject | |
| # lives in custom/New-AzManagedServicesAuthorizationObject.ps1. | |
| # Removing the duplicate definition from this autogenerated path avoids | |
| # non-deterministic function override behavior when custom/*.ps1 files are | |
| # dot-sourced recursively. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,23 +21,26 @@ Gets the registration definition details. | |
| Get the marketplace registration definition for the marketplace identifier. | ||
|
|
||
| ### [New-AzManagedServicesAssignment](New-AzManagedServicesAssignment.md) | ||
| Creates or updates a registration assignment. | ||
| Create a registration assignment. | ||
|
|
||
| ### [New-AzManagedServicesAuthorizationObject](New-AzManagedServicesAuthorizationObject.md) | ||
| Create an in-memory object for Authorization. | ||
|
|
||
| ### [New-AzManagedServicesDefinition](New-AzManagedServicesDefinition.md) | ||
| Creates or updates a registration definition. | ||
| Create a registration definition. | ||
|
|
||
|
Comment on lines
23
to
31
|
||
| ### [New-AzManagedServicesEligibleApproverObject](New-AzManagedServicesEligibleApproverObject.md) | ||
| Create an in-memory object for EligibleApprover. | ||
|
|
||
| ### [New-AzManagedServicesEligibleAuthorizationObject](New-AzManagedServicesEligibleAuthorizationObject.md) | ||
| Create a in-memory object for EligibleAuthorization | ||
| Create an in-memory object for EligibleAuthorization. | ||
|
|
||
| ### [Remove-AzManagedServicesAssignment](Remove-AzManagedServicesAssignment.md) | ||
| Deletes the specified registration assignment. | ||
|
|
||
| ### [Remove-AzManagedServicesDefinition](Remove-AzManagedServicesDefinition.md) | ||
| Deletes the registration definition. | ||
|
|
||
| ### [Update-AzManagedServicesDefinition](Update-AzManagedServicesDefinition.md) | ||
| Update a registration definition. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variant-removal directive currently filters only on
variant:and will apply across all cmdlets/verbs in this module. To avoid unintentionally removing parameter sets/variants from unrelated cmdlets (now or in future), constrain thewhere:clause (e.g., include the intendedverband/orsubject) so it only targets the New/Update cmdlets you mean to trim.