Hc_media_site_declare

Команда предназначена для создания новой географической зоны (нового сайта), которую будет обслуживать медиа-сервер.

Аналог команды в CoCon:

system/media/site/declare

Шаблон URL запроса:

POST
http://host:port/commands/media_site_declare

Коды ответа:

При выполнении команды HTTP-терминал может ответить следующими сообщениями:

  • 200 - в случае успеха;
  • 404 - в случае ошибки.

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Declares media site.
      Usage: http://server:9999/commands/media_site_declare.
      Implementation: hc_media_site_declare.erl.
      Git: git@git.eltex.loc:httpTerminal.git.
      Copyright (c) 2016, Eltex. All rights reserved.
    </xs:documentation>
  </xs:annotation>

    <xs:include schemaLocation="error.xsd"/>

<!-- mediaSiteType -->
    <xs:complexType name="mediaSiteType">
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <xs:complexType name="mediaSiteResultType">
        <xs:attribute name="site" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- resultType-->
    <xs:complexType name="resultType">
      <xs:choice maxOccurs="unbounded">
        <xs:sequence>
            <xs:element name="created" type="mediaSiteResultType" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="error" type="errorMediaSiteResultType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:choice>
    </xs:complexType>

    <xs:complexType name="errorMediaSiteResultType">
        <xs:attribute name="reason" type="xs:string" use="required"/>
        <xs:attribute name="property" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="site" type="mediaSiteType" minOccurs="0" maxOccurs="unbounded"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="result" type="resultType"/>
                <xs:element name="error" type="errorType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример

http://192.168.1.21:9999/commands/media_site_declare

Запрос:

<?xml version="1.0"?>
  <in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_declare.xsd">
    <request>
      <site name="core-site1"/>
      <site name="core-site2"/>
      <site name="core-site3"/>
      <site name="core-site4"/>
      <site name="core-site5"/>
      <site name="core-site6"/>
    </request>
  </in>
CODE

Ответ:

<?xml version="1.0"?>
<out
	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_declare.xsd">
	<result>
		<error reason="already_declared" property="core-site1"/>
		<error reason="already_declared" property="core-site2"/>
		<error reason="already_declared" property="core-site3"/>
		<created site="core-site4"/>
		<created site="core-site5"/>
		<created site="core-site6"/>
	</result>
</out>
CODE

Hc_media_site_distance

Команда предназначена для установки "расстояния" между сайтами.

Аналог команды в CoCon:

system/media/site/distance

Шаблон URL запроса:

POST
http://host:port/commands/media_site_distance

Коды ответа:

При выполнении команды HTTP-терминал может ответить следующими сообщениями:

  • 200 - в случае успеха;
  • 404 - в случае ошибки.

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Declares media site.
      Usage: http://server:9999/commands/media_site_declare.
      Implementation: hc_media_site_declare.erl.
      Git: git@git.eltex.loc:httpTerminal.git.
      Copyright (c) 2016, Eltex. All rights reserved.
    </xs:documentation>
  </xs:annotation>

    <xs:include schemaLocation="error.xsd"/>

<!-- mediaSiteType -->
    <xs:complexType name="mediaSiteType">
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <xs:complexType name="mediaSiteResultType">
        <xs:attribute name="site" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- resultType-->
    <xs:complexType name="resultType">
      <xs:choice maxOccurs="unbounded">
        <xs:sequence>
            <xs:element name="created" type="mediaSiteResultType" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="error" type="errorMediaSiteResultType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:choice>
    </xs:complexType>

    <xs:complexType name="errorMediaSiteResultType">
        <xs:attribute name="reason" type="xs:string" use="required"/>
        <xs:attribute name="property" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="site" type="mediaSiteType" minOccurs="0" maxOccurs="unbounded"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="result" type="resultType"/>
                <xs:element name="error" type="errorType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример

http://192.168.1.21:9999/commands/media_site_distance

Запрос:

<?xml version="1.0"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_distance.xsd">
    <request>
        <arc site_l="core-site1" site_r="core-site1" distance="1"/>
        <arc site_l="core-site1" site_r="core-site2" distance="3"/>
        <arc site_l="core-site1" site_r="core-site3" distance="4"/>
    </request>
</in>
CODE

Ответ:

<?xml version="1.0"?>
<out
	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_distance.xsd">
	<result>
		<success site_l="core-site1" site_r="core-site1" distance="1"/>
		<success site_l="core-site1" site_r="core-site2" distance="3"/>
		<success site_l="core-site1" site_r="core-site3" distance="4"/>
	</result>
</out>
CODE

Hc_media_site_list

Команда возвращает список географических зон (сайтов), обслуживаемых медиа-серверами.

Аналог команды в CoCon:

system/media/site/list

Шаблон URL запроса:

POST
http://host:port/commands/media_site_list

Коды ответа:

При выполнении команды HTTP-терминал может ответить следующими сообщениями:

  • 200 - в случае успеха;
  • 404 - в случае ошибки.

XML-схема

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            Shows media site list.
            Usage: http://server:9999/commands/media_site_list.
            Implementation: hc_media_site_list.erl.
            Git: git@git.eltex.loc:httpTerminal.git.
            Copyright (c) 2016, Eltex. All rights reserved.
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="error.xsd"/>

