Exemple #1
0
 internal AppResourceProperties(bool? @public, Uri uri, IDictionary <string, IDictionary <string, BinaryData> > addonConfigs, AppResourceProvisioningState?provisioningState, string fqdn, bool?httpsOnly, TemporaryDisk temporaryDisk, PersistentDisk persistentDisk, IList <CustomPersistentDiskData> customPersistentDisks, bool?enableEndToEndTls, IList <LoadedCertificate> loadedCertificates)
 {
     Public                = @public;
     Uri                   = uri;
     AddonConfigs          = addonConfigs;
     ProvisioningState     = provisioningState;
     Fqdn                  = fqdn;
     HttpsOnly             = httpsOnly;
     TemporaryDisk         = temporaryDisk;
     PersistentDisk        = persistentDisk;
     CustomPersistentDisks = customPersistentDisks;
     EnableEndToEndTls     = enableEndToEndTls;
     LoadedCertificates    = loadedCertificates;
 }
Exemple #2
0
        internal static AppResourceProperties DeserializeAppResourceProperties(JsonElement element)
        {
            Optional <bool> @public = default;
            Optional <Uri>  url     = default;
            Optional <IDictionary <string, IDictionary <string, BinaryData> > > addonConfigs = default;
            Optional <AppResourceProvisioningState> provisioningState = default;
            Optional <string>         fqdn           = default;
            Optional <bool>           httpsOnly      = default;
            Optional <TemporaryDisk>  temporaryDisk  = default;
            Optional <PersistentDisk> persistentDisk = default;
            Optional <IList <CustomPersistentDiskData> > customPersistentDisks = default;
            Optional <bool> enableEndToEndTLS = default;
            Optional <IList <LoadedCertificate> > loadedCertificates = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("public"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    @public = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        url = null;
                        continue;
                    }
                    url = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("addonConfigs"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, IDictionary <string, BinaryData> > dictionary = new Dictionary <string, IDictionary <string, BinaryData> >();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        Dictionary <string, BinaryData> dictionary0 = new Dictionary <string, BinaryData>();
                        foreach (var property1 in property0.Value.EnumerateObject())
                        {
                            dictionary0.Add(property1.Name, BinaryData.FromString(property1.Value.GetRawText()));
                        }
                        dictionary.Add(property0.Name, dictionary0);
                    }
                    addonConfigs = dictionary;
                    continue;
                }
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    provisioningState = new AppResourceProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("fqdn"))
                {
                    fqdn = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("httpsOnly"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    httpsOnly = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("temporaryDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    temporaryDisk = TemporaryDisk.DeserializeTemporaryDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("persistentDisk"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    persistentDisk = PersistentDisk.DeserializePersistentDisk(property.Value);
                    continue;
                }
                if (property.NameEquals("customPersistentDisks"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <CustomPersistentDiskData> array = new List <CustomPersistentDiskData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(CustomPersistentDiskData.DeserializeCustomPersistentDiskData(item));
                    }
                    customPersistentDisks = array;
                    continue;
                }
                if (property.NameEquals("enableEndToEndTLS"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enableEndToEndTLS = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("loadedCertificates"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <LoadedCertificate> array = new List <LoadedCertificate>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(LoadedCertificate.DeserializeLoadedCertificate(item));
                    }
                    loadedCertificates = array;
                    continue;
                }
            }
            return(new AppResourceProperties(Optional.ToNullable(@public), url.Value, Optional.ToDictionary(addonConfigs), Optional.ToNullable(provisioningState), fqdn.Value, Optional.ToNullable(httpsOnly), temporaryDisk.Value, persistentDisk.Value, Optional.ToList(customPersistentDisks), Optional.ToNullable(enableEndToEndTLS), Optional.ToList(loadedCertificates)));
        }