<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
        <service>opennebula-sunstone</service>
        <file filelist='onefrontend' name='/etc/one/sunstone-server.conf'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-logos.yaml'/>

        <file filelist='onefrontend' name='/etc/one/sunstone-views/kvm/admin.yaml' source='kvm-admin.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/kvm/cloud.yaml' source='kvm-cloud.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/kvm/groupadmin.yaml' source='kvm-groupadmin.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/kvm/user.yaml' source='kvm-user.yaml'/>

        <file filelist='onefrontend' name='/etc/one/sunstone-views/mixed/admin.yaml' source='mixed-admin.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/mixed/cloud.yaml' source='mixed-cloud.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/mixed/groupadmin.yaml' source='mixed-groupadmin.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/mixed/user.yaml' source='mixed-user.yaml'/>

        <file filelist='onefrontend' name='/etc/one/sunstone-views/vcenter/admin.yaml' source='vcenter-admin.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/vcenter/cloud.yaml' source='vcenter-cloud.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/vcenter/groupadmin.yaml' source='vcenter-groupadmin.yaml'/>
        <file filelist='onefrontend' name='/etc/one/sunstone-views/vcenter/user.yaml' source='vcenter-user.yaml'/>


        <file filelist='onefrontend' name='/etc/nginx/upstream.d/sunstone.conf' source='nginx-sunstone-upstream.conf' mkdir='True'/>
        <file filelist='onefrontend' name='/etc/nginx/web.d/sunstone.conf' source='nginx-sunstone-web-d.conf' mkdir='True'/>

        <service_access service='sunstoneHttps'>
            <port>443</port>
        </service_access>
        <service_restriction service='sunstoneHttps'>
            <ip interface='eth0' netmask='netmask_admin_eth0' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ip_admin_eth0</ip>
        </service_restriction>
        <service_access service='sunstone'>
            <port port_type="SymLinkOption">port_sunstone</port>
            <port port_type="SymLinkOption">one_sunstone_vnc_proxy_port</port>
        </service_access>
        <service_restriction service='sunstone'>
            <ip interface='eth0' netmask='netmask_ssh_eth0' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ip_ssh_eth0</ip>
        </service_restriction>
    </files>
    <variables>
        <family name='Annuaire'>
            <variable name='ldap_nss' redefine='True' hidden='True'/>
        </family>
        <family name='Services'>
            <variable name='activer_onefrontend' type='oui/non' description="Activer l'application web OpenNebula Sunstone" mode="expert">
                <value>oui</value>
            </variable>
        </family>
        <family name='Virtualisation'>
            <variable name='one_sunstone_dns_name' type='domain' description='Nom de domaine (FQDN) associé à la VIP ONE HA' mode='expert' mandatory='True'/>
            <variable name='sunstone_view_mode' type='string' description='Mode d’affichage par défaut des vues' mode='expert'>
                <value>kvm</value>
            </variable>
            <variable name='sunstone_auth_modes' type='string' description="Modes supplémentaires d'authentification des utilisateurs" mode='expert'/>
            <variable name='ip_sunstone' type='ip' description="Adresse IP d'écoute de Sunstone" mandatory="True">
                <value>127.0.0.1</value>
            </variable>
            <variable name='port_sunstone' type='number' description="Numéro de port d'écoute de Sunstone" mode="expert" mandatory='True' hidden="True">
                <value>9000</value>
            </variable>
            <variable name='one_sunstone_vnc_proxy_ip' description="Adresse IP d'écoute du proxy VNC" mode='expert' mandatory='True' hidden="True">
                <value>127.0.0.1</value>
            </variable>
            <variable name='one_sunstone_vnc_proxy_port' type='number' description="Numéro de port d'écoute du proxy VNC">
                <value>29876</value>
            </variable>
            <variable name='one_sunstone_vnc_proxy_wss' type='oui/non' description="Activer le support WSS pour le proxy VNC" mode='expert'>
                <value>oui</value>
            </variable>
            <variable name='langue_sunstone' type='string' description="Langue par défaut" mode='expert' mandatory="True">
                <value>fr_FR</value>
            </variable>
            <variable name='sunstone_logo' type='string' description="Logo pour l'interface Sunstone" mode='expert'>
                <value>opennebula-sunstone-v4.0.png</value>
            </variable>
            <variable name='one_nginx_max_body_size' type='number' description="Taille maximum des requêtes HTTP (client) en Mb" mode='expert'>
                <value>512</value>
            </variable>
        </family>
        <separators>
            <separator name='sunstone_view_mode'>Configuration de l'application web OpenNebula Sunstone</separator>
        </separators>
    </variables>

    <constraints>
        <check name='valid_enum' target='sunstone_view_mode'>
            <param>['kvm', 'mixed', 'vcenter']</param>
        </check>

        <check name='valid_enum' target='sunstone_auth_modes'>
            <param>['', 'ldap']</param>
        </check>

        <auto name='calc_multi_condition' target='activer_client_ldap'>
            <param>ldap</param>
            <param type='eole' name='condition_1'>sunstone_auth_modes</param>
            <param name='match'>distant</param>
            <param name='mismatch'>non</param>
        </auto>

        <condition name='disabled_if_in' source='activer_onefrontend'>
            <param>non</param>
            <target type='filelist'>onefrontend</target>
            <target type='variable'>port_sunstone</target>
            <target type='variable'>one_sunstone_vnc_proxy_port</target>
            <target type='variable'>ip_sunstone</target>
            <target type='variable'>langue_sunstone</target>
            <target type='variable'>sunstone_logo</target>
        </condition>

        <condition name='frozen_if_in' source='activer_onefrontend'>
            <param>oui</param>
            <target type='variable'>port_sunstone</target>
            <target type='variable'>one_sunstone_vnc_proxy_port</target>
            <target type='variable'>ip_sunstone</target>
        </condition>

        <condition name='disabled_if_in' source='activer_one_ha'>
            <param>non</param>
            <target type='variable'>one_sunstone_dns_name</target>
        </condition>

    </constraints>
    <help>
        <variable name='sunstone_view_mode'>Utiliser l’un des types de vues par défaut en fonction de l’hyperviseur</variable>
        <variable name='langue_sunstone'>Langue par défaut de l'interface OpenNebula Sunstone</variable>
        <variable name='one_sunstone_dns_name'>Nom de domaine (FQDN) associé à la VIP OpenNebula HA, utilisée pour l'accès au Sunstone du noeud "Leader"</variable>
    </help>
</creole>
