-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
MongoDBRoleDefinitionData.cs
38 lines (34 loc) · 1.31 KB
/
MongoDBRoleDefinitionData.cs
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#nullable disable
using System.Runtime.CompilerServices;
using System.Text.Json;
using Azure.Core;
using Azure.ResourceManager.CosmosDB.Models;
namespace Azure.ResourceManager.CosmosDB
{
[CodeGenSerialization(nameof(RoleDefinitionType), DeserializationValueHook = nameof(ReadRoleDefinitionType))]
public partial class MongoDBRoleDefinitionData
{
/// <summary> Indicates whether the Role Definition was built-in or user created. </summary>
public MongoDBRoleDefinitionType? RoleDefinitionType { get; set; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void ReadRoleDefinitionType(JsonProperty property, ref MongoDBRoleDefinitionType? type)
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
return;
}
if (property.Value.ValueKind == JsonValueKind.Number)
{
type = property.Value.GetInt32().ToMongoDBRoleDefinitionType();
return;
}
if (property.Value.ValueKind == JsonValueKind.String)
{
type = property.Value.GetString().ToMongoDBRoleDefinitionType();
return;
}
}
}
}