<!-- mediaSiteType -->
    <xs:complexType name="mediaSiteType">
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- resultType-->
    <xs:complexType name="resultType">
      <xs:sequence>
        <xs:element name="site" type="mediaSiteType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType/>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="result" type="resultType"/>
                <xs:element name="error" type="errorType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример

http://192.168.1.21:9999/commands/media_site_list

Запрос:

<?xml version="1.0" encoding="UTF-8"?>
<in
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hc_media_site_list.xsd">
    <request/>
</in>
CODE

Ответ:

<?xml version="1.0"?>
<out
	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_list.xsd">
	<result>
		<site name="core-site1"/>
		<site name="core-site2"/>
		<site name="core-site3"/>
		<site name="core-site4"/>
		<site name="core-site5"/>
		<site name="core-site6"/>
		<site name="local"/>
	</result>
</out>
CODE

Hc_media_site_matrix

Команда позволяет просмотреть матрицу географических зон, которые обслуживает медиа-сервер.

Аналог команды в CoCon:

system/media/site/matrix

Шаблон URL запроса:

POST
http://host:port/commands/media_site_matrix

Коды ответа:

При выполнении команды HTTP-терминал может ответить следующими сообщениями:

  • 200 - в случае успеха;
  • 404 - в случае ошибки.

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            Matrix of distances between sites.
            Usage: http://server:9999/commands/media_site_matrix.
            Implementation: hc_media_site_matrix.erl.
            Git: git@git.eltex.loc:httpTerminal.git.
            Copyright (c) 2016, Eltex. All rights reserved.
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="error.xsd"/>

<!-- mediaSiteType -->
    <xs:complexType name="siteMatrixType">
        <xs:attribute name="site_l" type="xs:string" use="required"/>
        <xs:attribute name="site_r" type="xs:string" use="required"/>
        <xs:attribute name="distance" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- resultType-->
    <xs:complexType name="resultType">
      <xs:sequence>
        <xs:element name="arc" type="siteMatrixType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType/>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="result" type="resultType"/>
                <xs:element name="error" type="errorType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример

http://192.168.1.21:9999/commands/media_site_matrix

Запрос:

<?xml version="1.0"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_matrix.xsd">
    <request/>
</in>
CODE

Ответ:

<?xml version="1.0"?>
<out
	xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_matrix.xsd">
	<result>
		<arc site_l="core-site1" site_r="core-site1" distance="1"/>
		<arc site_l="core-site1" site_r="core-site2" distance="3"/>
		<arc site_l="core-site1" site_r="core-site3" distance="4"/>
		<arc site_l="core-site2" site_r="core-site2" distance="0"/>
		<arc site_l="core-site2" site_r="core-site1" distance="3"/>
		<arc site_l="core-site3" site_r="core-site3" distance="0"/>
		<arc site_l="core-site3" site_r="core-site1" distance="4"/>
		<arc site_l="core-site4" site_r="core-site4" distance="0"/>
		<arc site_l="core-site5" site_r="core-site5" distance="0"/>
		<arc site_l="core-site6" site_r="core-site6" distance="0"/>
		<arc site_l="local" site_r="local" distance="0"/>
	</result>
</out>
CODE

Hc_media_site_remove

Команда позволяет удалить сайт, обслуживаемый медиа-сервером, и всю информацию о нем.

Аналог команды в CoCon:

system/media/site/remove

Шаблон URL запроса:

POST
http://host:port/commands/media_site_remove

Коды ответа:

При выполнении команды HTTP-терминал может ответить следующими сообщениями:

  • 200 - в случае успеха;
  • 404 - в случае ошибки.

XML-схема:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:annotation>
        <xs:documentation xml:lang="en">
            Remove site.
            Usage: http://server:9999/commands/media_site_remove.
            Implementation: hc_media_site_remove.erl.
            Git: git@git.eltex.loc:httpTerminal.git.
            Copyright (c) 2016, Eltex. All rights reserved.
        </xs:documentation>
    </xs:annotation>

    <xs:include schemaLocation="error.xsd"/>

<!-- mediaSiteType -->
    <xs:complexType name="mediaSiteType">
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <xs:complexType name="mediaSiteResultType">
        <xs:attribute name="site" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- resultType-->
    <xs:complexType name="resultType">
      <xs:choice maxOccurs="unbounded">
        <xs:sequence>
            <xs:element name="deleted" type="mediaSiteResultType" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="error" type="errorType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:choice>
    </xs:complexType>

    <!-- in-->
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="site" type="mediaSiteType" minOccurs="0" maxOccurs="unbounded"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:choice>
                <xs:element name="result" type="resultType"/>
                <xs:element name="error" type="errorType"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример

http://192.168.1.21:9999/commands/media_site_remove

Запрос:

<?xml version="1.0"?>
<in
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_remove.xsd">
    <request>
        <site name="core-site4"/>
        <site name="core-site5"/>
        <site name="core-site6"/>
    </request>
</in>
CODE

Ответ:

<?xml version="1.0"?>
<out
    xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_media_site_remove.xsd">
    <result>
        <deleted site="core-site6"/>
        <deleted site="core-site5"/>
        <deleted site="core-site4"/>
    </result>
</out>
CODE