diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 7e2227a8994..ec2655f7af7 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -38,6 +38,8 @@ jobs: displayName: Microsoft Graph PowerShell SDK CI Build timeoutInMinutes: 840 steps: + - script: | + git submodule update --init --recursive - template: ./common-templates/install-tools.yml - template: ./common-templates/security-pre-checks.yml diff --git a/.azure-pipelines/common-templates/checkout.yml b/.azure-pipelines/common-templates/checkout.yml index e011ebbcd60..13e6fdbc475 100644 --- a/.azure-pipelines/common-templates/checkout.yml +++ b/.azure-pipelines/common-templates/checkout.yml @@ -10,7 +10,7 @@ steps: - checkout: self clean: true fetchDepth: 1 - submodules: true + submodules: recursive persistCredentials: true - task: PowerShell@2 diff --git a/.azure-pipelines/common-templates/install-tools.yml b/.azure-pipelines/common-templates/install-tools.yml index c0cf80b922d..4e4dbfa13a4 100644 --- a/.azure-pipelines/common-templates/install-tools.yml +++ b/.azure-pipelines/common-templates/install-tools.yml @@ -30,10 +30,16 @@ steps: displayName: Install NodeJs inputs: versionSpec: 16.x - + - task: Npm@1 displayName: Install AutoRest inputs: command: custom customCommand: install -g autorest@latest + - task: Npm@1 + displayName: Install Rush + inputs: + command: custom + customCommand: install -g @microsoft/rush + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..d8e372a2f55 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "autorest.powershell"] + path = autorest.powershell + url = https://github.com/microsoftgraph/autorest.powershell + branch = powershell-v2 diff --git a/autorest.powershell b/autorest.powershell new file mode 160000 index 00000000000..58766ba7b5d --- /dev/null +++ b/autorest.powershell @@ -0,0 +1 @@ +Subproject commit 58766ba7b5d72f0d27f712dfcb672167eda539c2 diff --git a/src/Groups/beta/custom/NewMgBetaGroupMember_Create.cs b/src/Groups/beta/custom/NewMgBetaGroupMember_Create.cs index 88ddd85dfa7..86ecc61df39 100644 --- a/src/Groups/beta/custom/NewMgBetaGroupMember_Create.cs +++ b/src/Groups/beta/custom/NewMgBetaGroupMember_Create.cs @@ -43,6 +43,13 @@ public partial class NewMgBetaGroupMember_Create : System.Management.Automation. /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } /// Backing field for property. private string _groupId; @@ -262,12 +269,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync() try { await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } - await this.Client.GroupCreateMemberGraphBPreRef(GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateMemberGraphBPreRef(GroupId, Headers, BodyParameter, onNoContent, onDefault, this, Pipeline); await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } } catch (Microsoft.Graph.Beta.PowerShell.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = BodyParameter }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = BodyParameter }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/beta/custom/NewMgBetaGroupMember_CreateExpanded.cs b/src/Groups/beta/custom/NewMgBetaGroupMember_CreateExpanded.cs index b01c1e1a293..18b1b98f39f 100644 --- a/src/Groups/beta/custom/NewMgBetaGroupMember_CreateExpanded.cs +++ b/src/Groups/beta/custom/NewMgBetaGroupMember_CreateExpanded.cs @@ -33,6 +33,14 @@ public partial class NewMgBetaGroupMember_CreateExpanded : System.Management.Aut /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// Backing field for property. private string _groupId; @@ -263,12 +271,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync() { await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } _bodyParameter.OdataId = $"https://graph.microsoft.com/beta/directoryObjects/{DirectoryObjectId}"; - await this.Client.GroupCreateMemberGraphBPreRef(GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateMemberGraphBPreRef(GroupId, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline); await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } } catch (Runtime.UndeclaredResponseException urexception) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = _bodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = _bodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentity.cs b/src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentity.cs index 70a331713ac..de4845662d3 100644 --- a/src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentity.cs +++ b/src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentity.cs @@ -44,6 +44,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentity : System.Management. /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [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] @@ -261,12 +269,12 @@ 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)); } - await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, 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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = BodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = BodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentityExpanded.cs b/src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentityExpanded.cs index 0546c0f56cf..63979df1619 100644 --- a/src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentityExpanded.cs +++ b/src/Groups/beta/custom/NewMgBetaGroupMember_CreateViaIdentityExpanded.cs @@ -33,6 +33,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentityExpanded : System.Man /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [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] @@ -262,12 +270,12 @@ 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.GroupCreateMemberGraphBPreRef(InputObject.GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, 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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = _bodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = _bodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/beta/custom/NewMgBetaGroupOwner_Create.cs b/src/Groups/beta/custom/NewMgBetaGroupOwner_Create.cs index 7c5f0785860..77a63013ce2 100644 --- a/src/Groups/beta/custom/NewMgBetaGroupOwner_Create.cs +++ b/src/Groups/beta/custom/NewMgBetaGroupOwner_Create.cs @@ -42,6 +42,14 @@ public partial class NewMgBetaGroupOwner_Create : System.Management.Automation.P /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// Backing field for property. private string _groupId; @@ -260,12 +268,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync() try { await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } - await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, 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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = BodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = BodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateExpanded.cs b/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateExpanded.cs index 9dedb8d4a7c..3920f545749 100644 --- a/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateExpanded.cs +++ b/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateExpanded.cs @@ -33,6 +33,14 @@ public partial class NewMgBetaGroupOwner_CreateExpanded : System.Management.Auto /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// Backing field for property. private string _groupId; @@ -263,12 +271,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync() { await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } _bodyParameter.OdataId = $"https://graph.microsoft.com/beta/directoryObjects/{DirectoryObjectId}"; - await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline); await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.Beta.PowerShell.Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } } catch (Runtime.UndeclaredResponseException urexception) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = _bodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = _bodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentity.cs b/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentity.cs index 69ca55ae96f..99d35b58896 100644 --- a/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentity.cs +++ b/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentity.cs @@ -44,6 +44,14 @@ public partial class NewMgBetaGroupOwner_CreateViaIdentity : System.Management.A /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [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] @@ -261,12 +269,12 @@ 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)); } - await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId, 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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = BodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = BodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentityExpanded.cs b/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentityExpanded.cs index 007cc216402..b517c309cc5 100644 --- a/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentityExpanded.cs +++ b/src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentityExpanded.cs @@ -33,6 +33,14 @@ public partial class NewMgBetaGroupOwner_CreateViaIdentityExpanded : System.Mana /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [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] @@ -262,12 +270,12 @@ 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, _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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = _bodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = _bodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/v1.0/custom/NewMgGroupMember_Create.cs b/src/Groups/v1.0/custom/NewMgGroupMember_Create.cs index 4bf1ea417de..018761bd42f 100644 --- a/src/Groups/v1.0/custom/NewMgGroupMember_Create.cs +++ b/src/Groups/v1.0/custom/NewMgGroupMember_Create.cs @@ -43,6 +43,14 @@ public partial class NewMgGroupMember_Create : System.Management.Automation.PSCm /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// Backing field for property. private string _groupId; @@ -261,12 +269,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync() try { await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } - await this.Client.GroupCreateMemberGraphBPreRef(GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateMemberGraphBPreRef(GroupId, Headers, BodyParameter, onNoContent, onDefault, this, Pipeline); await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } } catch (Microsoft.Graph.PowerShell.Runtime.UndeclaredResponseException urexception) { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = BodyParameter }) + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = BodyParameter }) { ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/v1.0/custom/NewMgGroupMember_CreateExpanded.cs b/src/Groups/v1.0/custom/NewMgGroupMember_CreateExpanded.cs index 76903d5724a..862cb923d25 100644 --- a/src/Groups/v1.0/custom/NewMgGroupMember_CreateExpanded.cs +++ b/src/Groups/v1.0/custom/NewMgGroupMember_CreateExpanded.cs @@ -33,6 +33,15 @@ public partial class NewMgGroupMember_CreateExpanded : System.Management.Automat /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + + /// Backing field for property. private string _groupId; @@ -263,12 +272,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync() { await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } _bodyParameter.OdataId = $"https://graph.microsoft.com/v1.0/directoryObjects/{DirectoryObjectId}"; - await this.Client.GroupCreateMemberGraphBPreRef(GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateMemberGraphBPreRef(GroupId, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline); await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.PowerShell.Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } } catch (Runtime.UndeclaredResponseException urexception) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = _bodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = _bodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentity.cs b/src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentity.cs index 80d62dbafcc..f4c567f83ee 100644 --- a/src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentity.cs +++ b/src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentity.cs @@ -44,6 +44,14 @@ public partial class NewMgGroupMember_CreateViaIdentity : System.Management.Auto /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [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] @@ -261,12 +269,12 @@ 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)); } - await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, 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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = BodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = BodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentityExpanded.cs b/src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentityExpanded.cs index fc6f96c7296..b2c4686ac62 100644 --- a/src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentityExpanded.cs +++ b/src/Groups/v1.0/custom/NewMgGroupMember_CreateViaIdentityExpanded.cs @@ -33,6 +33,14 @@ public partial class NewMgGroupMember_CreateViaIdentityExpanded : System.Managem /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [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] @@ -262,12 +270,12 @@ 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/v1.0/directoryObjects/{DirectoryObjectId}"; - await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateMemberGraphBPreRef(InputObject.GroupId, 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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = _bodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = _bodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/v1.0/custom/NewMgGroupOwner_Create.cs b/src/Groups/v1.0/custom/NewMgGroupOwner_Create.cs index 1b152270a69..c0b38a796e1 100644 --- a/src/Groups/v1.0/custom/NewMgGroupOwner_Create.cs +++ b/src/Groups/v1.0/custom/NewMgGroupOwner_Create.cs @@ -41,7 +41,13 @@ public partial class NewMgGroupOwner_Create : System.Management.Automation.PSCmd /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + /// Optional headers that will be added to the request. + [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; } /// Backing field for property. private string _groupId; @@ -260,12 +266,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync() try { await ((Runtime.IEventListener)this).Signal(Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } - await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, 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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = BodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = BodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/v1.0/custom/NewMgGroupOwner_CreateExpanded.cs b/src/Groups/v1.0/custom/NewMgGroupOwner_CreateExpanded.cs index 2167edb33db..c6d0e008bc2 100644 --- a/src/Groups/v1.0/custom/NewMgGroupOwner_CreateExpanded.cs +++ b/src/Groups/v1.0/custom/NewMgGroupOwner_CreateExpanded.cs @@ -33,6 +33,14 @@ public partial class NewMgGroupOwner_CreateExpanded : System.Management.Automati /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// Backing field for property. private string _groupId; @@ -263,12 +271,12 @@ protected async System.Threading.Tasks.Task ProcessRecordAsync() { await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.PowerShell.Runtime.Events.CmdletBeforeAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } _bodyParameter.OdataId = $"https://graph.microsoft.com/v1.0/directoryObjects/{DirectoryObjectId}"; - await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, _bodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateOwnerGraphBPreRef(GroupId, Headers, _bodyParameter, onNoContent, onDefault, this, Pipeline); await ((Runtime.IEventListener)this).Signal(Microsoft.Graph.PowerShell.Runtime.Events.CmdletAfterAPICall); if (((Runtime.IEventListener)this).Token.IsCancellationRequested) { return; } } catch (Runtime.UndeclaredResponseException urexception) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, body = _bodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { GroupId = GroupId, Headers = Headers, body = _bodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentity.cs b/src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentity.cs index 1954914322e..35ea6529838 100644 --- a/src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentity.cs +++ b/src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentity.cs @@ -41,6 +41,14 @@ public partial class NewMgGroupOwner_CreateViaIdentity : System.Management.Autom [Category(ParameterCategory.Runtime)] public System.Management.Automation.SwitchParameter Break { get; set; } + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; @@ -261,12 +269,12 @@ 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)); } - await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId, BodyParameter, onNoContent, onDefault, this, Pipeline); + await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId, 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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = BodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = BodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentityExpanded.cs b/src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentityExpanded.cs index a8423a542b1..62c718c5289 100644 --- a/src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentityExpanded.cs +++ b/src/Groups/v1.0/custom/NewMgGroupOwner_CreateViaIdentityExpanded.cs @@ -33,6 +33,14 @@ public partial class NewMgGroupOwner_CreateViaIdentityExpanded : System.Manageme /// The reference to the client API class. public Groups Client => Module.Instance.ClientAPI; + /// Backing field for property. + private System.Collections.IDictionary _headers; + + /// Optional headers that will be added to the request. + [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; } + /// SendAsync Pipeline Steps to be appended to the front of the pipeline [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] @@ -262,12 +270,12 @@ 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/v1.0/directoryObjects/{DirectoryObjectId}"; - await this.Client.GroupCreateOwnerGraphBPreRef(InputObject.GroupId ?? null, _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) { - WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { body = _bodyParameter }) + WriteError(new System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), System.Management.Automation.ErrorCategory.InvalidOperation, new { Headers = Headers, body = _bodyParameter }) { ErrorDetails = new System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } }); diff --git a/src/readme.graph.md b/src/readme.graph.md index 9983a6f46ac..2c2840971d7 100644 --- a/src/readme.graph.md +++ b/src/readme.graph.md @@ -6,7 +6,8 @@ azure: false powershell: true version: latest -use: "@autorest/powershell@3.0.509" +#use: "@autorest/powershell@3.0.509" +use: "$(this-folder)../autorest.powershell" export-properties-for-dict: false metadata: authors: Microsoft Corporation diff --git a/tools/GenerateModules.ps1 b/tools/GenerateModules.ps1 index 2eff7c1ac36..2e3d85b1253 100644 --- a/tools/GenerateModules.ps1 +++ b/tools/GenerateModules.ps1 @@ -50,6 +50,11 @@ if (-not (Test-Path $ModuleMappingPath)) { Write-Error "Module mapping file not be found: $ModuleMappingPath." } +# Build AutoREST.PowerShell submodule. +Set-Location (Join-Path $ScriptRoot "../autorest.powershell") +rush update --purge +rush build + $RequiredGraphModules = @() $AuthModuleManifest = Join-Path $ModulesSrc "Authentication" "Authentication" "artifacts" "Microsoft.Graph.Authentication.psd1" $LoadedAuthModule = Import-Module $AuthModuleManifest -PassThru -ErrorAction SilentlyContinue