Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate cmdlets from forked AutoREST.PowerShell repository. #2542

Merged
merged 27 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a845a9d
Added autorest as a submodule from the forked branch
timayabi2020 Jan 15, 2024
6d4b5b5
Added build from autorest
timayabi2020 Jan 15, 2024
d316e1d
Added submodule stage only
timayabi2020 Jan 15, 2024
e301db1
Rectified recurse submodule errors
timayabi2020 Jan 15, 2024
e3cc36a
Downgraded node to meet rush node requirements
timayabi2020 Jan 15, 2024
950911c
Added purge argument to remove cache
timayabi2020 Jan 15, 2024
682128e
Downgraded node to match the local environment
timayabi2020 Jan 16, 2024
1a8a43d
Updated node to 16
timayabi2020 Jan 16, 2024
07761cb
Changed submodule update on checkout
timayabi2020 Jan 16, 2024
f430eee
Added refs
timayabi2020 Jan 16, 2024
3dbd20f
Did a submodule sync
timayabi2020 Jan 16, 2024
37e5d5a
Added latest commit changes
timayabi2020 Jan 22, 2024
553ed8f
removed the submodule step and changed the checkout submodule step to…
timayabi2020 Jan 22, 2024
91d27f7
Updated submodule pull
timayabi2020 Jan 22, 2024
f1b447f
Fixed submodule name
timayabi2020 Jan 22, 2024
f6a6369
updated submodule
timayabi2020 Jan 22, 2024
3ba226d
Remove update submodule step that is failing in AzureDevops pipeline
timayabi2020 Jan 22, 2024
b30020f
Added custom header parameter to custom cmdlets in groups module
timayabi2020 Jan 23, 2024
58cfeb2
Rectified invalid namespace
timayabi2020 Jan 23, 2024
e7310b4
Added custom header parameter on beta version for custom group cmdlets
timayabi2020 Jan 23, 2024
0b2a2ba
Merge branch 'dev' into powershell-local-autorest
timayabi2020 Jan 24, 2024
8bd778f
Added script for submodule update
timayabi2020 Jan 25, 2024
8612bc8
Changed custom header parameter type from string to IDictionary
timayabi2020 Jan 26, 2024
d8fb0d5
Updated autorest
timayabi2020 Jan 26, 2024
0132b7c
Merge branch 'dev' into powershell-local-autorest
timayabi2020 Jan 26, 2024
3cbc424
Removed global namespace
timayabi2020 Jan 26, 2024
fa560fd
Renamed customHeaders to headers
timayabi2020 Jan 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/common-templates/checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ steps:
- checkout: self
clean: true
fetchDepth: 1
submodules: true
submodules: recursive
persistCredentials: true

- task: PowerShell@2
Expand Down
8 changes: 7 additions & 1 deletion .azure-pipelines/common-templates/install-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "autorest.powershell"]
path = autorest.powershell
url = https://github.com/microsoftgraph/autorest.powershell
branch = powershell-v2
1 change: 1 addition & 0 deletions autorest.powershell
Submodule autorest.powershell added at 58766b
11 changes: 9 additions & 2 deletions src/Groups/beta/custom/NewMgBetaGroupMember_Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public partial class NewMgBetaGroupMember_Create : System.Management.Automation.

/// <summary>The reference to the client API class.</summary>
public Groups Client => Module.Instance.ClientAPI;
/// <summary>Backing field for <see cref="Headers" /> property.</summary>
private System.Collections.IDictionary _headers;

/// <summary>Optional headers that will be added to the request.</summary>
[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="GroupId" /> property.</summary>
private string _groupId;
Expand Down Expand Up @@ -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 }
});
Expand Down
12 changes: 10 additions & 2 deletions src/Groups/beta/custom/NewMgBetaGroupMember_CreateExpanded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public partial class NewMgBetaGroupMember_CreateExpanded : System.Management.Aut
/// <summary>The reference to the client API class.</summary>
public Groups Client => Module.Instance.ClientAPI;

/// <summary>Backing field for <see cref="Headers" /> property.</summary>
private System.Collections.IDictionary _headers;

/// <summary>Optional headers that will be added to the request.</summary>
[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="GroupId" /> property.</summary>
private string _groupId;

Expand Down Expand Up @@ -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 }
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentity : System.Management.
/// <summary>The reference to the client API class.</summary>
public Groups Client => Module.Instance.ClientAPI;

/// <summary>Backing field for <see cref="Headers" /> property.</summary>
private System.Collections.IDictionary _headers;

/// <summary>Optional headers that will be added to the request.</summary>
[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>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 @@ -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 }
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public partial class NewMgBetaGroupMember_CreateViaIdentityExpanded : System.Man
/// <summary>The reference to the client API class.</summary>
public Groups Client => Module.Instance.ClientAPI;

/// <summary>Backing field for <see cref="Headers" /> property.</summary>
private System.Collections.IDictionary _headers;

/// <summary>Optional headers that will be added to the request.</summary>
[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>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 @@ -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 }
});
Expand Down
12 changes: 10 additions & 2 deletions src/Groups/beta/custom/NewMgBetaGroupOwner_Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public partial class NewMgBetaGroupOwner_Create : System.Management.Automation.P
/// <summary>The reference to the client API class.</summary>
public Groups Client => Module.Instance.ClientAPI;

/// <summary>Backing field for <see cref="Headers" /> property.</summary>
private System.Collections.IDictionary _headers;

/// <summary>Optional headers that will be added to the request.</summary>
[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="GroupId" /> property.</summary>
private string _groupId;

Expand Down Expand Up @@ -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 }
});
Expand Down
12 changes: 10 additions & 2 deletions src/Groups/beta/custom/NewMgBetaGroupOwner_CreateExpanded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public partial class NewMgBetaGroupOwner_CreateExpanded : System.Management.Auto
/// <summary>The reference to the client API class.</summary>
public Groups Client => Module.Instance.ClientAPI;

/// <summary>Backing field for <see cref="Headers" /> property.</summary>
private System.Collections.IDictionary _headers;

/// <summary>Optional headers that will be added to the request.</summary>
[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="GroupId" /> property.</summary>
private string _groupId;

Expand Down Expand Up @@ -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 }
});
Expand Down
12 changes: 10 additions & 2 deletions src/Groups/beta/custom/NewMgBetaGroupOwner_CreateViaIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public partial class NewMgBetaGroupOwner_CreateViaIdentity : System.Management.A
/// <summary>The reference to the client API class.</summary>
public Groups Client => Module.Instance.ClientAPI;

/// <summary>Backing field for <see cref="Headers" /> property.</summary>
private System.Collections.IDictionary _headers;

/// <summary>Optional headers that will be added to the request.</summary>
[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>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 @@ -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 }
});
Expand Down
Loading