v0.5.2: curl-примеры со стендом, убран app-autotest, serviceId=1 в примере
This commit is contained in:
@@ -80,7 +80,7 @@ SERVICES = _DF["SERVICES"]
|
|||||||
OPS_INDEX = _DF["OPS_INDEX"]
|
OPS_INDEX = _DF["OPS_INDEX"]
|
||||||
|
|
||||||
DELAY = float(os.getenv("MOCK_OP_DELAY", "0.1"))
|
DELAY = float(os.getenv("MOCK_OP_DELAY", "0.1"))
|
||||||
VERSION = "0.5.1"
|
VERSION = "0.5.2"
|
||||||
|
|
||||||
|
|
||||||
def get_services(stand_id):
|
def get_services(stand_id):
|
||||||
|
|||||||
+18
-16
@@ -89,32 +89,34 @@
|
|||||||
<section class="card">
|
<section class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2>Как использовать</h2>
|
<h2>Как использовать</h2>
|
||||||
|
{% if stands_list|length > 1 %}<span class="muted">Стенд: <strong>{{ current_stand }}</strong></span>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h3 class="h4">1. Получить список сервисов</h3>
|
<h3 class="h4">1. Получить список сервисов</h3>
|
||||||
<pre class="code-block"><code>curl -s {{ endpoint }}/api/v1/svc/services | python3 -m json.tool</code></pre>
|
<pre class="code-block"><code>curl -s {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/services | python3 -m json.tool</code></pre>
|
||||||
|
|
||||||
<h3 class="h4">2. Создать инстанс</h3>
|
<h3 class="h4">2. Создать инстанс</h3>
|
||||||
<pre class="code-block"><code>curl -s -X POST {{ endpoint }}/api/v1/svc/instances \
|
<pre class="code-block"><code>curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/instances \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"serviceId": "s3", "displayName": "my-bucket"}' | python3 -m json.tool</code></pre>
|
-d '{"serviceId": 1, "displayName": "my-instance"}' | python3 -m json.tool</code></pre>
|
||||||
|
|
||||||
<h3 class="h4">3. Заполнить параметры и запустить операцию</h3>
|
<h3 class="h4">3. Создать и запустить операцию</h3>
|
||||||
<pre class="code-block"><code># Установить параметры операции
|
<pre class="code-block"><code># Создать операцию
|
||||||
curl -s -X POST {{ endpoint }}/api/v1/svc/instanceOperationCfsParams/<opUid>
|
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/instanceOperations \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"instanceUid": "<uid>", "operation": "create", "svcOperationId": 18}'
|
||||||
|
|
||||||
# Запустить операцию (create/modify/delete)
|
# Установить параметры
|
||||||
curl -s -X POST {{ endpoint }}/api/v1/svc/instanceOperations/<opUid>/run</code></pre>
|
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/instanceOperationCfsParams \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"instanceOperationUid": "<opUid>", "svcOperationCfsParamId": 242, "paramValue": "my-value"}'
|
||||||
|
|
||||||
|
# Запустить
|
||||||
|
curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/instanceOperations/<opUid>/run</code></pre>
|
||||||
|
|
||||||
<h3 class="h4">4. Сбросить состояние</h3>
|
<h3 class="h4">4. Сбросить состояние</h3>
|
||||||
<pre class="code-block"><code>curl -s -X POST {{ endpoint }}/api/v1/svc/_mock/reset</code></pre>
|
<pre class="code-block"><code>curl -s -X POST {{ endpoint }}/{% if stands_list|length > 1 %}{{ current_stand }}/{% endif %}api/v1/svc/_mock/reset \
|
||||||
|
-H "X-Mock-Auth: test-token-123"</code></pre>
|
||||||
<div class="note">
|
|
||||||
<strong>Подсказка:</strong> используйте переменную окружения
|
|
||||||
<code>POLYGON_ENDPOINT={{ endpoint }}</code>
|
|
||||||
в <code>app-autotest</code> — и все операции пойдут через полигон
|
|
||||||
вместо реального API.
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user