Skip to content

[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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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 - ManagedServices")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("3.1.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("3.1.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]

23 changes: 4 additions & 19 deletions src/ManagedServices/ManagedServices.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

# Remove unnecessary cmdlet.
Expand All @@ -61,8 +53,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
Expand All @@ -84,18 +75,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: EligibleApprover
# Need custom that add ArgumentCompleterAttribute for JustInTimeAccessPolicyMultiFactorAuthProvider parameter.
# - EligibleAuthorization
# - model-name: EligibleAuthorization

# The function invalid for memory cmdlet.
# Custom cmdlet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PS C:\> {{ Add code here }}
.Inputs
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.IManagedServicesIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.IMarketplaceRegistrationDefinition
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.IMarketplaceRegistrationDefinition
.Notes
COMPLEX PARAMETER PROPERTIES

Expand All @@ -46,7 +46,7 @@ INPUTOBJECT <IManagedServicesIdentity>: Identity Parameter
https://learn.microsoft.com/powershell/module/az.managedservices/get-azmanagedservicesmarketplacedefinition
#>
function Get-AzManagedServicesMarketplaceDefinition {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.IMarketplaceRegistrationDefinition])]
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.IMarketplaceRegistrationDefinition])]
[CmdletBinding(DefaultParameterSetName='ListWithScope', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='GetWithScope', Mandatory)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@

# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# 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.
# ----------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------
# 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 a in-memory object for EligibleAuthorization
.Description
Create a in-memory object for EligibleAuthorization
<#
.Synopsis
Create an in-memory object for EligibleAuthorization.
.Description
Create an in-memory object for EligibleAuthorization.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.EligibleAuthorization
.Link
https://learn.microsoft.com/powershell/module/az.ManagedServices/new-AzManagedServicesEligibleAuthorizationObject
#>
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.EligibleAuthorization
.Link
https://learn.microsoft.com/powershell/module/az.ManagedServices/new-AzManagedServicesEligibleAuthorizationObject
#>
function New-AzManagedServicesEligibleAuthorizationObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.EligibleAuthorization')]
[Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.EligibleAuthorization')]
[CmdletBinding(PositionalBinding=$false)]
Param(

[Parameter(HelpMessage="The list of managedByTenant approvers for the eligible authorization.")]
[Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.IEligibleApprover[]]
[Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.IEligibleApprover[]]
$JustInTimeAccessPolicyManagedByTenantApprover,
[Parameter(HelpMessage="The maximum access duration in ISO 8601 format for just-in-time access requests.")]
[System.TimeSpan]
$JustInTimeAccessPolicyMaximumActivationDuration,
[Parameter(HelpMessage="The multi-factor authorization provider to be used for just-in-time access requests.")]
[Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Support.MultiFactorAuthProvider]
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Support.MultiFactorAuthProvider])]
[Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.PSArgumentCompleterAttribute("Azure", "None")]
[string]
$JustInTimeAccessPolicyMultiFactorAuthProvider,
[Parameter(Mandatory, HelpMessage="The identifier of the Azure Active Directory principal.")]
[string]
Expand All @@ -51,7 +53,7 @@
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.EligibleAuthorization]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.EligibleAuthorization]::New()

$Object.JustInTimeAccessPolicyManagedByTenantApprover = $JustInTimeAccessPolicyManagedByTenantApprover

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ Create an in-memory object for Authorization.
Create an in-memory object for Authorization.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.Authorization
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization
.Link
https://learn.microsoft.com/powershell/module/Az.ManagedServices/new-AzManagedServicesAuthorizationObject
https://learn.microsoft.com/powershell/module/Az.ManagedServices/new-azmanagedservicesauthorizationobject
#>
function New-AzManagedServicesAuthorizationObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.Authorization')]
[Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization')]
[CmdletBinding(PositionalBinding=$false)]
Param(

Expand All @@ -45,7 +46,7 @@ function New-AzManagedServicesAuthorizationObject {
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.Authorization]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Authorization]::New()

if ($PSBoundParameters.ContainsKey('DelegatedRoleDefinitionId')) {
$Object.DelegatedRoleDefinitionId = $DelegatedRoleDefinitionId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ Create an in-memory object for EligibleApprover.
Create an in-memory object for EligibleApprover.

.Outputs
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.EligibleApprover
Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.EligibleApprover
.Link
https://learn.microsoft.com/powershell/module/Az.ManagedServices/new-AzManagedServicesEligibleApproverObject
https://learn.microsoft.com/powershell/module/Az.ManagedServices/new-azmanagedserviceseligibleapproverobject
#>
function New-AzManagedServicesEligibleApproverObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.EligibleApprover')]
[Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.ModelCmdletAttribute()]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.EligibleApprover')]
[CmdletBinding(PositionalBinding=$false)]
Param(

Expand All @@ -39,7 +40,7 @@ function New-AzManagedServicesEligibleApproverObject {
)

process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.EligibleApprover]::New()
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.EligibleApprover]::New()

if ($PSBoundParameters.ContainsKey('PrincipalId')) {
$Object.PrincipalId = $PrincipalId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.ManagedServices
Module Guid: f3c1cabd-ba4d-4158-b4f3-9e037b7a2d62
Module Guid: 54366ec5-1955-4a40-b1df-da4057a89b87
Download Help Link: https://learn.microsoft.com/powershell/module/az.managedservices
Help Version: 1.0.0.0
Locale: en-US
Expand All @@ -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.

### [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.

Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ 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.ManagedServices.Models.IManagedServicesIdentity
Expand Down Expand Up @@ -180,7 +179,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.IRegistrationAssignment
### Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.IRegistrationAssignment

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ 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.ManagedServices.Models.IManagedServicesIdentity
Expand Down Expand Up @@ -160,7 +159,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.IRegistrationDefinition
### Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.IRegistrationDefinition

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.IMarketplaceRegistrationDefinition
### Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.IMarketplaceRegistrationDefinition

## NOTES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,30 @@ schema: 2.0.0
# New-AzManagedServicesAssignment

## SYNOPSIS
Creates or updates a registration assignment.
Create a registration assignment.

## SYNTAX

### CreateExpanded (Default)
```
New-AzManagedServicesAssignment -Name <String> [-Scope <String>] [-RegistrationDefinitionId <String>]
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
```

### CreateViaJsonFilePath
```
New-AzManagedServicesAssignment -Name <String> -JsonFilePath <String> [-Scope <String>]
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
```

### CreateViaJsonString
```
New-AzManagedServicesAssignment -Name <String> -JsonString <String> [-Scope <String>]
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
```

## DESCRIPTION
Creates or updates a registration assignment.
Create a registration assignment.

## EXAMPLES

Expand Down Expand Up @@ -81,6 +94,36 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -JsonFilePath
Path of Json file supplied to the Create operation

```yaml
Type: System.String
Parameter Sets: CreateViaJsonFilePath
Aliases:

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

### -JsonString
Json string supplied to the Create operation

```yaml
Type: System.String
Parameter Sets: CreateViaJsonString
Aliases:

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

### -Name
The GUID of the registration assignment.

Expand Down Expand Up @@ -116,7 +159,7 @@ The fully qualified path of the registration definition.

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand Down Expand Up @@ -179,7 +222,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.Api20200201Preview.IRegistrationAssignment
### Microsoft.Azure.PowerShell.Cmdlets.ManagedServices.Models.IRegistrationAssignment

## NOTES

Expand Down
Loading