Skip to content

Commit b21e9a0

Browse files
Cosmos DB Mongo RBAC API release (Azure#31298)
1 parent 3c78bc1 commit b21e9a0

File tree

263 files changed

+110181
-54971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+110181
-54971
lines changed

sdk/cosmosdb/Azure.ResourceManager.CosmosDB/api/Azure.ResourceManager.CosmosDB.netstandard2.0.cs

Lines changed: 141 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
// <auto-generated/>
5+
6+
#nullable disable
7+
8+
using System.Collections.Generic;
9+
using System.Text.Json;
10+
using Azure.Core;
11+
using Azure.ResourceManager.CosmosDB.Models;
12+
using Azure.ResourceManager.Models;
13+
14+
namespace Azure.ResourceManager.CosmosDB
15+
{
16+
public partial class MongoDBRoleDefinitionData : IUtf8JsonSerializable
17+
{
18+
internal static MongoDBRoleDefinitionData DeserializeMongoDBRoleDefinitionData(JsonElement element)
19+
{
20+
ResourceIdentifier id = default;
21+
string name = default;
22+
ResourceType type = default;
23+
Optional<ResourceManager.Models.SystemData> systemData = default;
24+
Optional<string> roleName = default;
25+
Optional<MongoDBRoleDefinitionType> type0 = default;
26+
Optional<string> databaseName = default;
27+
Optional<IList<MongoDBPrivilege>> privileges = default;
28+
Optional<IList<MongoDBRole>> roles = default;
29+
foreach (var property in element.EnumerateObject())
30+
{
31+
if (property.NameEquals("id"))
32+
{
33+
id = new ResourceIdentifier(property.Value.GetString());
34+
continue;
35+
}
36+
if (property.NameEquals("name"))
37+
{
38+
name = property.Value.GetString();
39+
continue;
40+
}
41+
if (property.NameEquals("type"))
42+
{
43+
type = new ResourceType(property.Value.GetString());
44+
continue;
45+
}
46+
if (property.NameEquals("systemData"))
47+
{
48+
if (property.Value.ValueKind == JsonValueKind.Null)
49+
{
50+
property.ThrowNonNullablePropertyIsNull();
51+
continue;
52+
}
53+
systemData = JsonSerializer.Deserialize<ResourceManager.Models.SystemData>(property.Value.ToString());
54+
continue;
55+
}
56+
if (property.NameEquals("properties"))
57+
{
58+
if (property.Value.ValueKind == JsonValueKind.Null)
59+
{
60+
property.ThrowNonNullablePropertyIsNull();
61+
continue;
62+
}
63+
foreach (var property0 in property.Value.EnumerateObject())
64+
{
65+
if (property0.NameEquals("roleName"))
66+
{
67+
roleName = property0.Value.GetString();
68+
continue;
69+
}
70+
if (property0.NameEquals("type"))
71+
{
72+
if (property0.Value.ValueKind == JsonValueKind.Null)
73+
{
74+
property0.ThrowNonNullablePropertyIsNull();
75+
continue;
76+
}
77+
type0 = property0.Value.GetInt32().ToMongoDBRoleDefinitionType();
78+
continue;
79+
}
80+
if (property0.NameEquals("databaseName"))
81+
{
82+
databaseName = property0.Value.GetString();
83+
continue;
84+
}
85+
if (property0.NameEquals("privileges"))
86+
{
87+
if (property0.Value.ValueKind == JsonValueKind.Null)
88+
{
89+
property0.ThrowNonNullablePropertyIsNull();
90+
continue;
91+
}
92+
List<MongoDBPrivilege> array = new List<MongoDBPrivilege>();
93+
foreach (var item in property0.Value.EnumerateArray())
94+
{
95+
array.Add(MongoDBPrivilege.DeserializeMongoDBPrivilege(item));
96+
}
97+
privileges = array;
98+
continue;
99+
}
100+
if (property0.NameEquals("roles"))
101+
{
102+
if (property0.Value.ValueKind == JsonValueKind.Null)
103+
{
104+
property0.ThrowNonNullablePropertyIsNull();
105+
continue;
106+
}
107+
List<MongoDBRole> array = new List<MongoDBRole>();
108+
foreach (var item in property0.Value.EnumerateArray())
109+
{
110+
array.Add(MongoDBRole.DeserializeMongoDBRole(item));
111+
}
112+
roles = array;
113+
continue;
114+
}
115+
}
116+
continue;
117+
}
118+
}
119+
return new MongoDBRoleDefinitionData(id, name, type, systemData.Value, roleName.Value, Optional.ToNullable(type0), databaseName.Value, Optional.ToList(privileges), Optional.ToList(roles));
120+
}
121+
}
122+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
// <auto-generated/>
5+
6+
#nullable disable
7+
8+
using System;
9+
10+
namespace Azure.ResourceManager.CosmosDB.Models
11+
{
12+
internal static partial class MongoDBRoleDefinitionTypeExtensions
13+
{
14+
public static MongoDBRoleDefinitionType ToMongoDBRoleDefinitionType(this int value)
15+
{
16+
if (value == 0)
17+
return MongoDBRoleDefinitionType.BuiltInRole;
18+
if (value == 1)
19+
return MongoDBRoleDefinitionType.CustomRole;
20+
throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown MongoDBRoleDefinitionType value.");
21+
}
22+
}
23+
}

sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountData.cs

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)