<?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 OS-KSEC2-admin.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:OS-KSEC2="http://docs.openstack.org/identity/api/ext/OS-KSEC2/v1.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:xsdxt="http://docs.rackspacecloud.com/xsd-ext/v1.0"
	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
		http://docs.openstack.org/identity/api/ext/OS-KSEC2/v1.0 ../common/xsd/OS-KSEC2-credentials.xsd
		">

    <grammars>
        <include href="../common/xsd/api.xsd"/>
        <include href="../common/xsd/api-common.xsd"/>
        <include href="../common/xsd/OS-KSEC2-credentials.xsd" />
    </grammars>
    <!--*******************************************************-->
    <!--             All Resoruces                             -->
    <!--*******************************************************-->

    <!-- We should use SSL in production -->
    <resources base="http://localhost:35357">
        <resource id="version" path="v2.0">
            <param name="X-Auth-Token" style="header" type="xsd:string" required="true">
                <doc>You need a valid admin token for access.</doc>
            </param>            
            <resource id="users" path="users">
                <resource id="userById" path="{userId}">
                    <param name="userId" style="template" required="true" type="xsd:string"/>
                    <resource id="user-OS-KSADM" path="OS-KSADM">
                        <resource id="userCredentials" path="credentials">
                            <method href="#addUserCredential"/>
                            <method href="#listCredentials"/>
                            <resource id="userCredentialsByType" path="OS-KSEC2:ec2Credentials">
                                <method href="#updateUserCredential"/>
                                <method href="#deleteUserCredential"/>
                                <method href="#getUserCredential"/>
                            </resource>
                        </resource>
                    </resource>
                  </resource>  
                </resource>
            </resource>
    </resources>

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

    
    
    <!-- User Credentials-->
    <method name="POST" id="addUserCredential">
        <doc xml:lang="EN" title="Add user Credential.">
            <p xmlns="http://www.w3.org/1999/xhtml">Adds a credential to a user.</p>
        </doc>
        <request>
            <representation mediaType="application/xml" element="OS-KSEC2:ec2Credentials">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.xml"/>
            </doc>
         </representation>
            <representation mediaType="application/json">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.json"/>
            </doc>
         </representation>
        </request>
        <response status="201">
            <representation mediaType="application/xml" element="OS-KSEC2:ec2Credentials">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.xml"/>
            </doc>
         </representation>
            <representation mediaType="application/json">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.json"/>
            </doc>
         </representation>
        </response>
        &commonFaults;
        &postPutFaults;
        &getFaults;
    </method>

    <method name="GET" id="listCredentials">
        <doc xml:lang="EN" title="List Credentials">
            <p xmlns="http://www.w3.org/1999/xhtml">List credentials.</p>
        </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:credentials">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/credentialswithec2.xml"/>
            </doc>
         </representation>
            <representation mediaType="application/json">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/credentialswithec2.json"/>
            </doc>
         </representation>
        </response>
        &commonFaults;
        &getFaults;
    </method>
    
    <method name="GET" id="listCredentialsByType">
        <doc xml:lang="EN" title="List Credentials by type">
            <p xmlns="http://www.w3.org/1999/xhtml">List credentials by type.</p>
        </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:credentials">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/credentials.xml"/>
            </doc>
         </representation>
            <representation mediaType="application/json">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/credentials.json"/>
            </doc>
         </representation>
        </response>
        &commonFaults;
        &getFaults;
    </method>    

    <method name="POST" id="updateUserCredential">
        <doc xml:lang="EN" title="Update user credential">
            <p xmlns="http://www.w3.org/1999/xhtml">Update credentials.</p>
        </doc>
        <request>
            <representation mediaType="application/xml" element="OS-KSEC2:ec2Credentials">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.xml"/>
            </doc>
         </representation>
            <representation mediaType="application/json">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.json"/>
            </doc>
         </representation>
        </request>
        <response status="200">
            <representation mediaType="application/xml" element="OS-KSEC2:ec2Credentials">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.xml"/>
            </doc>
         </representation>
            <representation mediaType="application/json">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.json"/>
            </doc>
         </representation>
        </response>
        &commonFaults;
        &postPutFaults;
        &getFaults;
    </method>
    
    <method name="DELETE" id="deleteUserCredential">
        <doc xml:lang="EN" title="Delete user credential">
            <p xmlns="http://www.w3.org/1999/xhtml">Delete User credentials.</p>
        </doc>
        <response status="204"/>
        &commonFaults;
        &postPutFaults;
        &getFaults;
    </method>
    
    <method name="GET" id="getUserCredential">
        <doc xml:lang="EN" title="Get user Credentials">
            <p xmlns="http://www.w3.org/1999/xhtml">Get user credentials.</p>
        </doc>
        <response status="200 203">
            <representation mediaType="application/xml" element="OS-KSEC2:ec2Credentials">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.xml"/>
            </doc>
         </representation>
            <representation mediaType="application/json">
            <doc xml:lang="EN">
               <xsdxt:code href="../common/samples/ec2Credentials.json"/>
            </doc>
         </representation>
        </response>
        &commonFaults;
        &getFaults;
    </method>
</application>
