Skip to content

Commit 162c5c8

Browse files
authored
Merge pull request #2542 from microsoftgraph/powershell-local-autorest
Generate cmdlets from forked AutoREST.PowerShell repository.
2 parents 614d390 + fa560fd commit 162c5c8

23 files changed

+180
-35
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
displayName: Microsoft Graph PowerShell SDK CI Build
3939
timeoutInMinutes: 840
4040
steps:
41+
- script: |
42+
git submodule update --init --recursive
4143
- template: ./common-templates/install-tools.yml
4244
- template: ./common-templates/security-pre-checks.yml
4345

.azure-pipelines/common-templates/checkout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ steps:
1010
- checkout: self
1111
clean: true
1212
fetchDepth: 1
13-
submodules: true
13+
submodules: recursive
1414
persistCredentials: true
1515

1616
- task: PowerShell@2

.azure-pipelines/common-templates/install-tools.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ steps:
3030
displayName: Install NodeJs
3131
inputs:
3232
versionSpec: 16.x
33-
33+
3434
- task: Npm@1
3535
displayName: Install AutoRest
3636
inputs:
3737
command: custom
3838
customCommand: install -g autorest@latest
3939

40+
- task: Npm@1
41+
displayName: Install Rush
42+
inputs:
43+
command: custom
44+
customCommand: install -g @microsoft/rush
45+

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "autorest.powershell"]
2+
path = autorest.powershell
3+
url = https://github.com/microsoftgraph/autorest.powershell
4+
branch = powershell-v2

autorest.powershell

Submodule autorest.powershell added at 58766ba

src/Groups/beta/custom/NewMgBetaGroupMember_Create.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ public partial class NewMgBetaGroupMember_Create : System.Management.Automation.
4343

4444
/// <summary>The reference to the client API class.</summary>
4545
public Groups Client => Module.Instance.ClientAPI;
46+
/// <summary>Backing field for <see cref="Headers" /> property.</summary>
47+
private System.Collections.IDictionary _headers;
48+
49+
/// <summary>Optional headers that will be added to the request.</summary>
50+
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
51+
[Category(ParameterCategory.Runtime)]
52+
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
4653

4754
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
4855
private string _groupId;
@@ -262,12 +269,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
262269
try
263270
{
264271
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
265-
await this.Client.GroupCreateMemberGraphBPreRef(GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline);
272+
await this.Client.GroupCreateMemberGraphBPreRef(GroupId, Headers, BodyParameter, onNoContent, onDefault, this, Pipeline);
266273
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
267274
}
268275
catch (Microsoft.Graph.Beta.PowerShell.Runtime.UndeclaredResponseException urexception)
269276
{
270-
WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = BodyParameter })
277+
WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = BodyParameter })
271278
{
272279
ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
273280
});

src/Groups/beta/custom/NewMgBetaGroupMember_CreateExpanded.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ public partial class NewMgBetaGroupMember_CreateExpanded : System.Management.Aut
3333
/// <summary>The reference to the client API class.</summary>
3434
public Groups Client => Module.Instance.ClientAPI;
3535

36+
/// <summary>Backing field for <see cref="Headers" /> property.</summary>
37+
private System.Collections.IDictionary _headers;
38+
39+
/// <summary>Optional headers that will be added to the request.</summary>
40+
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
41+
[Category(ParameterCategory.Runtime)]
42+
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
43+
3644
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
3745
private string _groupId;
3846

@@ -263,12 +271,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
263271
{
264272
await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
265273
_bodyParameter.OdataId = $"https://graph.microsoft.com/beta/directoryObjects/{DirectoryObjectId}";
266-
await this.Client.GroupCreateMemberGraphBPreRef(GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline);
274+
await this.Client.GroupCreateMemberGraphBPreRef(GroupId, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline);
267275
await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
268276
}
269277
catch (Runtime.UndeclaredResponseException urexception)
270278
{
271-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = _bodyParameter })
279+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = _bodyParameter })
272280
{
273281
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
274282
});

src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentity.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentity : System.Management.
4444
/// <summary>The reference to the client API class.</summary>
4545
public Groups Client => Module.Instance.ClientAPI;
4646

47+
/// <summary>Backing field for <see cref="Headers" /> property.</summary>
48+
private System.Collections.IDictionary _headers;
49+
50+
/// <summary>Optional headers that will be added to the request.</summary>
51+
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
52+
[Category(ParameterCategory.Runtime)]
53+
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
54+
4755
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
4856
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
4957
[System.Management.Automation.ValidateNotNull]
@@ -261,12 +269,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
261269
{
262270
ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new System.Exception("InputObject has null value for InputObject.GroupId"), string.Empty, System.Management.Automation.ErrorCategory.InvalidArgument, InputObject));
263271
}
264-
await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline);
272+
await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, Headers, BodyParameter, onNoContent, onDefault, this, Pipeline);
265273
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
266274
}
267275
catch (Runtime.UndeclaredResponseException urexception)
268276
{
269-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = BodyParameter })
277+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = BodyParameter })
270278
{
271279
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
272280
});

