Skip to content

Commit 2979bd7

Browse files
authored
Merge pull request #2604 from microsoftgraph/2600-urgent-make-response-headers-optional
Adds an optional ``-RHV`` parameter that will assign response headers to a variable (Value provided to the optional RHV parameter)
2 parents 2917216 + 957ea92 commit 2979bd7

18 files changed

+258
-5
lines changed

src/Groups/beta/custom/NewMgBetaGroupMember_Create.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
public partial class NewMgBetaGroupMember_Create : System.Management.Automation.PSCmdlet,
1414
Runtime.IEventListener
1515
{
16-
16+
1717
/// <summary>A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet)</summary>
1818
private System.Management.Automation.InvocationInfo __invocationInfo;
1919

@@ -51,6 +51,14 @@ public partial class NewMgBetaGroupMember_Create : System.Management.Automation.
5151
[Category(ParameterCategory.Runtime)]
5252
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
5353

54+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
55+
private string _responseHeadersVariable;
56+
57+
/// <summary>Optional Response Headers Variable</summary>
58+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
59+
[global::System.Management.Automation.Alias("RHV")]
60+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
61+
5462
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
5563
private string _groupId;
5664

@@ -314,6 +322,13 @@ protected override void StopProcessing()
314322
{
315323
WriteObject(true);
316324
}
325+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
326+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
327+
{
328+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
329+
var vi = this.SessionState.PSVariable;
330+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
331+
}
317332
}
318333
}
319334

src/Groups/beta/custom/NewMgBetaGroupMember_CreateExpanded.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public partial class NewMgBetaGroupMember_CreateExpanded : System.Management.Aut
4141
[Category(ParameterCategory.Runtime)]
4242
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
4343

44+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
45+
private string _responseHeadersVariable;
46+
47+
/// <summary>Optional Response Headers Variable</summary>
48+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
49+
[global::System.Management.Automation.Alias("RHV")]
50+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
51+
4452
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
4553
private string _groupId;
4654

@@ -357,6 +365,13 @@ protected override void StopProcessing()
357365
{
358366
WriteObject(true);
359367
}
368+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
369+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
370+
{
371+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
372+
var vi = this.SessionState.PSVariable;
373+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
374+
}
360375
}
361376
}
362377
}

src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentity.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentity : System.Management.
5252
[Category(ParameterCategory.Runtime)]
5353
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
5454

55+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
56+
private string _responseHeadersVariable;
57+
58+
/// <summary>Optional Response Headers Variable</summary>
59+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
60+
[global::System.Management.Automation.Alias("RHV")]
61+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
62+
5563
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
5664
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
5765
[System.Management.Automation.ValidateNotNull]
@@ -355,6 +363,13 @@ protected override void StopProcessing()
355363
{
356364
WriteObject(true);
357365
}
366+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
367+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
368+
{
369+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
370+
var vi = this.SessionState.PSVariable;
371+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
372+
}
358373
}
359374
}
360375
}

src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentityExpanded.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentityExpanded : System.Man
4141
[Category(ParameterCategory.Runtime)]
4242
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
4343

44+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
45+
private string _responseHeadersVariable;
46+
47+
/// <summary>Optional Response Headers Variable</summary>
48+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
49+
[global::System.Management.Automation.Alias("RHV")]
50+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
51+
4452
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
4553
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
4654
[System.Management.Automation.ValidateNotNull]
@@ -356,6 +364,13 @@ protected override void StopProcessing()
356364
{
357365
WriteObject(true);
358366
}
367+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
368+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
369+
{
370+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
371+
var vi = this.SessionState.PSVariable;
372+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
373+
}
359374
}
360375
}
361376
}

src/Groups/beta/custom/NewMgBetaGroupOwner_Create.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ public partial class NewMgBetaGroupOwner_Create : System.Management.Automation.P
5050
[Category(ParameterCategory.Runtime)]
5151
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
5252

53+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
54+
private string _responseHeadersVariable;
55+
56+
/// <summary>Optional Response Headers Variable</summary>
57+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
58+
[global::System.Management.Automation.Alias("RHV")]
59+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
60+
5361
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
5462
private string _groupId;
5563

@@ -312,6 +320,13 @@ protected override void StopProcessing()
312320
{
313321
WriteObject(true);
314322
}
323+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
324+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
325+
{
326+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
327+
var vi = this.SessionState.PSVariable;
328+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
329+
}
315330
}
316331
}
317332

