Skip to content

Commit e13314d

Browse files
authored
Adding custom cmdlets for RSC configuration (#1968)
* Stash * Taking PR comments. * PR comments.
1 parent b254ebe commit e13314d

30 files changed

+3454
-3
lines changed

src/Teams/beta/custom/GetMgBetaChatRscConfiguration_Get.cs

Lines changed: 288 additions & 0 deletions
Large diffs are not rendered by default.

src/Teams/beta/custom/GetMgBetaTeamAppPreApproval_Get.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,8 @@ private void ValidateInputParameters()
361361
if (string.IsNullOrWhiteSpace(this.TeamsAppId))
362362
{
363363
throw new MGTeamsInternalException(
364-
MGTeamsInternalErrorType.InvalidCmdletInput,
365-
$"'{nameof(this.TeamsAppId)}' cannot be empty.");
364+
MGTeamsInternalErrorType.InvalidCmdletInput,
365+
$"'{nameof(this.TeamsAppId)}' cannot be empty.");
366366
}
367367
}
368368
}

src/Teams/beta/custom/GetMgBetaTeamRscConfiguration_Get.cs

Lines changed: 288 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
namespace Microsoft.Graph.Beta.PowerShell.TeamsInternal.Requests
2+
{
3+
using Microsoft.Graph.Beta.PowerShell.Models.TeamsInternal;
4+
5+
/// <summary>
6+
/// Request to create group consent settings.
7+
/// </summary>
8+
internal class CreateGroupConsentSettingsRequest : TeamsHttpRequest
9+
{
10+
/// <summary>
11+
/// Group consent setting values.
12+
/// </summary>
13+
private MGTeamsInternalTenantConsentSettingValue[] groupConsentSettingValues;
14+
15+
/// <summary>
16+
/// Initializes a new instance of the <see cref="CreatePermissionGrantPreApprovalPolicyRequest"/> class.
17+
/// </summary>
18+
/// <param name="preApprovalPolicyToBeCreated">The preapproval policy to be created.</param>
19+
internal CreateGroupConsentSettingsRequest(MGTeamsInternalTenantConsentSettingValue[] groupConsentSettingValues)
20+
{
21+
this.groupConsentSettingValues = groupConsentSettingValues;
22+
}
23+
24+
/// <summary>
25+
/// Gets the Http method for the request.
26+
/// </summary>
27+
/// <returns>The http method.</returns>
28+
protected override System.Net.Http.HttpMethod GetHttpMethod()
29+
{
30+
return Runtime.Method.Post;
31+
}
32+
33+
/// <summary>
34+
/// Gets the base url for the request.
35+
/// </summary>
36+
/// <returns>string containing the base url.</returns>
37+
protected override string GetBaseUrl()
38+
{
39+
return $"https://graph.microsoft.com/beta/settings";
40+
}
41+
42+
/// <summary>
43+
/// Gets the body of the request as a string.
44+
/// </summary>
45+
/// <returns>The body.</returns>
46+
protected override string GetBodyAsString()
47+
{
48+
return new MGTeamsInternalTenantConsentSettings(RscConfigurationSynthesizer.GroupConsentSettingsTemplateId, groupConsentSettingValues).ToJson();
49+
}
50+
}
51+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace Microsoft.Graph.Beta.PowerShell.TeamsInternal.Requests
2+
{
3+
/// <summary>
4+
/// Request to get authorization policy.
5+
/// </summary>
6+
internal class GetAuthorizationPolicyRequest : TeamsHttpRequest
7+
{
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="GetAuthorizationPolicyRequest"/> class.
10+
/// </summary>
11+
internal GetAuthorizationPolicyRequest()
12+
{
13+
}
14+
15+
/// <summary>
16+
/// Gets the Http method for the request.
17+
/// </summary>
18+
/// <returns>The http method.</returns>
19+
protected override System.Net.Http.HttpMethod GetHttpMethod()
20+
{
21+
return Runtime.Method.Get;
22+
}
23+
24+
/// <summary>
25+
/// Gets the base url for the request.
26+
/// </summary>
27+
/// <returns>string containing the base url.</returns>
28+
protected override string GetBaseUrl()
29+
{
30+
return $"https://graph.microsoft.com/v1.0/policies/authorizationPolicy";
31+
}
32+
33+
/// <summary>
34+
/// Gets the body of the request as a string.
35+
/// </summary>
36+
/// <returns>The body.</returns>
37+
protected override string GetBodyAsString()
38+
{
39+
return null;
40+
}
41+
}
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace Microsoft.Graph.Beta.PowerShell.TeamsInternal.Requests
2+
{
3+
/// <summary>
4+
/// Request to get group consent setting template.
5+
/// </summary>
6+
internal class GetGroupConsentSettingsTemplateRequest : TeamsHttpRequest
7+
{
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="GetGroupConsentSettingsTemplateRequest"/> class.
10+
/// </summary>
11+
internal GetGroupConsentSettingsTemplateRequest()
12+
{
13+
}
14+
15+
/// <summary>
16+
/// Gets the Http method for the request.
17+
/// </summary>
18+
/// <returns>The http method.</returns>
19+
protected override System.Net.Http.HttpMethod GetHttpMethod()
20+
{
21+
return Runtime.Method.Get;
22+
}
23+
24+
/// <summary>
25+
/// Gets the base url for the request.
26+
/// </summary>
27+
/// <returns>string containing the base url.</returns>
28+
protected override string GetBaseUrl()
29+
{
30+
return $"https://graph.microsoft.com/beta/directorySettingTemplates/{RscConfigurationSynthesizer.GroupConsentSettingsTemplateId}";
31+
}
32+
33+
/// <summary>
34+
/// Gets the body of the request as a string.
35+
/// </summary>
36+
/// <returns>The body.</returns>
37+
protected override string GetBodyAsString()
38+
{
39+
return null;
40+
}
41+
}
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace Microsoft.Graph.Beta.PowerShell.TeamsInternal.Requests
2+
{
3+
/// <summary>
4+
/// Request to get Teams app settings.
5+
/// </summary>
6+
internal class GetTeamsAppSettingsRequest : TeamsHttpRequest
7+
{
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="GetTeamsAppSettingsRequest"/> class.
10+
/// </summary>
11+
internal GetTeamsAppSettingsRequest()
12+
{
13+
}
14+
15+
/// <summary>
16+
/// Gets the Http method for the request.
17+
/// </summary>
18+
/// <returns>The http method.</returns>
19+
protected override System.Net.Http.HttpMethod GetHttpMethod()
20+
{
21+
return Runtime.Method.Get;
22+
}
23+
24+
/// <summary>
25+
/// Gets the base url for the request.
26+
/// </summary>
27+
/// <returns>string containing the base url.</returns>
28+
protected override string GetBaseUrl()
29+
{
30+
return $"https://graph.microsoft.com/beta/teamwork/teamsAppSettings";
31+
}
32+
33+
/// <summary>
34+
/// Gets the body of the request as a string.
35+
/// </summary>
36+
/// <returns>The body.</returns>
37+
protected override string GetBodyAsString()
38+
{
39+
return null;
40+
}
41+
}
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace Microsoft.Graph.Beta.PowerShell.TeamsInternal.Requests
2+
{
3+
/// <summary>
4+
/// Request to get Tenant consent settings.
5+
/// </summary>
6+
internal class GetTenantConsentSettingsCollectionRequest : TeamsHttpRequest
7+
{
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="GetTenantConsentSettingsCollectionRequest"/> class.
10+
/// </summary>
11+
internal GetTenantConsentSettingsCollectionRequest()
12+
{
13+
}
14+
15+
/// <summary>
16+
/// Gets the Http method for the request.
17+
/// </summary>
18+
/// <returns>The http method.</returns>
19+
protected override System.Net.Http.HttpMethod GetHttpMethod()
20+
{
21+
return Runtime.Method.Get;
22+
}
23+
24+
/// <summary>
25+
/// Gets the base url for the request.
26+
/// </summary>
27+
/// <returns>string containing the base url.</returns>
28+
protected override string GetBaseUrl()
29+
{
30+
return $"https://graph.microsoft.com/beta/settings";
31+
}
32+
33+
/// <summary>
34+
/// Gets the body of the request as a string.
35+
/// </summary>
36+
/// <returns>The body.</returns>
37+
protected override string GetBodyAsString()
38+
{
39+
return null;
40+
}
41+
}
42+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
namespace Microsoft.Graph.Beta.PowerShell.TeamsInternal.Requests
2+
{
3+
using Microsoft.Graph.Beta.PowerShell.Models.TeamsInternal;
4+
using Microsoft.Graph.Beta.PowerShell.Runtime.Json;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
8+
/// <summary>
9+
/// Request to update permission grant polcies assigned to default user role.
10+
/// </summary>
11+
internal class UpdateDefaultUserRolePermissionGrantPoliciesAssignedRequest : TeamsHttpRequest
12+
{
13+
/// <summary>
14+
/// The permission grant policies to be assigned.
15+
/// </summary>
16+
private IEnumerable<string> permissionGrantPolicies;
17+
18+
/// <summary>
19+
/// Initializes a new instance of the <see cref="UpdatePermissionGrantPreApprovalPolicyRequest"/> class.
20+
/// </summary>
21+
internal UpdateDefaultUserRolePermissionGrantPoliciesAssignedRequest(IEnumerable<string> permissionGrantPolicies)
22+
{
23+
this.permissionGrantPolicies = permissionGrantPolicies;
24+
}
25+
26+
/// <summary>
27+
/// Gets the Http method for the request.
28+
/// </summary>
29+
/// <returns>The http method.</returns>
30+
protected override System.Net.Http.HttpMethod GetHttpMethod()
31+
{
32+
return Runtime.Method.Patch;
33+
}
34+
35+
/// <summary>
36+
/// Gets the base url for the request.
37+
/// </summary>
38+
/// <returns>string containing the base url.</returns>
39+
protected override string GetBaseUrl()
40+
{
41+
return $"https://graph.microsoft.com/v1.0/policies/authorizationPolicy";
42+
}
43+
44+
/// <summary>
45+
/// Gets the body of the request as a string.
46+
/// </summary>
47+
/// <returns>The body.</returns>
48+
protected override string GetBodyAsString()
49+
{
50+
string body =
51+
new JsonObject(
52+
new Dictionary<string, JsonNode>
53+
{
54+
{
55+
"defaultUserRolePermissions",
56+
new JsonObject(
57+
new Dictionary<string, JsonNode>
58+
{
59+
{
60+
"permissionGrantPoliciesAssigned",
61+
JsonArray.Create(this.permissionGrantPolicies.ToArray())
62+
}
63+
})
64+
}
65+
});
66+
return body;
67+
}
68+
}
69+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace Microsoft.Graph.Beta.PowerShell.TeamsInternal.Requests
2+
{
3+
using Microsoft.Graph.Beta.PowerShell.Models.TeamsInternal;
4+
5+
/// <summary>
6+
/// Request to update group consent settings.
7+
/// </summary>
8+
internal class UpdateGroupConsentSettingsRequest : TeamsHttpRequest
9+
{
10+
/// <summary>
11+
/// The setting Id.
12+
/// </summary>
13+
private string settingId;
14+
15+
/// <summary>
16+
/// The group consent setting values.
17+
/// </summary>
18+
private MGTeamsInternalTenantConsentSettingValue[] groupConsentSettingValues;
19+
20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="UpdateGroupConsentSettingsRequest"/> class.
22+
/// </summary>
23+
internal UpdateGroupConsentSettingsRequest(string settingId, MGTeamsInternalTenantConsentSettingValue[] groupConsentSettingValues)
24+
{
25+
this.settingId = settingId;
26+
this.groupConsentSettingValues = groupConsentSettingValues;
27+
}
28+
29+
/// <summary>
30+
/// Gets the Http method for the request.
31+
/// </summary>
32+
/// <returns>The http method.</returns>
33+
protected override System.Net.Http.HttpMethod GetHttpMethod()
34+
{
35+
return Runtime.Method.Patch;
36+
}
37+
38+
/// <summary>
39+
/// Gets the base url for the request.
40+
/// </summary>
41+
/// <returns>string containing the base url.</returns>
42+
protected override string GetBaseUrl()
43+
{
44+
return $"https://graph.microsoft.com/beta/settings/{this.settingId}";
45+
}
46+
47+
/// <summary>
48+
/// Gets the body of the request as a string.
49+
/// </summary>
50+
/// <returns>The body.</returns>
51+
protected override string GetBodyAsString()
52+
{
53+
return new MGTeamsInternalTenantConsentSettings(templateId: null, consentSettingValues: groupConsentSettingValues).ToJson();
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)