A zonemgr ADR Interface Description Language Example

The example in this appendix shows some APIs used in the zonemgr ADR Interface Description Language. It does not reflect the actual full implementation of the zonemgr APIs in Oracle Solaris.

<?xml version="1.0" encoding="UTF-8"?>

<api xmlns="https://xmlns.oracle.com/radadr"
  name="com.oracle.solaris.rad.zonemgr"
  description="API for Zones administration">

  <summary>
    API for Zones administration
  </summary>

  <doc>
    <para>
      This API provides functionality for the configuration and
      administration of Zones subsystem.
    </para>
  </doc>

  <version major="1" minor="0"/>

  <enum name="ErrorCode">
    <summary>Errors</summary>
    <value name="NONE" value="0">
      <summary>No error</summary>
    </value>
    <value name="FRAMEWORK_ERROR"/>
    <value name="SNAPSHOT_ERROR"/>
    <value name="COMMAND_ERROR"/>
    <value name="RESOURCE_ALREADY_EXISTS"/>
    <value name="RESOURCE_NOT_FOUND"/>
    <value name="RESOURCE_TOO_MANY"/>
    <value name="RESOURCE_UNKNOWN"/>
    <value name="ALREADY_EDITING"/>
    <value name="PROPERTY_UNKNOWN"/>
    <value name="NOT_EDITING"/>
    <value name="SYSTEM_ERROR"/>
    <value name="INVALID_ARGUMENT"/>
    <value name="INVALID_ZONE_STATE"/>
  </enum>

  <struct name="Result" stability="private">
    <summary>An error occurred for the given operation</summary>
    <doc>
      <example language="python" caption="Retrieve an error information from the structure.">
        ...
        try:
            test0.cancelConfig()
        except rad.client.ObjectError as e:
            result = e.get_payload()
            print("Result.code = %s" % result.code)
      </example>
    </doc>
    <field type="ErrorCode" name="code" nullable="true"/>
    <field type="string" name="str" nullable="true"/>
    <field type="string" name="stdout" nullable="true"/>
    <field type="string" name="stderr" nullable="true"/>
  </struct>

  <struct name="ConfigChange">
    <summary>The payload of a configChange event</summary>
    <field type="string" name="zone"/>
  </struct>

  <struct name="StateChange">
    <summary>The payload of a stateChange event</summary>
    <field type="string" name="zone"/>
    <field type="string" name="oldstate"/>
    <field type="string" name="newstate"/>
  </struct>

  <enum name="PropertyValueType">
    <value name="PROP_SIMPLE"/>
    <value name="PROP_LIST"/>
    <value name="PROP_COMPLEX"/>
  </enum>

  <struct name="Property">
    <field name="name" type="string"/>
    <field name="value" type="string" nullable="true"/>
    <field name="type" type="PropertyValueType" nullable="true"/>
    <field name="listvalue" nullable="true">
      <list type="string"/>
    </field>
    <field name="complexvalue" nullable="true">
      <list type="string"/>
    </field>
  </struct>

  <struct name="Resource">
    <summary>A zone resource</summary>
    <doc>
      <para> This structure is used for storing information about an individual
        zone configuration resource.
      </para>
    </doc>
    <field type="string" name="type"/>
    <field name="properties" nullable="true">
      <list type="Property"/>
    </field>
    <field name="parent" type="string" nullable="true"/>
  </struct>

  <interface name="ZoneManager">
    <summary>Manage zones on this system</summary>
    <doc>
      Create and delete zones. Changes in the state of zones
      can be monitored through the StateChange event.
    </doc>

    <method name="create">
      <summary>Create a zone</summary>
      <result type="Result"/>
      <error type="Result"/>
      <argument name="name" type="string"/>
      <argument name="path" type="string" nullable="true"/>
      <argument name="template" type="string" nullable="true"/>
    </method>

    <method name="delete">
      <summary>Delete a zone</summary>
      <result type="Result"/>
      <error type="Result"/>
      <argument name="name" type="string"/>
    </method>

    <method name="importConfig">
      <summary>Import a zone</summary>
      <result type="Result"/>
      <error type="Result"/>
      <argument name="noexecute" type="boolean"/>
      <argument name="name" type="string"/>
      <argument name="configuration">
        <list type="string"/>
      </argument>
    </method>

    <event type="StateChange" name="stateChange"/>
  </interface>

  <interface name="ZoneInfo">
    <summary>Report on the zone in which this instance is executing</summary>
    <doc>
      Information about the current zone can be accessed.
    </doc>
    <property name="brand" access="ro" type="string"/>
    <property name="id" access="ro" type="integer"/>
    <property name="uuid" access="ro" type="string" nullable="true">
      <error type="Result"/>
    </property>
    <property name="name" access="ro" type="string"/>
    <property name="isGlobal" access="ro" type="boolean"/>
  </interface>

  <interface name="Zone">
    <name key="name" primary="true"/>
    <name key="id"/>
    <summary>Operations that affect a single zone</summary>
    <doc>
      Represents an individual zone. All zone configuration and
      administrative actions are represented in this interface.
      Changes of the zone configuration can be monitored through the
      configChange event.
    </doc>

    <property name="auxstate" access="ro" nullable="true">
      <list type="string"/>
      <error type="Result"/>
    </property>
    <property name="brand" access="ro" type="string"/>
    <property name="id" access="ro" type="integer"/>
    <property name="uuid" access="ro" type="string" nullable="true">
      <error type="Result"/>
    </property>
    <property name="name" access="ro" type="string"/>
    <property name="state" access="ro" type="string"/>
    <method name="cancelConfig">
      <error type="Result"/>
    </method>
    <method name="exportConfig">
      <result type="string"/>
      <error type="Result"/>
      <argument name="includeEdits" type="boolean" nullable="true"/>
      <argument type="boolean" name="liveMode" nullable="true"/>
    </method>
    <method name="update">
      <error type="Result"/>
      <argument name="noexecute" type="boolean"/>
      <argument name="commands">
        <list type="string"/>
      </argument>
    </method>
    <method name="editConfig">
      <error type="Result"/>
      <argument type="boolean" name="liveMode" nullable="true"/>
    </method>
    <method name="commitConfig">
      <error type="Result"/>
    </method>
    <method name="configIsLive">
      <result type="boolean"/>
    </method>
    <method name="configIsStale">
      <result type="boolean"/>
      <error type="Result"/>
    </method>
    <method name="addResource">
      <error type="Result"/>
      <argument name="resource" type="Resource"/>
      <argument name="scope" type="Resource" nullable="true"/>
    </method>
    <method name="reloadConfig">
      <error type="Result"/>
      <argument type="boolean" name="liveMode" nullable="true"/>
    </method>
    <method name="removeResources">
      <error type="Result"/>
      <argument name="filter" type="Resource" nullable="false"/>
      <argument name="scope" type="Resource" nullable="true"/>
    </method>
    <method name="getResources">
      <result>
        <list type="Resource"/>
      </result>
      <error type="Result"/>
      <argument name="filter" type="Resource" nullable="true"/>
      <argument name="scope" type="Resource" nullable="true"/>
    </method>
    <method name="getResourceProperties">
      <result>
        <list type="Property"/>
      </result>
      <error type="Result"/>
      <argument name="filter" type="Resource" nullable="false"/>
      <argument name="properties" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="setResourceProperties">
      <error type="Result"/>
      <argument name="filter" type="Resource" nullable="false"/>
      <argument name="properties" nullable="false">
        <list type="Property"/>
      </argument>
    </method>
    <method name="clearResourceProperties">
      <error type="Result"/>
      <argument name="filter" type="Resource" nullable="false"/>
      <argument name="properties" nullable="false">
        <list type="string"/>
      </argument>
    </method>
    <method name="apply">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="attach">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="boot">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="clone">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="detach">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="halt">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="install">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="mark">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="move">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="rename">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="ready">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="reboot">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="savecore">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="shutdown">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="suspend">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="uninstall">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="verify">
      <result type="Result"/>
      <error type="Result"/>
      <argument name="options" nullable="true">
        <list type="string"/>
      </argument>
    </method>
    <method name="getManager">
      <result type="ZoneManager"/>
    </method>
    <event type="ConfigChange" name="configChange"/>
  </interface>
</api>