-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathMicrosoftGraphTeamsAppPreApproval.cs
More file actions
239 lines (208 loc) · 12.4 KB
/
MicrosoftGraphTeamsAppPreApproval.cs
File metadata and controls
239 lines (208 loc) · 12.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6306, generator: {generator})
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
namespace Microsoft.Graph.Beta.PowerShell.Models
{
using Microsoft.Graph.Beta.PowerShell.TeamsInternal;
using System.Linq;
using static Microsoft.Graph.Beta.PowerShell.Runtime.Extensions;
/// <summary>
/// Model representing association between a Teams App and Preapproval policies.
/// </summary>
public partial class MicrosoftGraphTeamsAppPreApproval :
IMicrosoftGraphTeamsAppPreApproval,
IMicrosoftGraphTeamsAppPreApprovalInternal,
Runtime.IValidates
{
private readonly PropertyTracker _propertyTracker = new PropertyTracker();
public void TrackProperty(string propertyName) => _propertyTracker.TrackProperty(propertyName);
public bool IsPropertySet(string propertyName) =>_propertyTracker.IsPropertySet(propertyName);
public T SanitizeValue<T>(object value) => PropertyTracker.SanitizeValue<T>(value);
/// <summary>
/// Backing field for Inherited model <see cref= "Microsoft.Graph.Beta.PowerShell.Models.IMicrosoftGraphEntity" />
/// </summary>
private Microsoft.Graph.Beta.PowerShell.Models.IMicrosoftGraphEntity __microsoftGraphEntity = new Microsoft.Graph.Beta.PowerShell.Models.MicrosoftGraphEntity();
/// <summary>The unique identifier for an entity. Read-only.</summary>
[Microsoft.Graph.Beta.PowerShell.Origin(Microsoft.Graph.Beta.PowerShell.PropertyOrigin.Inherited)]
public string Id { get => ((Microsoft.Graph.Beta.PowerShell.Models.IMicrosoftGraphEntityInternal)__microsoftGraphEntity).Id; set => ((Microsoft.Graph.Beta.PowerShell.Models.IMicrosoftGraphEntityInternal)__microsoftGraphEntity).Id = value ?? null; }
/// <summary>Backing field for <see cref="TeamsAppId" /> property.</summary>
private string _teamsAppId;
/// <summary>
/// Gets or sets the Teams App Id.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Origin(Microsoft.Graph.Beta.PowerShell.PropertyOrigin.Owned)]
public string TeamsAppId { get => this._teamsAppId; set => this._teamsAppId = value; }
/// <summary>Backing field for <see cref="TeamLevelSensitivityLabelSelectionMode" /> property.</summary>
private MicrosoftGraphSensitivityLabelCondition? _teamLevelSensitivityLabelCondition;
/// <summary>
/// Label selection mode for teams.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Origin(Microsoft.Graph.Beta.PowerShell.PropertyOrigin.Owned)]
public MicrosoftGraphSensitivityLabelCondition? TeamLevelSensitivityLabelCondition { get => this._teamLevelSensitivityLabelCondition; set => this._teamLevelSensitivityLabelCondition = value; }
/// <summary>Backing field for <see cref="ResourceSpecificApplicationPermissionsAllowedForTeams" /> property.</summary>
private string[] _resourceSpecificApplicationPermissionsAllowedForTeams;
/// <summary>
/// Resource Specific Permissions Allowed for Teams.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Origin(Microsoft.Graph.Beta.PowerShell.PropertyOrigin.Owned)]
public string[] ResourceSpecificApplicationPermissionsAllowedForTeams { get => this._resourceSpecificApplicationPermissionsAllowedForTeams; set => this._resourceSpecificApplicationPermissionsAllowedForTeams = value; }
/// <summary>Backing field for <see cref="ResourceSpecificApplicationPermissionsAllowedForChats" /> property.</summary>
private string[] _resourceSpecificApplicationPermissionsAllowedForChats;
/// <summary>
/// Resource Specific Permissions Allowed for chats.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Origin(Microsoft.Graph.Beta.PowerShell.PropertyOrigin.Owned)]
public string[] ResourceSpecificApplicationPermissionsAllowedForChats { get => this._resourceSpecificApplicationPermissionsAllowedForChats; set => this._resourceSpecificApplicationPermissionsAllowedForChats = value; }
/// <summary>Backing field for <see cref="SpecificSensitivityLabelIdsApplicableToTeams" /> property.</summary>
private string[] _specificSensitivityLabelIdsApplicableToTeams;
/// <summary>
/// Specific Sensitivity label ids applicable to Teams.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Origin(Microsoft.Graph.Beta.PowerShell.PropertyOrigin.Owned)]
public string[] SpecificSensitivityLabelIdsApplicableToTeams { get => this._specificSensitivityLabelIdsApplicableToTeams; set => this._specificSensitivityLabelIdsApplicableToTeams = value; }
/// <summary>Creates an new <see cref="MicrosoftGraphTeamsAppPreApproval" /> instance.</summary>
public MicrosoftGraphTeamsAppPreApproval()
{
}
/// <summary>Validates that this object meets the validation criteria.</summary>
/// <param name="eventListener">an <see cref="Microsoft.Graph.Beta.PowerShell.Runtime.IEventListener" /> instance that will receive validation
/// events.</param>
/// <returns>
/// A <see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed.
/// </returns>
public async global::System.Threading.Tasks.Task Validate(Microsoft.Graph.Beta.PowerShell.Runtime.IEventListener eventListener)
{
await eventListener.AssertNotNull(nameof(__microsoftGraphEntity), __microsoftGraphEntity);
await eventListener.AssertObjectIsValid(nameof(__microsoftGraphEntity), __microsoftGraphEntity);
if (string.IsNullOrWhiteSpace(this.TeamsAppId))
{
throw new MGTeamsInternalException(
MGTeamsInternalErrorType.InvalidCmdletInput,
$"'{nameof(this.TeamsAppId)}' cannot be empty.");
}
if (this.TeamLevelSensitivityLabelCondition == null)
{
if (this.ResourceSpecificApplicationPermissionsAllowedForTeams != null || this.SpecificSensitivityLabelIdsApplicableToTeams != null)
{
throw new MGTeamsInternalException(
MGTeamsInternalErrorType.InvalidCmdletInput,
$"'{nameof(this.ResourceSpecificApplicationPermissionsAllowedForTeams)}' and '{nameof(this.SpecificSensitivityLabelIdsApplicableToTeams)}' are not allowed without specifying '{nameof(this.TeamLevelSensitivityLabelCondition)}'.");
}
}
else if (this.TeamLevelSensitivityLabelCondition == MicrosoftGraphSensitivityLabelCondition.AnySensitivityLabel)
{
if (this.SpecificSensitivityLabelIdsApplicableToTeams?.Any() == true)
{
throw new MGTeamsInternalException(
MGTeamsInternalErrorType.InvalidCmdletInput,
$"'{nameof(this.SpecificSensitivityLabelIdsApplicableToTeams)}' cannot be specified for '{nameof(this.TeamLevelSensitivityLabelCondition)}' : '{this.TeamLevelSensitivityLabelCondition}'.");
}
if (this.ResourceSpecificApplicationPermissionsAllowedForTeams?.Any() != true)
{
throw new MGTeamsInternalException(
MGTeamsInternalErrorType.InvalidCmdletInput,
$"'{nameof(this.ResourceSpecificApplicationPermissionsAllowedForTeams)}' must be specified for '{nameof(this.TeamLevelSensitivityLabelCondition)}' : '{this.TeamLevelSensitivityLabelCondition}'.");
}
}
else if (this.TeamLevelSensitivityLabelCondition == MicrosoftGraphSensitivityLabelCondition.SpecificSensivityLabel)
{
if (this.SpecificSensitivityLabelIdsApplicableToTeams?.Any() != true)
{
throw new MGTeamsInternalException(
MGTeamsInternalErrorType.InvalidCmdletInput,
$"'{nameof(this.SpecificSensitivityLabelIdsApplicableToTeams)}' must be specified for '{nameof(this.TeamLevelSensitivityLabelCondition)}' : '{this.TeamLevelSensitivityLabelCondition}'.");
}
if (this.ResourceSpecificApplicationPermissionsAllowedForTeams?.Any() != true)
{
throw new MGTeamsInternalException(
MGTeamsInternalErrorType.InvalidCmdletInput,
$"'{nameof(this.ResourceSpecificApplicationPermissionsAllowedForTeams)}' must be specified for '{nameof(this.TeamLevelSensitivityLabelCondition)}' : '{this.TeamLevelSensitivityLabelCondition}'.");
}
}
}
}
/// <summary>
/// Model representing association between a Teams App and Preapproval policies.
/// </summary>
public partial interface IMicrosoftGraphTeamsAppPreApproval :
Microsoft.Graph.Beta.PowerShell.Runtime.IJsonSerializable,
IMicrosoftGraphEntity
{
/// <summary>
/// Gets or sets the Teams App Id.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"teamsAppId",
SerializedName = @"key: id of Teams App",
PossibleTypes = new[] { typeof(string) })]
string TeamsAppId { get; set; }
/// <summary>
/// Resource Specific Permissions Allowed for Teams.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Resource Specific Permissions Allowed for Teams",
SerializedName = @"resourceSpecificApplicationPermissionsAllowedForTeams",
PossibleTypes = new[] { typeof(string) })]
string[] ResourceSpecificApplicationPermissionsAllowedForTeams { get; set; }
/// <summary>
/// Resource Specific Permissions Allowed for chats.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Resource Specific Permissions Allowed for Chats",
SerializedName = @"resourceSpecificApplicationPermissionsAllowedForChats",
PossibleTypes = new[] { typeof(string) })]
string[] ResourceSpecificApplicationPermissionsAllowedForChats { get; set; }
/// <summary>
/// Label selection mode for teams.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Label selection mode for teams",
SerializedName = @"teamLevelSensitivityLabelCondition",
PossibleTypes = new[] { typeof(string) })]
MicrosoftGraphSensitivityLabelCondition? TeamLevelSensitivityLabelCondition { get; set; }
/// <summary>
/// Specific Sensitivity label ids applicable to Teams.
/// </summary>
[Microsoft.Graph.Beta.PowerShell.Runtime.Info(
Required = false,
ReadOnly = false,
Description = @"Specific Sensitivity label ids applicable to Teams",
SerializedName = @"specificSensitivityLabelIdsApplicableToTeams",
PossibleTypes = new[] { typeof(string) })]
string[] SpecificSensitivityLabelIdsApplicableToTeams { get; set; }
}
/// <summary>
/// Internal model representing association between a Teams App and Preapproval policies.
/// </summary>
internal partial interface IMicrosoftGraphTeamsAppPreApprovalInternal :
IMicrosoftGraphEntityInternal
{
/// <summary>
/// Gets or sets the Teams App Id.
/// </summary>
string TeamsAppId { get; set; }
/// <summary>
/// Resource Specific Permissions Allowed for Teams.
/// </summary>
string[] ResourceSpecificApplicationPermissionsAllowedForTeams { get; set; }
/// <summary>
/// Resource Specific Permissions Allowed for chats.
/// </summary>
string[] ResourceSpecificApplicationPermissionsAllowedForChats { get; set; }
/// <summary>
/// Label selection mode for teams.
/// </summary>
MicrosoftGraphSensitivityLabelCondition? TeamLevelSensitivityLabelCondition { get; set; }
/// <summary>
/// Specific Sensitivity label ids applicable to Teams.
/// </summary>
string[] SpecificSensitivityLabelIdsApplicableToTeams { get; set; }
}
}