<?xml version="1.0" encoding="UTF-8"?>
<!-- (C) 2011 OpenStack LLC., All Rights Reserved -->
<!--*******************************************************-->
<!--         Import Common XML Entities                    -->
<!--                                                       -->
<!--     You can resolve the entites with xmllint          -->
<!--                                                       -->
<!--        xmllint -noent identity.wadl                   -->
<!--*******************************************************-->
<!DOCTYPE application [
    <!ENTITY % common  SYSTEM "../common/common.ent">
    %common;
]>

<application xmlns="http://wadl.dev.java.net/2009/02"
             xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
             xmlns:capi="http://docs.openstack.org/common/api/v1.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:html="http://www.w3.org/1999/xhtml"
             xmlns:wadl="http://wadl.dev.java.net/2009/02"
             xsi:schemaLocation="http://docs.openstack.org/identity/api/v2.0 ../common/xsd/api.xsd
                                 http://docs.openstack.org/common/api/v1.0 ../common/xsd/api-common.xsd
                                 http://wadl.dev.java.net/2009/02 http://www.w3.org/Submission/wadl/wadl.xsd
                                 ">

    <grammars>
        <include href="../common/xsd/api.xsd"/>
        <include href="../common/xsd/api-common.xsd"/>
    </grammars>

    <!--*******************************************************-->
    <!--             All Resoruces                             -->
    <!--*******************************************************-->

    <!-- We should use SSL in production -->
    <resources base="http://localhost:5000">
        <resource id="version" type="#VersionDetails" path="v2.0/">
            <resource id="extensions" type="#ExtensionList" path="extensions">
                <resource id="extension" path="{alias}">
                    <param name="alias" style="template" type="xsd:string"/>
                    <method href="#getExtension"/>
                </resource>
            </resource>
            <resource id="tokens" path="tokens">
                <method href="#authenticate"/>
            </resource>
            <resource id="tenants" path="tenants">
                <method href="#listTenants"/>
            </resource>
        </resource>
    </resources>

    <!--***************************************************-->
    <!--               Resource Types                          -->
    <!--*******************************************************-->

    <resource_type id="VersionDetails">
        <method href="#getVersionInfo"/>
    </resource_type>
    <resource_type id="ExtensionList">
        <doc xml:lang="EN" title="Extension List">
            <p xmlns="http://www.w3.org/1999/xhtml">
                A list of supported extensions.
            </p>
        </doc>
        <method href="#listExtensions"/>
    </resource_type>

    <!--*******************************************************-->
    <!--               All Methods                             -->
    <!--*******************************************************-->

    <!-- Version -->

    <method name="GET" id="getVersionInfo">
        <doc xml:lang="EN" title="Version Details">
            <p xmlns="http://www.w3.org/1999/xhtml">
                Returns detailed information about this specific version of the API.
            </p>
        </doc>
        <response status="200 203">
            <representation mediaType="application/xml" element="capi:version">
                <param name="location" style="plain" type="xsd:anyURI" required="true" path="/capi:version/atom:link[@rel='self']/@href">
                    <link resource_type="#VersionDetails" rel="self"/>
                </param>
            </representation>
            <representation mediaType="application/json"/>
        </response>
        &commonFaults;
        &getFaults;
    </method>

    <!-- Extensions -->

    <method name="GET" id="listExtensions">
        <doc xml:lang="EN" title="List Extensions">
            <p xmlns="http://www.w3.org/1999/xhtml">List all available extensions.</p>
        </doc>
        <response status="200 203">
            <representation mediaType="application/xml" element="capi:extensions">
                <param name="next" style="plain" type="xsd:anyURI" path="/capi:extensions/atom:link[@rel='next']/@href">
                    <link resource_type="#ExtensionList" rel="next"/>
                </param>
                <param name="previous" style="plain" type="xsd:anyURI" path="/capi:extensions/atom:link[@rel='previous']/@href">
                    <link resource_type="#ExtensionList" rel="previous"/>
                </param>
            </representation>
            <representation mediaType="application/json"/>
        </response>
        &commonFaults;
        &getFaults;
    </method>
    <method name="GET" id="getExtension">
        <doc xml:lang="EN" title="Get Server Details">
            <p xmlns="http://www.w3.org/1999/xhtml">Get details about a specific extension.</p>
        </doc>
        <response status="200 203">
            <representation mediaType="application/xml" element="capi:extension"/>
            <representation mediaType="application/json"/>
        </response>
        &commonFaults;
        &getFaults;
    </method>

    <!-- Token Operations -->
    <method name="POST" id="authenticate">
        <wadl:doc xml:lang="EN" title="Authenticate"
              xmlns="http://www.w3.org/1999/xhtml">
            <p>
              Client authentication is provided via a ReST interface using the POST method,
              with v2.0/tokens supplied as the path. A payload of credentials must be included
              in the body. See <a href="xsd/credentials.xsd">supported credentials</a>
            </p>
            <p>
              Each ReST request against the Keystone system requires the inclusion of a
              specific authorization token HTTP x-header, defined as X-Auth-Token. Clients obtain
              this token, along with the URL to other service APIs, by first authenticating against the
              Keystone Service and supplying valid credentials.
            </p>
            <p>
              The Keystone Service is a ReSTful web service. It is the entry point to all service APIs.
              To access the Keystone Service, you must know URL of the Keystone service.
            </p>
        </wadl:doc>
        <request>
            <representation mediaType="application/xml" element="identity:auth"/>
            <representation mediaType="application/json"/>
        </request>
        <response status="200 203">
            <representation mediaType="application/xml" element="identity:access"/>
            <representation mediaType="application/json"/>
        </response>
        <response status="403">
            <representation mediaType="application/xml" element="identity:userDisabled"/>
            <representation mediaType="application/json"/>
        </response>
        &commonFaults;
        &getFaults;
    </method>

    <!-- Tenant Operations -->

    <method name="GET" id="listTenants">
        <wadl:doc title="List Tenants" xml:lang="EN"
            xmlns="http://www.w3.org/1999/xhtml">
            <p>
                Returns a list of tenants.
            </p>
        </wadl:doc>
        <request>
            <param name="marker" style="query" required="false" type="xsd:string"/>
            <param name="limit" style="query" required="false" type="xsd:int"/>
        </request>
        <response status="200 203">
            <representation mediaType="application/xml" element="identity:tenants"/>
            <representation mediaType="application/json"/>
        </response>
        &commonFaults;
        &getFaults;
    </method>
</application>