src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentityExpanded.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentityExpanded : System.Man
3333
/// <summary>The reference to the client API class.</summary>
3434
public Groups Client => Module.Instance.ClientAPI;
3535

36+
/// <summary>Backing field for <see cref="Headers" /> property.</summary>
37+
private System.Collections.IDictionary _headers;
38+
39+
/// <summary>Optional headers that will be added to the request.</summary>
40+
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
41+
[Category(ParameterCategory.Runtime)]
42+
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
43+
3644
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
3745
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
3846
[System.Management.Automation.ValidateNotNull]
@@ -262,12 +270,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
262270
ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new System.Exception("InputObject has null value for InputObject.GroupId"), string.Empty, System.Management.Automation.ErrorCategory.InvalidArgument, InputObject));
263271
}
264272
_bodyParameter.OdataId = $"https://graph.microsoft.com/beta/directoryObjects/{DirectoryObjectId}";
265-
await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline);
273+
await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline);
266274
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
267275
}
268276
catch (Runtime.UndeclaredResponseException urexception)
269277
{
270-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = _bodyParameter })
278+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = _bodyParameter })
271279
{
272280
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
273281
});

src/Groups/beta/custom/NewMgBetaGroupOwner_Create.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ public partial class NewMgBetaGroupOwner_Create : System.Management.Automation.P
4242
/// <summary>The reference to the client API class.</summary>
4343
public Groups Client => Module.Instance.ClientAPI;
4444

45+
/// <summary>Backing field for <see cref="Headers" /> property.</summary>
46+
private System.Collections.IDictionary _headers;
47+
48+
/// <summary>Optional headers that will be added to the request.</summary>
49+
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
50+
[Category(ParameterCategory.Runtime)]
51+
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
52+
4553
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
4654
private string _groupId;
4755

@@ -260,12 +268,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
260268
try
261269
{
262270
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
263-
await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline);
271+
await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, Headers, BodyParameter, onNoContent, onDefault, this, Pipeline);
264272
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
265273
}
266274
catch (Runtime.UndeclaredResponseException urexception)
267275
{
268-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = BodyParameter })
276+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = BodyParameter })
269277
{
270278
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
271279
});

src/Groups/beta/custom/NewMgBetaGroupOwner_CreateExpanded.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ public partial class NewMgBetaGroupOwner_CreateExpanded : System.Management.Auto
3333
/// <summary>The reference to the client API class.</summary>
3434
public Groups Client => Module.Instance.ClientAPI;
3535

36+
/// <summary>Backing field for <see cref="Headers" /> property.</summary>
37+
private System.Collections.IDictionary _headers;
38+
39+
/// <summary>Optional headers that will be added to the request.</summary>
40+
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
41+
[Category(ParameterCategory.Runtime)]
42+
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
43+
3644
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
3745
private string _groupId;
3846

@@ -263,12 +271,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
263271
{
264272
await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
265273
_bodyParameter.OdataId = $"https://graph.microsoft.com/beta/directoryObjects/{DirectoryObjectId}";
266-
await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline);
274+
await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline);
267275
await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
268276
}
269277
catch (Runtime.UndeclaredResponseException urexception)
270278
{
271-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = _bodyParameter })
279+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = _bodyParameter })
272280
{
273281
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
274282
});

src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentity.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ public partial class NewMgBetaGroupOwner_CreateViaIdentity : System.Management.A
4444
/// <summary>The reference to the client API class.</summary>
4545
public Groups Client => Module.Instance.ClientAPI;
4646

47+
/// <summary>Backing field for <see cref="Headers" /> property.</summary>
48+
private System.Collections.IDictionary _headers;
49+
50+
/// <summary>Optional headers that will be added to the request.</summary>
51+
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
52+
[Category(ParameterCategory.Runtime)]
53+
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
54+
4755
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
4856
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
4957
[System.Management.Automation.ValidateNotNull]
@@ -261,12 +269,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
261269
{
262270
ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new System.Exception("InputObject has null value for InputObject.GroupId"), string.Empty, System.Management.Automation.ErrorCategory.InvalidArgument, InputObject));
263271
}
264-
await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline);
272+
await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId, Headers, BodyParameter, onNoContent, onDefault, this, Pipeline);
265273
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
266274
}
267275
catch (Runtime.UndeclaredResponseException urexception)
268276
{
269-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = BodyParameter })
277+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = BodyParameter })
270278
{
271279
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
272280
});

0 commit comments

Comments
 (0)