Skip to content

Commit

Permalink
Merge pull request #2604 from microsoftgraph/2600-urgent-make-respons…
Browse files Browse the repository at this point in the history
…e-headers-optional

Adds an optional ``-RHV`` parameter that will assign response headers to a variable (Value provided to the optional RHV parameter)
  • Loading branch information
timayabi2020 authored Feb 21, 2024
2 parents 2917216 + 957ea92 commit 2979bd7
Show file tree
Hide file tree
Showing 18 changed files with 258 additions and 5 deletions.
17 changes: 16 additions & 1 deletion src/Groups/beta/custom/NewMgBetaGroupMember_Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public partial class NewMgBetaGroupMember_Create : System.Management.Automation.PSCmdlet,
Runtime.IEventListener
{

/// <summary>A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet)</summary>
private System.Management.Automation.InvocationInfo __invocationInfo;

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

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
private string _groupId;

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

Expand Down
15 changes: 15 additions & 0 deletions src/Groups/beta/custom/NewMgBetaGroupMember_CreateExpanded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public partial class NewMgBetaGroupMember_CreateExpanded : System.Management.Aut
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
private string _groupId;

Expand Down Expand Up @@ -357,6 +365,13 @@ protected override void StopProcessing()
{
WriteObject(true);
}
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
{
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
var vi = this.SessionState.PSVariable;
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
}
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentity : System.Management.
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
[System.Management.Automation.ValidateNotNull]
Expand Down Expand Up @@ -355,6 +363,13 @@ protected override void StopProcessing()
{
WriteObject(true);
}
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
{
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
var vi = this.SessionState.PSVariable;
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentityExpanded : System.Man
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
[System.Management.Automation.ValidateNotNull]
Expand Down Expand Up @@ -356,6 +364,13 @@ protected override void StopProcessing()
{
WriteObject(true);
}
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
{
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
var vi = this.SessionState.PSVariable;
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
}
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/Groups/beta/custom/NewMgBetaGroupOwner_Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ public partial class NewMgBetaGroupOwner_Create : System.Management.Automation.P
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
private string _groupId;

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

Expand Down
15 changes: 15 additions & 0 deletions src/Groups/beta/custom/NewMgBetaGroupOwner_CreateExpanded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public partial class NewMgBetaGroupOwner_CreateExpanded : System.Management.Auto
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
private string _groupId;

Expand Down Expand Up @@ -357,6 +365,13 @@ protected override void StopProcessing()
{
WriteObject(true);
}
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
{
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
var vi = this.SessionState.PSVariable;
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
}
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ public partial class NewMgBetaGroupOwner_CreateViaIdentity : System.Management.A
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
[System.Management.Automation.ValidateNotNull]
Expand Down Expand Up @@ -355,6 +363,13 @@ protected override void StopProcessing()
{
WriteObject(true);
}
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
{
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
var vi = this.SessionState.PSVariable;
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ public partial class NewMgBetaGroupOwner_CreateViaIdentityExpanded : System.Mana
[System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional headers that will be added to the request.", ValueFromPipeline = true)]
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }


// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>SendAsync Pipeline Steps to be appended to the front of the pipeline</summary>
[System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")]
[System.Management.Automation.ValidateNotNull]
Expand Down Expand Up @@ -270,7 +278,7 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync()
ThrowTerminatingError(new System.Management.Automation.ErrorRecord(new System.Exception("InputObject has null value for InputObject.GroupId"), string.Empty, System.Management.Automation.ErrorCategory.InvalidArgument, InputObject));
}
_bodyParameter.OdataId = $"https://graph.microsoft.com/beta/directoryObjects/{DirectoryObjectId}";
await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId ?? null,Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline);
await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId ?? null, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline);
await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; }
}
catch (Runtime.UndeclaredResponseException urexception)
Expand Down Expand Up @@ -356,6 +364,13 @@ protected override void StopProcessing()
{
WriteObject(true);
}
// get the headers from the response and assign it to the variable provided by the user via the RHV(ResponseHeadersVariable) parameter.
if (!string.IsNullOrEmpty(ResponseHeadersVariable))
{
var headers = Microsoft.Graph.PowerShell.ResponseHeaders.Helpers.ResponseHeaderHelper.GetHttpResponseHeaders(responseMessage);
var vi = this.SessionState.PSVariable;
vi.Set(new System.Management.Automation.PSVariable($"global:{ResponseHeadersVariable}", headers));
}
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/Groups/v1.0/custom/NewMgGroupMember_Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ public partial class NewMgGroupMember_Create : System.Management.Automation.PSCm
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

/// <summary>Backing field for <see cref="GroupId" /> property.</summary>
private string _groupId;

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

Expand Down
14 changes: 14 additions & 0 deletions src/Groups/v1.0/custom/NewMgGroupMember_CreateExpanded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public partial class NewMgGroupMember_CreateExpanded : System.Management.Automat
[Category(ParameterCategory.Runtime)]
public System.Collections.IDictionary Headers { get => this._headers; set => this._headers = value; }

// <summary>Backing field for <see cref="ResponseHeadersVariable" /> property.</summary>
private string _responseHeadersVariable;

/// <summary>Optional Response Headers Variable</summary>
[global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Optional Response Headers Variable.")]
[global::System.Management.Automation.Alias("RHV")]
public string ResponseHeadersVariable { get => this._responseHeadersVariable; set => this._responseHeadersVariable = value; }

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

0 comments on commit 2979bd7

Please sign in to comment.