Skip to content
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

Migrate Resources from generation to main #25631

Merged
merged 2 commits into from
Jul 27, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/Resources/Authorization.Autorest/Az.Authorization.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@{
GUID = 'c9f907de-d9b2-4db4-b439-78ce632c122e'
GUID = '05291185-22ad-4d77-a19f-50c191748b67'
RootModule = './Az.Authorization.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = 'Core', 'Desktop'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.Authorization
Module Guid: c9f907de-d9b2-4db4-b439-78ce632c122e
Module Guid: 05291185-22ad-4d77-a19f-50c191748b67
Download Help Link: https://learn.microsoft.com/powershell/module/az.authorization
Help Version: 1.0.0.0
Locale: en-US
Expand Down
3 changes: 1 addition & 2 deletions src/Resources/MSGraph.Autorest/examples/New-AzADUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ Create user with password profile

### Example 2: Create user with password
```powershell
$password = "xxxxxxxxxx"
$password = ConvertTo-SecureString -AsPlainText -Force $password
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
New-AzADUser -DisplayName $uname -Password $password -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
```

Expand Down
3 changes: 1 addition & 2 deletions src/Resources/MSGraph.Autorest/exports/New-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ $password = "xxxxxxxxxx"
$pp = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile" -Property @{Password=$password}
New-AzADUser -DisplayName $uname -PasswordProfile $pp -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
.Example
$password = "xxxxxxxxxx"
$password = ConvertTo-SecureString -AsPlainText -Force $password
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
New-AzADUser -DisplayName $uname -Password $password -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn

.Outputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10800,8 +10800,7 @@ $password = "xxxxxxxxxx"
$pp = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile" -Property @{Password=$password}
New-AzADUser -DisplayName $uname -PasswordProfile $pp -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
.Example
$password = "xxxxxxxxxx"
$password = ConvertTo-SecureString -AsPlainText -Force $password
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
New-AzADUser -DisplayName $uname -Password $password -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn

.Outputs
Expand Down
3 changes: 1 addition & 2 deletions src/Resources/MSGraph.Autorest/internal/New-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ $password = "xxxxxxxxxx"
$pp = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile" -Property @{Password=$password}
New-AzADUser -DisplayName $uname -PasswordProfile $pp -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
.Example
$password = "xxxxxxxxxx"
$password = ConvertTo-SecureString -AsPlainText -Force $password
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
New-AzADUser -DisplayName $uname -Password $password -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn

.Outputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6181,8 +6181,7 @@ $password = "xxxxxxxxxx"
$pp = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile" -Property @{Password=$password}
New-AzADUser -DisplayName $uname -PasswordProfile $pp -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
.Example
$password = "xxxxxxxxxx"
$password = ConvertTo-SecureString -AsPlainText -Force $password
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
New-AzADUser -DisplayName $uname -Password $password -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn

.Outputs
Expand Down
13 changes: 9 additions & 4 deletions src/Resources/Policy.Autorest/custom/Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,14 @@ function ConvertFrom-JsonSafe
ConvertFrom-Json $InputObject -AsHashtable:$AsHashtable
}
elseif ($AsHashtable) {
$hashtable = @{}
($InputObject | ConvertFrom-Json).psobject.properties | Foreach { $hashtable[$_.Name] = $_.Value }
$hashTable
# ConvertFrom-Json on Windows Powershell doesn't support -AsHashtable parameter
$converted = ConvertParameterInput ($InputObject | ConvertFrom-Json)
if (($converted -is [array]) -and ($converted.Count -eq 1)) {
return $converted[0]
}
else {
return $converted
}
}
else {
ConvertFrom-Json $InputObject
Expand Down Expand Up @@ -327,7 +332,7 @@ function ConvertParameterInput
{
$returnValue = @{}
foreach ($property in $InputObject.PSObject.Properties) {
$returnValue[$property.Name] = (ConvertParameterInput $property.Value).PSObject.BaseObject
$returnValue[$property.Name] = (ConvertParameterInput $property.Value)
}

return $returnValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ param(
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateNotNullOrEmpty()]
[ValidateSet('Default', 'DoNotEnforce')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute('Default', 'DoNotEnforce')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The policy assignment enforcement mode.
Expand All @@ -121,6 +122,7 @@ param(

[Parameter()]
[ValidateSet('None', 'SystemAssigned', 'UserAssigned')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute('None', 'SystemAssigned', 'UserAssigned')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The identity type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ param(

[Parameter(ValueFromPipelineByPropertyName)]
[ValidateSet('Default', 'DoNotValidate')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute('Default', 'DoNotValidate')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# Whether to validate the exemption is at or under the assignment scope.
Expand All @@ -71,6 +72,7 @@ param(

[Parameter(ParameterSetName='Default', Mandatory, ValueFromPipelineByPropertyName)]
[ValidateSet('Waiver', 'Mitigated')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute('Waiver', 'Mitigated')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Path')]
[System.String]
# The policy exemption category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary
((IPolicyDefinitionReferenceInternal)this).Parameter = content.GetValueForProperty(keyValuePair.Key.ToString(), ((IPolicyDefinitionReferenceInternal)this).Parameter, ParameterValuesTypeConverter.ConvertFrom);
}

keyValuePair = content.Cast<System.Collections.DictionaryEntry>().FirstOrDefault((kvp) => "Id".Equals(kvp.Key.ToString(), StringComparison.OrdinalIgnoreCase));
// Github issue: https://github.com/Azure/azure-powershell/issues/25112
// fix the serialization: the input property name is policyDefinitionReferenceId, but the generated model has it as Id.
keyValuePair = content.Cast<System.Collections.DictionaryEntry>().FirstOrDefault((kvp) => "PolicyDefinitionReferenceId".Equals(kvp.Key.ToString(), StringComparison.OrdinalIgnoreCase));
if (keyValuePair.Key != null)
{
((IPolicyDefinitionReferenceInternal)this).Id = content.GetValueForProperty(keyValuePair.Key.ToString(), ((IPolicyDefinitionReferenceInternal)this).Id, Convert.ToString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ param(
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateNotNullOrEmpty()]
[ValidateSet('Default', 'DoNotEnforce')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute('Default', 'DoNotEnforce')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The policy assignment enforcement mode.
Expand All @@ -132,6 +133,7 @@ param(

[Parameter()]
[ValidateSet('None', 'SystemAssigned', 'UserAssigned')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute('None', 'SystemAssigned', 'UserAssigned')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The identity type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ param(

[Parameter(ValueFromPipelineByPropertyName)]
[ValidateSet('Waiver', 'Mitigated')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute('Waiver', 'Mitigated')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Path')]
[System.String]
# The policy exemption category
Expand Down Expand Up @@ -115,6 +116,7 @@ param(

[Parameter()]
[ValidateSet('Default', 'DoNotValidate')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute('Default', 'DoNotValidate')]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The option whether validate the exemption is at or under the assignment scope.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,15 @@ param(
${Metadata},

[Parameter(ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Default", "DoNotEnforce")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The policy assignment enforcement mode.
# Possible values are Default and DoNotEnforce.
${EnforcementMode},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("None", "SystemAssigned", "UserAssigned")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The identity type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ param(
${Name},

[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Waiver", "Mitigated")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Path')]
[System.String]
# The policy exemption category
Expand All @@ -120,6 +121,7 @@ param(
${PolicyDefinitionReferenceId},

[Parameter(ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Default", "DoNotValidate")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# Whether to validate the exemption is at or under the assignment scope.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1073,13 +1073,15 @@ param(
${Metadata},

[Parameter(ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Default", "DoNotEnforce")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The policy assignment enforcement mode.
# Possible values are Default and DoNotEnforce.
${EnforcementMode},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("None", "SystemAssigned", "UserAssigned")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The identity type.
Expand Down Expand Up @@ -1598,6 +1600,7 @@ param(
${Name},

[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Waiver", "Mitigated")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Path')]
[System.String]
# The policy exemption category
Expand All @@ -1624,6 +1627,7 @@ param(
${PolicyDefinitionReferenceId},

[Parameter(ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Default", "DoNotValidate")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# Whether to validate the exemption is at or under the assignment scope.
Expand Down Expand Up @@ -3147,13 +3151,15 @@ param(
${Location},

[Parameter(ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Default", "DoNotEnforce")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The policy assignment enforcement mode.
# Possible values are Default and DoNotEnforce.
${EnforcementMode},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("None", "SystemAssigned", "UserAssigned")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The identity type.
Expand Down Expand Up @@ -3675,6 +3681,7 @@ param(
${Scope},

[Parameter(ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Waiver", "Mitigated")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Path')]
[System.String]
# The policy exemption category
Expand Down Expand Up @@ -3733,6 +3740,7 @@ param(
${BackwardCompatible},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Default", "DoNotValidate")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The option whether validate the exemption is at or under the assignment scope.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ param(
${Location},

[Parameter(ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Default", "DoNotEnforce")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The policy assignment enforcement mode.
# Possible values are Default and DoNotEnforce.
${EnforcementMode},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("None", "SystemAssigned", "UserAssigned")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The identity type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ param(
${Scope},

[Parameter(ValueFromPipelineByPropertyName)]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Waiver", "Mitigated")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Path')]
[System.String]
# The policy exemption category
Expand Down Expand Up @@ -151,6 +152,7 @@ param(
${BackwardCompatible},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.PSArgumentCompleterAttribute("Default", "DoNotValidate")]
[Microsoft.Azure.PowerShell.Cmdlets.Policy.Category('Body')]
[System.String]
# The option whether validate the exemption is at or under the assignment scope.
Expand Down

Large diffs are not rendered by default.

Loading