Skip to content

Commit b30020f

Browse files
committed
Added custom header parameter to custom cmdlets in groups module
1 parent 3ba226d commit b30020f

8 files changed

+91
-16
lines changed

src/Groups/v1.0/custom/NewMgGroupMember_Create.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ public partial class NewMgGroupMember_Create : System.Management.Automation.PSCm
4343
/// <summary>The reference to the client API class.</summary>
4444
public Groups Client => Module.Instance.ClientAPI;
4545

46+
/// <summary>Backing field for <see cref="CustomHeader" /> property.</summary>
47+
private string _customHeader;
48+
49+
/// <summary>
50+
/// CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs
51+
/// </summary>
52+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs", ValueFromPipeline = true)]
53+
[global::Sample.API.Category(global::Sample.API.ParameterCategory.Runtime)]
54+
public string CustomHeader { get => this._customHeader; set => this._customHeader = value; }
55+
4656
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
4757
private string _groupId;
4858

@@ -261,12 +271,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
261271
try
262272
{
263273
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
264-
await this.Client.GroupCreateMemberGraphBPreRef(GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline);
274+
await this.Client.GroupCreateMemberGraphBPreRef(GroupId, CustomHeader, BodyParameter, onNoContent, onDefault, this, Pipeline);
265275
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
266276
}
267277
catch (Microsoft.Graph.PowerShell.Runtime.UndeclaredResponseException urexception)
268278
{
269-
WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = BodyParameter })
279+
WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, CustomHeader=CustomHeader, body = BodyParameter })
270280
{
271281
ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
272282
});

src/Groups/v1.0/custom/NewMgGroupMember_CreateExpanded.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ public partial class NewMgGroupMember_CreateExpanded : System.Management.Automat
3232

3333
/// <summary>The reference to the client API class.</summary>
3434
public Groups Client => Module.Instance.ClientAPI;
35+
36+
/// <summary>Backing field for <see cref="CustomHeader" /> property.</summary>
37+
private string _customHeader;
38+
39+
/// <summary>
40+
/// CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs
41+
/// </summary>
42+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs", ValueFromPipeline = true)]
43+
[global::Sample.API.Category(global::Sample.API.ParameterCategory.Runtime)]
44+
public string CustomHeader { get => this._customHeader; set => this._customHeader = value; }
45+
3546

3647
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
3748
private string _groupId;
@@ -263,12 +274,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
263274
{
264275
await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
265276
_bodyParameter.OdataId = $"https://graph.microsoft.com/v1.0/directoryObjects/{DirectoryObjectId}";
266-
await this.Client.GroupCreateMemberGraphBPreRef(GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline);
277+
await this.Client.GroupCreateMemberGraphBPreRef(GroupId, CustomHeader, _bodyParameter, onNoContent, onDefault, this, Pipeline);
267278
await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.PowerShell.Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
268279
}
269280
catch (Runtime.UndeclaredResponseException urexception)
270281
{
271-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = _bodyParameter })
282+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, CustomHeader=CustomHeader, body = _bodyParameter })
272283
{
273284
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
274285
});

src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentity.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ public partial class NewMgGroupMember_CreateViaIdentity : System.Management.Auto
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="CustomHeader" /> property.</summary>
48+
private string _customHeader;
49+
50+
/// <summary>
51+
/// CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs
52+
/// </summary>
53+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs", ValueFromPipeline = true)]
54+
[global::Sample.API.Category(global::Sample.API.ParameterCategory.Runtime)]
55+
public string CustomHeader { get => this._customHeader; set => this._customHeader = value; }
4756
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
4857
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
4958
[System.Management.Automation.ValidateNotNull]
@@ -261,12 +270,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
261270
{
262271
ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new System.Exception("InputObject has null value for InputObject.GroupId"), string.Empty, System.Management.Automation.ErrorCategory.InvalidArgument, InputObject));
263272
}
264-
await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline);
273+
await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, CustomHeader, BodyParameter, onNoContent, onDefault, this, Pipeline);
265274
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
266275
}
267276
catch (Runtime.UndeclaredResponseException urexception)
268277
{
269-
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 { CustomHeader = CustomHeader, body = BodyParameter })
270279
{
271280
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
272281
});

