Exemple #1
0
        public ConfigurationStoreData(AzureLocation location, AppConfigurationSku sku) : base(location)
        {
            if (sku == null)
            {
                throw new ArgumentNullException(nameof(sku));
            }

            Sku = sku;
            PrivateEndpointConnections = new ChangeTrackingList <PrivateEndpointConnectionReference>();
        }
Exemple #2
0
 internal ConfigurationStoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ManagedServiceIdentity identity, AppConfigurationSku sku, ProvisioningState?provisioningState, DateTimeOffset?creationDate, string endpoint, Models.EncryptionProperties encryption, IReadOnlyList <PrivateEndpointConnectionReference> privateEndpointConnections, PublicNetworkAccess?publicNetworkAccess) : base(id, name, resourceType, systemData, tags, location)
 {
     Identity                   = identity;
     Sku                        = sku;
     ProvisioningState          = provisioningState;
     CreationDate               = creationDate;
     Endpoint                   = endpoint;
     Encryption                 = encryption;
     PrivateEndpointConnections = privateEndpointConnections;
     PublicNetworkAccess        = publicNetworkAccess;
 }
 internal ConfigurationStoreData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ManagedServiceIdentity identity, AppConfigurationSku sku, ProvisioningState?provisioningState, DateTimeOffset?creationOn, string endpoint, Models.EncryptionProperties encryption, IReadOnlyList <PrivateEndpointConnectionReference> privateEndpointConnections, PublicNetworkAccess?publicNetworkAccess, bool?disableLocalAuth, int?softDeleteRetentionInDays, bool?enablePurgeProtection, CreateMode?createMode) : base(id, name, resourceType, systemData, tags, location)
 {
     Identity                   = identity;
     Sku                        = sku;
     ProvisioningState          = provisioningState;
     CreationOn                 = creationOn;
     Endpoint                   = endpoint;
     Encryption                 = encryption;
     PrivateEndpointConnections = privateEndpointConnections;
     PublicNetworkAccess        = publicNetworkAccess;
     DisableLocalAuth           = disableLocalAuth;
     SoftDeleteRetentionInDays  = softDeleteRetentionInDays;
     EnablePurgeProtection      = enablePurgeProtection;
     CreateMode                 = createMode;
 }
Exemple #4
0
        internal static ConfigurationStoreData DeserializeConfigurationStoreData(JsonElement element)
        {
            Optional <ManagedServiceIdentity> identity               = default;
            AppConfigurationSku          sku                         = default;
            IDictionary <string, string> tags                        = default;
            AzureLocation                          location          = default;
            ResourceIdentifier                     id                = default;
            string                                 name              = default;
            ResourceType                           type              = default;
            SystemData                             systemData        = default;
            Optional <ProvisioningState>           provisioningState = default;
            Optional <DateTimeOffset>              creationDate      = default;
            Optional <string>                      endpoint          = default;
            Optional <Models.EncryptionProperties> encryption        = default;
            Optional <IReadOnlyList <PrivateEndpointConnectionReference> > privateEndpointConnections = default;
            Optional <PublicNetworkAccess> publicNetworkAccess = default;
            Optional <bool>       disableLocalAuth             = default;
            Optional <int>        softDeleteRetentionInDays    = default;
            Optional <bool>       enablePurgeProtection        = default;
            Optional <CreateMode> createMode = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("sku"))
                {
                    sku = AppConfigurationSku.DeserializeAppConfigurationSku(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("creationDate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            creationDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("endpoint"))
                        {
                            endpoint = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("encryption"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            encryption = Models.EncryptionProperties.DeserializeEncryptionProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                privateEndpointConnections = null;
                                continue;
                            }
                            List <PrivateEndpointConnectionReference> array = new List <PrivateEndpointConnectionReference>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateEndpointConnectionReference.DeserializePrivateEndpointConnectionReference(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("publicNetworkAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("disableLocalAuth"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disableLocalAuth = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("softDeleteRetentionInDays"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            softDeleteRetentionInDays = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("enablePurgeProtection"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enablePurgeProtection = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("createMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            createMode = property0.Value.GetString().ToCreateMode();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ConfigurationStoreData(id, name, type, systemData, tags, location, identity, sku, Optional.ToNullable(provisioningState), Optional.ToNullable(creationDate), endpoint.Value, encryption.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(disableLocalAuth), Optional.ToNullable(softDeleteRetentionInDays), Optional.ToNullable(enablePurgeProtection), Optional.ToNullable(createMode)));
        }