Beispiel #1
0
        internal static AzureKeyVaultProperties DeserializeAzureKeyVaultProperties(JsonElement element)
        {
            Optional <bool?>  connectAsKubernetesCsiDriver = default;
            AzureResourceType type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("connectAsKubernetesCsiDriver"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        connectAsKubernetesCsiDriver = null;
                        continue;
                    }
                    connectAsKubernetesCsiDriver = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new AzureResourceType(property.Value.GetString());
                    continue;
                }
            }
            return(new AzureKeyVaultProperties(type, Optional.ToNullable(connectAsKubernetesCsiDriver)));
        }
Beispiel #2
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("type");
     writer.WriteStringValue(AzureResourceType.ToString());
     writer.WriteEndObject();
 }
Beispiel #3
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (Optional.IsDefined(ConnectAsKubernetesCsiDriver))
     {
         writer.WritePropertyName("connectAsKubernetesCsiDriver");
         writer.WriteBooleanValue(ConnectAsKubernetesCsiDriver.Value);
     }
     writer.WritePropertyName("type");
     writer.WriteStringValue(AzureResourceType.ToString());
     writer.WriteEndObject();
 }
Beispiel #4
0
        internal static AzureResourcePropertiesBase DeserializeAzureResourcePropertiesBase(JsonElement element)
        {
            if (element.TryGetProperty("type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "KeyVault": return(AzureKeyVaultProperties.DeserializeAzureKeyVaultProperties(element));
                }
            }
            AzureResourceType type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    type = new AzureResourceType(property.Value.GetString());
                    continue;
                }
            }
            return(new AzureResourcePropertiesBase(type));
        }