Skip to content

Commit 9ce4e03

Browse files
VeryEarlyqinzhouxu
authored andcommitted
[MSGraph] fix group member polymophism and add count variable for list (Azure#21760)
* move application schema into commontypes.yml * support polymorphism for directoryobject * re-enable API version * add -CountVariable to list cmdlets * return when count or countvariable not provided, or consistencyLevel incorrect * return when count or countvariable not provided, or consistencyLevel incorrect * fix version for autorest/powershell dev and autorest/core * get-azadgroupmember polymorphism and countvariable (Azure#21737) * move application schema into commontypes.yml * support polymorphism for directoryobject * re-enable API version * add -CountVariable to list cmdlets * return when count or countvariable not provided, or consistencyLevel incorrect * return when count or countvariable not provided, or consistencyLevel incorrect * fix version for autorest/powershell dev and autorest/core * upgrade autorest.powershell version reference
1 parent 59be43c commit 9ce4e03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+7726
-1138
lines changed

src/Resources/MSGraph.Autorest/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ In this directory, run AutoRest:
4747
> see https://aka.ms/autorest
4848
4949
``` yaml
50+
version: "3.9.5"
51+
use-extension:
52+
"@autorest/powershell": "4.0.0-dev.10"
53+
5054
require:
5155
- $(this-folder)/../../readme.azure.noprofile.md
5256

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

7075
# Disable default settings and Set in to empty for msgraph
7176
default-exclude-tableview-properties: false
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
6+
namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
7+
{
8+
using global::System.Management.Automation;
9+
10+
public partial class GetAzADApplication_List
11+
{
12+
private bool _isPolling = false;
13+
// <summary>Backing field for <see cref="CountVariable" /> property.</summary>
14+
private string _countVariable;
15+
16+
/// <summary>Specifies a count of the total number of items in a collection. </summary>
17+
[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.")]
18+
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
19+
Required = false,
20+
ReadOnly = false,
21+
Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
22+
PossibleTypes = new[] { typeof(string) })]
23+
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
24+
public string CountVariable { get => this._countVariable; set => this._countVariable = value; }
25+
26+
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)
27+
{
28+
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))
29+
{
30+
return;
31+
}
32+
SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
33+
_isPolling = true;
34+
}
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
6+
namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
7+
{
8+
using System.Management.Automation;
9+
10+
public partial class GetAzADGroup_List
11+
{
12+
private bool _isPolling = false;
13+
// <summary>Backing field for <see cref="CountVariable" /> property.</summary>
14+
private string _countVariable;
15+
16+
/// <summary>Specifies a count of the total number of items in a collection. </summary>
17+
[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.")]
18+
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
19+
Required = false,
20+
ReadOnly = false,
21+
Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
22+
PossibleTypes = new[] { typeof(string) })]
23+
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
24+
public string CountVariable { get => this._countVariable; set => this._countVariable = value; }
25+
26+
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)
27+
{
28+
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))
29+
{
30+
return;
31+
}
32+
SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
33+
_isPolling = true;
34+
}
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
6+
namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
7+
{
8+
using System.Management.Automation;
9+
10+
public partial class GetAzADServicePrincipal_List
11+
{
12+
private bool _isPolling = false;
13+
// <summary>Backing field for <see cref="CountVariable" /> property.</summary>
14+
private string _countVariable;
15+
16+
/// <summary>Specifies a count of the total number of items in a collection. </summary>
17+
[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.")]
18+
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
19+
Required = false,
20+
ReadOnly = false,
21+
Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
22+
PossibleTypes = new[] { typeof(string) })]
23+
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
24+
public string CountVariable { get => this._countVariable; set => this._countVariable = value; }
25+
26+
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)
27+
{
28+
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))
29+
{
30+
return;
31+
}
32+
SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
33+
_isPolling = true;
34+
}
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
5+
6+
namespace Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Cmdlets
7+
{
8+
using System.Management.Automation;
9+
10+
public partial class GetAzADUser_List
11+
{
12+
private bool _isPolling = false;
13+
// <summary>Backing field for <see cref="CountVariable" /> property.</summary>
14+
private string _countVariable;
15+
16+
/// <summary>Specifies a count of the total number of items in a collection. </summary>
17+
[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.")]
18+
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Runtime.Info(
19+
Required = false,
20+
ReadOnly = false,
21+
Description = @"Specifies a count of the total number of items in a collection. By default, this variable will be set in the global scope.",
22+
PossibleTypes = new[] { typeof(string) })]
23+
[global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.ParameterCategory.Runtime)]
24+
public string CountVariable { get => this._countVariable; set => this._countVariable = value; }
25+
26+
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)
27+
{
28+
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))
29+
{
30+
return;
31+
}
32+
SessionState.PSVariable.Set(new PSVariable(CountVariable.Contains(":") ? CountVariable : $"global:{CountVariable}", response.Result.OdataCount));
33+
_isPolling = true;
34+
}
35+
}
36+
}

src/Resources/MSGraph.Autorest/custom/Get-AzADApplication.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ param(
121121
[System.Management.Automation.SwitchParameter]
122122
${AppendSelected},
123123

124+
[Parameter(ParameterSetName='EmptyParameterSet')]
125+
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')]
126+
[System.String]
127+
# Specifies a count of the total number of items in a collection.
128+
# By default, this variable will be set in the global scope.
129+
${CountVariable},
130+
124131
[Parameter()]
125132
[Alias("AzContext", "AzureRmContext", "AzureCredential")]
126133
[ValidateNotNull()]

src/Resources/MSGraph.Autorest/custom/Get-AzADGroup.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ function Get-AzADGroup {
100100
[System.Management.Automation.SwitchParameter]
101101
${AppendSelected},
102102

103+
[Parameter(ParameterSetName='EmptyParameterSet')]
104+
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')]
105+
[System.String]
106+
# Specifies a count of the total number of items in a collection.
107+
# By default, this variable will be set in the global scope.
108+
${CountVariable},
109+
103110
[Parameter()]
104111
[Alias("AzContext", "AzureRmContext", "AzureCredential")]
105112
[ValidateNotNull()]

src/Resources/MSGraph.Autorest/custom/Get-AzADServicePrincipal.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ param(
121121
[System.Management.Automation.SwitchParameter]
122122
${AppendSelected},
123123

124+
[Parameter(ParameterSetName='EmptyParameterSet')]
125+
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')]
126+
[System.String]
127+
# Specifies a count of the total number of items in a collection.
128+
# By default, this variable will be set in the global scope.
129+
${CountVariable},
130+
124131
[Parameter()]
125132
[Alias("AzContext", "AzureRmContext", "AzureCredential")]
126133
[ValidateNotNull()]

src/Resources/MSGraph.Autorest/custom/Get-AzADUser.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ function Get-AzADUser {
9595
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
9696
[System.Management.Automation.SwitchParameter]
9797
${AppendSelected},
98+
99+
[Parameter(ParameterSetName='List')]
100+
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Runtime')]
101+
[System.String]
102+
# Specifies a count of the total number of items in a collection.
103+
# By default, this variable will be set in the global scope.
104+
${CountVariable},
98105

99106
[Parameter(ParameterSetName='List')]
100107
[System.String]

src/Resources/MSGraph.Autorest/custom/model/MicrosoftGraphApplication.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Resources/MSGraph.Autorest/custom/model/MicrosoftGraphGroup.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Resources/MSGraph.Autorest/custom/model/MicrosoftGraphServicePrincipal.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Resources/MSGraph.Autorest/custom/model/MicrosoftGraphUser.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)