src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentityExpanded.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ public partial class NewMgGroupMember_CreateViaIdentityExpanded : System.Managem
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="CustomHeader" /> property.</summary>
37+
private string _customHeader;
38+
39+
/// <summary>
40+
/// CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs
41+
/// </summary>
42+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs", ValueFromPipeline = true)]
43+
[global::Sample.API.Category(global::Sample.API.ParameterCategory.Runtime)]
44+
public string CustomHeader { get => this._customHeader; set => this._customHeader = value; }
3645
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
3746
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
3847
[System.Management.Automation.ValidateNotNull]
@@ -262,12 +271,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
262271
ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new System.Exception("InputObject has null value for InputObject.GroupId"), string.Empty, System.Management.Automation.ErrorCategory.InvalidArgument, InputObject));
263272
}
264273
_bodyParameter.OdataId = $"https://graph.microsoft.com/v1.0/directoryObjects/{DirectoryObjectId}";
265-
await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline);
274+
await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, CustomHeader, _bodyParameter, onNoContent, onDefault, this, Pipeline);
266275
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
267276
}
268277
catch (Runtime.UndeclaredResponseException urexception)
269278
{
270-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = _bodyParameter })
279+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { CustomHeader = CustomHeader, body = _bodyParameter })
271280
{
272281
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
273282
});

src/Groups/v1.0/custom/NewMgGroupOwner_Create.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ public partial class NewMgGroupOwner_Create : System.Management.Automation.PSCmd
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="CustomHeader" /> property.</summary>
46+
private string _customHeader;
47+
48+
/// <summary>
49+
/// CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs
50+
/// </summary>
51+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs", ValueFromPipeline = true)]
52+
[global::Sample.API.Category(global::Sample.API.ParameterCategory.Runtime)]
53+
public string CustomHeader { get => this._customHeader; set => this._customHeader = value; }
4554
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
4655
private string _groupId;
4756

@@ -260,12 +269,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
260269
try
261270
{
262271
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);
272+
await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, CustomHeader, BodyParameter, onNoContent, onDefault, this, Pipeline);
264273
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
265274
}
266275
catch (Runtime.UndeclaredResponseException urexception)
267276
{
268-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = BodyParameter })
277+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, CustomHeader = CustomHeader, body = BodyParameter })
269278
{
270279
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
271280
});

src/Groups/v1.0/custom/NewMgGroupOwner_CreateExpanded.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ public partial class NewMgGroupOwner_CreateExpanded : System.Management.Automati
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="CustomHeader" /> property.</summary>
37+
private string _customHeader;
38+
39+
/// <summary>
40+
/// CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs
41+
/// </summary>
42+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs", ValueFromPipeline = true)]
43+
[global::Sample.API.Category(global::Sample.API.ParameterCategory.Runtime)]
44+
public string CustomHeader { get => this._customHeader; set => this._customHeader = value; }
3645
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
3746
private string _groupId;
3847

@@ -263,12 +272,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
263272
{
264273
await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
265274
_bodyParameter.OdataId = $"https://graph.microsoft.com/v1.0/directoryObjects/{DirectoryObjectId}";
266-
await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline);
275+
await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, CustomHeader, _bodyParameter, onNoContent, onDefault, this, Pipeline);
267276
await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.PowerShell.Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
268277
}
269278
catch (Runtime.UndeclaredResponseException urexception)
270279
{
271-
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = _bodyParameter })
280+
WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, CustomHeader = CustomHeader, body = _bodyParameter })
272281
{
273282
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
274283
});

src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentity.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ public partial class NewMgGroupOwner_CreateViaIdentity : System.Management.Autom
4141
[Category(ParameterCategory.Runtime)]
4242
public System.Management.Automation.SwitchParameter Break { get; set; }
4343

44+
/// <summary>Backing field for <see cref="CustomHeader" /> property.</summary>
45+
private string _customHeader;
46+
47+
/// <summary>
48+
/// CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs
49+
/// </summary>
50+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "CustomHeader Parameter. This should have a key:value and comma separated for multiple key:value pairs", ValueFromPipeline = true)]
51+
[global::Sample.API.Category(global::Sample.API.ParameterCategory.Runtime)]
52+
public string CustomHeader { get => this._customHeader; set => this._customHeader = value; }
4453
/// <summary>The reference to the client API class.</summary>
4554
public Groups Client => Module.Instance.ClientAPI;
4655

@@ -261,12 +270,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
261270
{
262271
ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new System.Exception("InputObject has null value for InputObject.GroupId"), string.Empty, System.Management.Automation.ErrorCategory.InvalidArgument, InputObject));
263272
}
264-
await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline);
273+
await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId, CustomHeader, BodyParameter, onNoContent, onDefault, this, Pipeline);
265274
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
266275
}
267276
catch (Runtime.UndeclaredResponseException urexception)
268277
{
269-
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 { CustomHeader = CustomHeader, body = BodyParameter })
270279
{
271280
ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action }
272281
});

0 commit comments

Comments
 (0)