Ejemplo n.º 1
0
        internal static ManagedInstanceExternalAdministrator DeserializeManagedInstanceExternalAdministrator(JsonElement element)
        {
            Optional <AdministratorType> administratorType = default;
            Optional <PrincipalType>     principalType     = default;
            Optional <string>            login             = default;
            Optional <Guid> sid      = default;
            Optional <Guid> tenantId = default;
            Optional <bool> azureADOnlyAuthentication = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("administratorType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    administratorType = new AdministratorType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("principalType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    principalType = new PrincipalType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("login"))
                {
                    login = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sid"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sid = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("tenantId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    tenantId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("azureADOnlyAuthentication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    azureADOnlyAuthentication = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new ManagedInstanceExternalAdministrator(Optional.ToNullable(administratorType), Optional.ToNullable(principalType), login.Value, Optional.ToNullable(sid), Optional.ToNullable(tenantId), Optional.ToNullable(azureADOnlyAuthentication)));
        }
Ejemplo n.º 2
0
        internal static ServerAzureADAdministrator DeserializeServerAzureADAdministrator(JsonElement element)
        {
            Optional <string>            id   = default;
            Optional <string>            name = default;
            Optional <string>            type = default;
            Optional <AdministratorType> administratorType = default;
            Optional <string>            login             = default;
            Optional <Guid> sid      = default;
            Optional <Guid> tenantId = default;
            Optional <bool> azureADOnlyAuthentication = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("administratorType"))
                        {
                            administratorType = new AdministratorType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("login"))
                        {
                            login = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("sid"))
                        {
                            sid = property0.Value.GetGuid();
                            continue;
                        }
                        if (property0.NameEquals("tenantId"))
                        {
                            tenantId = property0.Value.GetGuid();
                            continue;
                        }
                        if (property0.NameEquals("azureADOnlyAuthentication"))
                        {
                            azureADOnlyAuthentication = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ServerAzureADAdministrator(id.Value, name.Value, type.Value, Optional.ToNullable(administratorType), login.Value, Optional.ToNullable(sid), Optional.ToNullable(tenantId), Optional.ToNullable(azureADOnlyAuthentication)));
        }