Skip to content

[MSGraph] fix group member polymophism and add count variable for list #21760

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

Merged
merged 10 commits into from
May 11, 2023
Merged
5 changes: 5 additions & 0 deletions src/Resources/MSGraph.Autorest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ In this directory, run AutoRest:
> see https://aka.ms/autorest

``` yaml
version: "3.9.5"
use-extension:
"@autorest/powershell": "4.0.0-dev.10"

require:
- $(this-folder)/../../readme.azure.noprofile.md

Expand All @@ -66,6 +70,7 @@ identity-correction-for-post: true
endpoint-resource-id-key-name: MicrosoftGraphEndpointResourceId
export-properties-for-dict: false
nested-object-to-string: true
add-api-version-in-model-namespace: true

# Disable default settings and Set in to empty for msgraph
default-exclude-tableview-properties: false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
{
using global::System.Management.Automation;

public partial class GetAzADApplication_List
{
private bool _isPolling = false;
// <summary>Backing field for <see cref="CountVariable" /> property.</summary>
private string _countVariable;

/// <summary>Specifies a count of the total number of items in a collection. </summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.")]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
PossibleTypes = new[] { typeof(string) })]
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
public string CountVariable { get => this._countVariable; set => this._countVariable = value; }

partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.ICollectionOfApplication> response, ref global::System.Threading.Tasks.Task<bool> returnNow)
{
if (_isPolling || global::System.String.IsNullOrEmpty(this.ConsistencyLevel) || !global::System.String.Equals(this.ConsistencyLevel, "eventual", System.StringComparison.InvariantCultureIgnoreCase) || !this.Count || global::System.String.IsNullOrEmpty(this.CountVariable))
{
return;
}
SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
_isPolling = true;
}
}
}
36 changes: 36 additions & 0 deletions src/Resources/MSGraph.Autorest/custom/CSharp/Get-AzADGroup_List.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
{
using System.Management.Automation;

public partial class GetAzADGroup_List
{
private bool _isPolling = false;
// <summary>Backing field for <see cref="CountVariable" /> property.</summary>
private string _countVariable;

/// <summary>Specifies a count of the total number of items in a collection. </summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.")]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
PossibleTypes = new[] { typeof(string) })]
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
public string CountVariable { get => this._countVariable; set => this._countVariable = value; }

partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.ICollectionOfGroup> response, ref global::System.Threading.Tasks.Task<bool> returnNow)
{
if (_isPolling || global::System.String.IsNullOrEmpty(this.ConsistencyLevel) || !global::System.String.Equals(this.ConsistencyLevel, "eventual", System.StringComparison.InvariantCultureIgnoreCase) || !this.Count || global::System.String.IsNullOrEmpty(this.CountVariable))
{
return;
}
SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
_isPolling = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
{
using System.Management.Automation;

public partial class GetAzADServicePrincipal_List
{
private bool _isPolling = false;
// <summary>Backing field for <see cref="CountVariable" /> property.</summary>
private string _countVariable;

/// <summary>Specifies a count of the total number of items in a collection. </summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.")]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
PossibleTypes = new[] { typeof(string) })]
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
public string CountVariable { get => this._countVariable; set => this._countVariable = value; }

partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.ICollectionOfServicePrincipal> response, ref global::System.Threading.Tasks.Task<bool> returnNow)
{
if (_isPolling || global::System.String.IsNullOrEmpty(this.ConsistencyLevel) || !global::System.String.Equals(this.ConsistencyLevel, "eventual", System.StringComparison.InvariantCultureIgnoreCase) || !this.Count || global::System.String.IsNullOrEmpty(this.CountVariable))
{
return;
}
SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
_isPolling = true;
}
}
}
36 changes: 36 additions & 0 deletions src/Resources/MSGraph.Autorest/custom/CSharp/GetAzADUser_List.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
{
using System.Management.Automation;

public partial class GetAzADUser_List
{
private bool _isPolling = false;
// <summary>Backing field for <see cref="CountVariable" /> property.</summary>
private string _countVariable;

/// <summary>Specifies a count of the total number of items in a collection. </summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.")]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
PossibleTypes = new[] { typeof(string) })]
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
public string CountVariable { get => this._countVariable; set => this._countVariable = value; }

partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task<Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.ICollectionOfUser> response, ref global::System.Threading.Tasks.Task<bool> returnNow)
{
if (_isPolling || global::System.String.IsNullOrEmpty(this.ConsistencyLevel) || !global::System.String.Equals(this.ConsistencyLevel, "eventual", System.StringComparison.InvariantCultureIgnoreCase) || !this.Count || global::System.String.IsNullOrEmpty(this.CountVariable))
{
return;
}
SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
_isPolling = true;
}
}
}
7 changes: 7 additions & 0 deletions src/Resources/MSGraph.Autorest/custom/Get-AzADApplication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ param(
[System.Management.Automation.SwitchParameter]
${AppendSelected},

[Parameter(ParameterSetName='EmptyParameterSet')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')]
[System.String]
# Specifies a count of the total number of items in a collection.
# By default, this variable will be set in the global scope.
${CountVariable},

[Parameter()]
[Alias("AzContext", "AzureRmContext", "AzureCredential")]
[ValidateNotNull()]
Expand Down
7 changes: 7 additions & 0 deletions src/Resources/MSGraph.Autorest/custom/Get-AzADGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ function Get-AzADGroup {
[System.Management.Automation.SwitchParameter]
${AppendSelected},

[Parameter(ParameterSetName='EmptyParameterSet')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')]
[System.String]
# Specifies a count of the total number of items in a collection.
# By default, this variable will be set in the global scope.
${CountVariable},

[Parameter()]
[Alias("AzContext", "AzureRmContext", "AzureCredential")]
[ValidateNotNull()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ param(
[System.Management.Automation.SwitchParameter]
${AppendSelected},

[Parameter(ParameterSetName='EmptyParameterSet')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')]
[System.String]
# Specifies a count of the total number of items in a collection.
# By default, this variable will be set in the global scope.
${CountVariable},

[Parameter()]
[Alias("AzContext", "AzureRmContext", "AzureCredential")]
[ValidateNotNull()]
Expand Down
7 changes: 7 additions & 0 deletions src/Resources/MSGraph.Autorest/custom/Get-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ function Get-AzADUser {
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Management.Automation.SwitchParameter]
${AppendSelected},

[Parameter(ParameterSetName='List')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')]
[System.String]
# Specifies a count of the total number of items in a collection.
# By default, this variable will be set in the global scope.
${CountVariable},

[Parameter(ParameterSetName='List')]
[System.String]
Expand Down

This file was deleted.

25 changes: 0 additions & 25 deletions src/Resources/MSGraph.Autorest/custom/model/MicrosoftGraphGroup.cs

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions src/Resources/MSGraph.Autorest/custom/model/MicrosoftGraphUser.cs

This file was deleted.

Loading