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

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

<schema
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:csapi="http://docs.openstack.org/compute/api/v1.1"
    xmlns:xsdxt="http://docs.rackspacecloud.com/xsd-ext/v1.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://docs.openstack.org/compute/api/v1.1"
>
  <annotation>
    <xsd:appinfo
        xml:lang="EN"
        xmlns="http://www.w3.org/1999/xhtml">
      <xsdxt:title>Server Actions</xsdxt:title>
      <xsdxt:link rel="index" href="api.xsd" />
    </xsd:appinfo>
    <xsd:documentation
        xml:lang="EN"
        xmlns="http://www.w3.org/1999/xhtml">
      <p>
        This schema file defines actions that can be performed on a
        cloud server. All cloud server actions are derived from the <a
        href="#type_Action" title="See definition of
        Action">Action</a> type.
      </p>
    </xsd:documentation>
  </annotation>

  <include schemaLocation="server.xsd">
      <annotation>
          <xsd:documentation
              xml:lang="EN"
              xmlns="http://www.w3.org/1999/xhtml">
              <p>
                  Types related to servers.
              </p>
          </xsd:documentation>
      </annotation>
  </include>

  <element name="reboot"    type="csapi:Reboot">
    <annotation>
      <xsd:documentation
          xml:lang="EN"
          xmlns="http://www.w3.org/1999/xhtml">
        <p>
          Performs a HARD or SOFT reboot.
        </p>
      </xsd:documentation>
      <xsd:appinfo>
        <xsdxt:samples>
          <xsdxt:sample>
            <xsdxt:code type="application/xml" href="../samples/reboot.xml" />
          </xsdxt:sample>
          <xsdxt:sample>
            <xsdxt:code type="application/json" href="../samples/reboot.json" />
          </xsdxt:sample>
        </xsdxt:samples>
      </xsd:appinfo>
    </annotation>
  </element>
  <element name="rebuild"   type="csapi:Rebuild">
    <annotation>
      <xsd:documentation
          xml:lang="EN"
          xmlns="http://www.w3.org/1999/xhtml">
        <p>
          Rebuilds a server.
        </p>
      </xsd:documentation>
      <xsd:appinfo>
        <xsdxt:samples>
          <xsdxt:sample>
            <xsdxt:code type="application/xml" href="../samples/rebuild.xml" />
          </xsdxt:sample>
          <xsdxt:sample>
            <xsdxt:code type="application/json" href="../samples/rebuild.json" />
          </xsdxt:sample>
        </xsdxt:samples>
      </xsd:appinfo>
    </annotation>
  </element>
  <element name="resize"    type="csapi:Resize">
    <annotation>
      <xsd:documentation
          xml:lang="EN"
          xmlns="http://www.w3.org/1999/xhtml">
        <p>
          Resizes a server.
        </p>
      </xsd:documentation>
      <xsd:appinfo>
        <xsdxt:samples>
          <xsdxt:sample>
            <xsdxt:code type="application/xml" href="../samples/resize.xml" />
          </xsdxt:sample>
          <xsdxt:sample>
            <xsdxt:code type="application/json" href="../samples/resize.json" />
          </xsdxt:sample>
        </xsdxt:samples>
      </xsd:appinfo>
    </annotation>
  </element>
  <element name="confirmResize" type="csapi:ConfirmResize">
    <annotation>
      <xsd:documentation
          xml:lang="EN"
          xmlns="http://www.w3.org/1999/xhtml">
        <p>
          Confirms a resize action.
        </p>
      </xsd:documentation>
      <xsd:appinfo>
        <xsdxt:samples>
          <xsdxt:sample>
            <xsdxt:code type="application/xml" href="../samples/confirmresize.xml" />
          </xsdxt:sample>
          <xsdxt:sample>
            <xsdxt:code type="application/json" href="../samples/confirmresize.json" />
          </xsdxt:sample>
        </xsdxt:samples>
      </xsd:appinfo>
    </annotation>
  </element>
  <element name="revertResize" type="csapi:RevertResize">
    <annotation>
      <xsd:documentation
          xml:lang="EN"
          xmlns="http://www.w3.org/1999/xhtml">
        <p>
          Reverts a resize action.
        </p>
      </xsd:documentation>
      <xsd:appinfo>
        <xsdxt:samples>
          <xsdxt:sample>
            <xsdxt:code type="application/xml" href="../samples/revertresize.xml" />
          </xsdxt:sample>
          <xsdxt:sample>
            <xsdxt:code type="application/json" href="../samples/revertresize.json" />
          </xsdxt:sample>
        </xsdxt:samples>
      </xsd:appinfo>
    </annotation>
  </element>
  <element name="changePassword" type="csapi:ChangePassword">
    <annotation>
      <xsd:documentation
          xml:lang="EN"
          xmlns="http://www.w3.org/1999/xhtml">
        <p>
          Changes a server's password.
        </p>
      </xsd:documentation>
      <xsd:appinfo>
        <xsdxt:samples>
          <xsdxt:sample>
            <xsdxt:code type="application/xml" href="../samples/changepassword.xml" />
          </xsdxt:sample>
          <xsdxt:sample>
            <xsdxt:code type="application/json" href="../samples/changepassword.json" />
          </xsdxt:sample>
        </xsdxt:samples>
      </xsd:appinfo>
    </annotation>
  </element>
  <element name="createImage" type="csapi:CreateImage">
    <annotation>
      <xsd:documentation
          xml:lang="EN"
          xmlns="http://www.w3.org/1999/xhtml">
        <p>
            The action creates a new image for the server.
        </p>
      </xsd:documentation>
      <xsd:appinfo>
        <xsdxt:samples>
          <xsdxt:sample>
            <xsdxt:code type="application/xml" href="../samples/createimage.xml" />
          </xsdxt:sample>
          <xsdxt:sample>
            <xsdxt:code type="application/json" href="../samples/createimage.json" />
          </xsdxt:sample>
        </xsdxt:samples>
      </xsd:appinfo>
    </annotation>
  </element>
  
  <!-- Complex Types -->

  <complexType abstract="true" name="Action">
    <annotation>
      <xsd:documentation
          xml:lang="EN"
          xmlns="http://www.w3.org/1999/xhtml">
        <p>
          This is the base type for all server actions.  It is simply
          a marker abstract type used to differentiate an Action
          element from other elements.
        </p>
      </xsd:documentation>
    </annotation>
    <anyAttribute namespace="##other" processContents="lax"/>
  </complexType>

  <complexType name="Reboot">
    <complexContent>
      <extension base="csapi:Action">
          <sequence>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
          </sequence>
	<attribute name="type" type="csapi:RebootType" use="required">
          <annotation>
            <xsd:documentation
                xml:lang="EN"
                xmlns="http://www.w3.org/1999/xhtml">
              <p>
                The <a href="#type_RebootType" title="See definition
                of RebootType">type</a> of reboot to perform.
              </p>
            </xsd:documentation>
          </annotation>
        </attribute>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Rebuild">
    <complexContent>
      <extension base="csapi:Action">
          <sequence>
              <element name="metadata" type="csapi:Metadata" minOccurs="0">
                  <annotation>
                      <xsd:documentation
                          xml:lang="EN"
                          xmlns="http://www.w3.org/1999/xhtml">
                          <p>
                              A collection of meta data items
                              associated with the server.  If not
                              specified the original server metadata
                              will be kept.
                          </p>
                      </xsd:documentation>
                  </annotation>
              </element>
              <element name="personality" type="csapi:Personality" minOccurs="0">
                  <annotation>
                      <xsd:documentation
                          xml:lang="EN"
                          xmlns="http://www.w3.org/1999/xhtml">
                          <p>
                              A collection of small <a
                              href="#type_File" title="See definition
                              of file">files</a> used to personalize a
                              new server instance.  Exisiting server
                              personality files are deleted by the
                              rebuild process.
                          </p>
                      </xsd:documentation>
                  </annotation>
              </element>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
          </sequence>
          <attribute type="xsd:string" name="name" use="optional">
              <annotation>
                  <xsd:documentation
                      xml:lang="EN"
                      xmlns="http://www.w3.org/1999/xhtml">
                      <p>
                          The name of the server. If not specified the
                          original server name will be kept.
                      </p>
                  </xsd:documentation>
              </annotation>
          </attribute>
          <attribute type="xsd:string" name="adminPass" use="optional">
              <annotation>
                  <xsd:documentation
                      xml:lang="EN"
                      xmlns="http://www.w3.org/1999/xhtml">
                      <p>
                          The server's administration password.
                      </p>
                  </xsd:documentation>
              </annotation>
          </attribute>
          <attribute name="imageRef" type="xsd:anyURI" use="required">
              <annotation>
                  <xsd:documentation
                      xml:lang="EN"
                      xmlns="http://www.w3.org/1999/xhtml">
                      <p>
                          A reference to an image to use for the
                          rebuild.  A local image need contain only an
                          Image ID. External images must contian a
                          link that provides the full path to the
                          image resource.  You must supply an image
                          when rebuilding.
                      </p>
                  </xsd:documentation>
              </annotation>
          </attribute>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Resize">
    <complexContent>
      <extension base="csapi:Action">
          <sequence>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
          </sequence>
          <attribute name="flavorRef" type="xsd:anyURI" use="required">
              <annotation>
                  <xsd:documentation
                      xml:lang="EN"
                      xmlns="http://www.w3.org/1999/xhtml">
                      <p>
                          A reference to the flavor to convert to.
                      </p>
                  </xsd:documentation>
              </annotation>
          </attribute>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="ConfirmResize">
    <complexContent>
      <extension base="csapi:Action">
          <sequence>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
          </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="RevertResize">
    <complexContent>
      <extension base="csapi:Action" >
          <sequence>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
          </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="ChangePassword">
    <complexContent>
      <extension base="csapi:Action" >
          <sequence>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
          </sequence>
          <attribute type="xsd:string" name="adminPass" use="required">
              <annotation>
                  <xsd:documentation
                      xml:lang="EN"
                      xmlns="http://www.w3.org/1999/xhtml">
                      <p>
                          The server's administration password.
                      </p>
                  </xsd:documentation>
              </annotation>
          </attribute>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="CreateImage">
    <complexContent>
      <extension base="csapi:Action" >
          <sequence>
              <element name="metadata" type="csapi:Metadata" minOccurs="0">
                  <annotation>
                      <xsd:documentation
                          xml:lang="EN"
                          xmlns="http://www.w3.org/1999/xhtml">
                          <p>
                              A collection of meta data items
                              associated with the image.
                          </p>
                      </xsd:documentation>
                  </annotation>
              </element>
              <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
          </sequence>
          <attribute type="xsd:string" name="name" use="required">
              <annotation>
                  <xsd:documentation
                      xml:lang="EN"
                      xmlns="http://www.w3.org/1999/xhtml">
                      <p>
                          The name of the image to create.
                      </p>
                  </xsd:documentation>
              </annotation>
          </attribute>
      </extension>
    </complexContent>
  </complexType>

  <!-- Simple Types -->
  <simpleType name="RebootType">
    <restriction base="xsd:string">
      <enumeration value="HARD">
        <annotation>
          <xsd:documentation
              xml:lang="EN"
              xmlns="http://www.w3.org/1999/xhtml">
            <p>
              A HARD reboot is equivalent to power cycling the server.
              The operating system is not allowed to gracefully
              shutdown.
            </p>
          </xsd:documentation>
        </annotation>
      </enumeration>
      <enumeration value="SOFT">
        <annotation>
          <xsd:documentation
              xml:lang="EN"
              xmlns="http://www.w3.org/1999/xhtml">
            <p>
              With a SOFT reboot, the operating system is signaled to
              restart. This allows for a graceful shutdown of all
              processes.
            </p>
          </xsd:documentation>
        </annotation>
      </enumeration>
    </restriction>
  </simpleType>
</schema>