src/Groups/beta/custom/NewMgBetaGroupOwner_CreateExpanded.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ public partial class NewMgBetaGroupOwner_CreateExpanded : System.Management.Auto
4141
[Category(ParameterCategory.Runtime)]
4242
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
4343

44+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
45+
private string _responseHeadersVariable;
46+
47+
/// <summary>Optional Response Headers Variable</summary>
48+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
49+
[global::System.Management.Automation.Alias("RHV")]
50+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
51+
4452
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
4553
private string _groupId;
4654

@@ -357,6 +365,13 @@ protected override void StopProcessing()
357365
{
358366
WriteObject(true);
359367
}
368+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
369+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
370+
{
371+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
372+
var vi = this.SessionState.PSVariable;
373+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
374+
}
360375
}
361376
}
362377
}

src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentity.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ public partial class NewMgBetaGroupOwner_CreateViaIdentity : System.Management.A
5252
[Category(ParameterCategory.Runtime)]
5353
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
5454

55+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
56+
private string _responseHeadersVariable;
57+
58+
/// <summary>Optional Response Headers Variable</summary>
59+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
60+
[global::System.Management.Automation.Alias("RHV")]
61+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
62+
5563
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
5664
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
5765
[System.Management.Automation.ValidateNotNull]
@@ -355,6 +363,13 @@ protected override void StopProcessing()
355363
{
356364
WriteObject(true);
357365
}
366+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
367+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
368+
{
369+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
370+
var vi = this.SessionState.PSVariable;
371+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
372+
}
358373
}
359374
}
360375
}

src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentityExpanded.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@ public partial class NewMgBetaGroupOwner_CreateViaIdentityExpanded : System.Mana
4040
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
4141
[Category(ParameterCategory.Runtime)]
4242
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
43-
43+
44+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
45+
private string _responseHeadersVariable;
46+
47+
/// <summary>Optional Response Headers Variable</summary>
48+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
49+
[global::System.Management.Automation.Alias("RHV")]
50+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
51+
4452
/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
4553
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
4654
[System.Management.Automation.ValidateNotNull]
@@ -270,7 +278,7 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
270278
ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new System.Exception("InputObject has null value for InputObject.GroupId"), string.Empty, System.Management.Automation.ErrorCategory.InvalidArgument, InputObject));
271279
}
272280
_bodyParameter.OdataId = $"https://graph.microsoft.com/beta/directoryObjects/{DirectoryObjectId}";
273-
await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId ?? null,Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline);
281+
await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId ?? null, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline);
274282
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
275283
}
276284
catch (Runtime.UndeclaredResponseException urexception)
@@ -356,6 +364,13 @@ protected override void StopProcessing()
356364
{
357365
WriteObject(true);
358366
}
367+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
368+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
369+
{
370+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
371+
var vi = this.SessionState.PSVariable;
372+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
373+
}
359374
}
360375
}
361376
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ public partial class NewMgGroupMember_Create : System.Management.Automation.PSCm
5151
[Category(ParameterCategory.Runtime)]
5252
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
5353

54+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
55+
private string _responseHeadersVariable;
56+
57+
/// <summary>Optional Response Headers Variable</summary>
58+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
59+
[global::System.Management.Automation.Alias("RHV")]
60+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
61+
5462
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
5563
private string _groupId;
5664

@@ -314,6 +322,13 @@ protected override void StopProcessing()
314322
{
315323
WriteObject(true);
316324
}
325+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
326+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
327+
{
328+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
329+
var vi = this.SessionState.PSVariable;
330+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
331+
}
317332
}
318333
}
319334

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public partial class NewMgGroupMember_CreateExpanded : System.Management.Automat
4141
[Category(ParameterCategory.Runtime)]
4242
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }
4343

44+
// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
45+
private string _responseHeadersVariable;
46+
47+
/// <summary>Optional Response Headers Variable</summary>
48+
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
49+
[global::System.Management.Automation.Alias("RHV")]
50+
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }
4451

4552
/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
4653
private string _groupId;
@@ -358,6 +365,13 @@ protected override void StopProcessing()
358365
{
359366
WriteObject(true);
360367
}
368+
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
369+
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
370+
{
371+
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
372+
var vi = this.SessionState.PSVariable;
373+
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
374+
}
361375
}
362376
}
363377
}

0 commit comments

Comments
 (0)