<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>

<!-- (C) 2011 OpenStack LLC., All Rights Reserved -->

<schema
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
    xmlns:xsdxt="http://docs.rackspacecloud.com/xsd-ext/v1.0"
    xmlns:atom="http://www.w3.org/2005/Atom"
    targetNamespace="http://docs.openstack.org/identity/api/v2.0"
>
 
    <include schemaLocation="roles.xsd"/>
    <include schemaLocation="services.xsd"/>
       
    <!-- Import ATOM specific schema definitions -->
    <import vc:minVersion="1.1" namespace="http://www.w3.org/2005/Atom"
        schemaLocation="atom/atom.xsd" />
    
    <!-- Elements -->
    <element name="access" type="identity:AuthenticateResponse"/>
    
    <!-- Complex Types -->
    <complexType name="Token">
        <annotation>
            <xsd:documentation xml:lang="EN" xmlns="http://www.w3.org/1999/xhtml">
                <p>
                    A token is an arbitrary bit of text that is used to access
                    resources. Each token has a scope which describes which
                    resources are accessible with it. A token may be
                    revoked at anytime and is valid for a finite duration.
                </p>
                <p>
                    While Keystone supports token-based authentication in this release,
                    the intention is for it to support additional protocols in the
                    future. The desire is for it to be an integration service, and not
                    a full-fledged identity store and management solution.
                </p>
            </xsd:documentation>
            <xsd:appinfo>
                <xsdxt:samples>
                    <xsdxt:sample>
                        <xsdxt:code type="application/xml" href="../samples/token.xml" />
                    </xsdxt:sample>
                    <xsdxt:sample>
                        <xsdxt:code type="application/json" href="../samples/token.json" />
                    </xsdxt:sample>
                </xsdxt:samples>
            </xsd:appinfo>
        </annotation>
        <sequence>
            <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </sequence>
        <attribute name="expires" type="xsd:dateTime" use="required"/>
        <attribute name="id" type="xsd:string" use="required"/>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>

    <complexType name="AuthenticateResponse">
        <sequence>
            <element name="token" type="identity:Token"/>
            <element name="user" type="identity:UserForAuthenticateResponse"/>
            <element name="serviceCatalog" type="identity:ServiceCatalog" minOccurs="0"/>
            <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </sequence>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>

    <complexType name="UserForAuthenticateResponse">
        <sequence>
            <element name="roles" type="identity:RoleList" />
            <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </sequence>
        <attribute name="id" type="xsd:string"/>
        <attribute name="name" type="xsd:string"/>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>
    
    <complexType name="ServiceCatalog">
        <annotation>
            <xsd:documentation xml:lang="EN" xmlns="http://www.w3.org/1999/xhtml">
                <p>
                  The service catalog lists the services you have access to
                </p>
                <div class="design">
                    <p>
                    We optimized for future flexibility around the hierarchy. So we
                    left the design as a flat list of endpoints with attributes and the
                    consumer can categorize as they need.
                    This results in potential duplication (such as with the version/@list)
                    but we acceopt that normalization cost in order to not force an
                    artificial hierarchy (suchas on region, which can be optional).
                  </p>
                </div>
            </xsd:documentation>
            <xsd:appinfo>
              <xsdxt:samples>
                <xsdxt:sample>
                  <xsdxt:code type="application/xml" href="../samples/services.xml" />
                </xsdxt:sample>
                <xsdxt:sample>
                  <xsdxt:code type="application/json" href="../samples/services.json" />
                </xsdxt:sample>
              </xsdxt:samples>
            </xsd:appinfo>
        </annotation>
        <sequence>
            <element name="service" type="identity:ServiceForCatalog" minOccurs="1" maxOccurs="unbounded">
                <annotation>
                    <xsd:documentation
                            xml:lang="EN"
                            xmlns="http://www.w3.org/1999/xhtml">
                        <p>
                            A list of services.
                        </p>
                    </xsd:documentation>
                </annotation>
            </element>
            <element vc:minVersion="1.1" ref="atom:link" minOccurs="0" maxOccurs="unbounded" />
            <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </sequence>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>
    
    <complexType name="ServiceForCatalog">
        <sequence>
            <element name="endpoint" type="identity:EndpointForService" minOccurs="1" maxOccurs="unbounded">
                <annotation>
                    <xsd:documentation
                            xml:lang="EN"
                            xmlns="http://www.w3.org/1999/xhtml">
                        <p>
                            A list of endpoints.
                        </p>
                    </xsd:documentation>
                </annotation>
            </element>
            <element vc:minVersion="1.1" ref="atom:link" minOccurs="0" maxOccurs="unbounded" />
            <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </sequence>
        <attribute name="type" type="identity:ExtensibleServiceType" use="required">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        The OpenStack-registered type (e.g. 'compute', 'object-store', etc).
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <attribute name="name" type="xsd:string" use="optional">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        The commercial service name (e.g. 'My Nova Cloud Servers').
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>
    
    <!--EndpointForService-->
    <complexType name="EndpointForService">
        <sequence>
            <element name="version" type="identity:VersionForService" maxOccurs="1" minOccurs="0">
                <annotation>
                    <xsd:documentation
                        xml:lang="EN"
                        xmlns="http://www.w3.org/1999/xhtml">
                        <p>
                            Version details.
                        </p>
                    </xsd:documentation>
                </annotation>               
            </element>
            <element vc:minVersion="1.1" ref="atom:link" minOccurs="0" maxOccurs="unbounded" />
            <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </sequence>
        <attribute name="region" type="xsd:string" use="optional">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        The name of the region where the endpoint
                        lives. Example: airport codes; LHR (UK),
                        STL (Saint Louis)
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <attribute name="tenantId" type="xsd:string" use="optional">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        Tenant id to which the endpoints belong.
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <attribute name="publicURL" type="xsd:anyURI" use="required">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        Public accessible service URL.
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <attribute name="internalURL" type="xsd:anyURI" use="optional">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        A service URL, accessible only locally within that
                        cloud (generally over a high bandwidth, low latency,
                        free of charge link).
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <attribute name="adminURL" type="xsd:anyURI" use="optional">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        An Admin URL (used for administration using privileged
                        calls). This may expose
                        additional functionality not found in the public and
                        internal URL.
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>
    
    <!-- VersionForService -->
    <complexType name="VersionForService">
        <attribute name="id" type="xsd:string" use="required">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                       Id of the version.
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <attribute name="info" type="xsd:anyURI" use="required">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        URI to get the information specific to this version.
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <attribute name="list" type="xsd:anyURI" use="required">
            <annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        URI to get the information about all versions.
                    </p>
                </xsd:documentation>
            </annotation>
        </attribute>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>
</schema>

