-
Notifications
You must be signed in to change notification settings - Fork 18
Service instance termination feature
José Bonnet edited this page Aug 18, 2017
·
24 revisions
Running service instances may be stoped (terminated) at any time, by the customer who has asked for its instantiation in the first place.
Termination a service instance requires a POST with the following headers:
| Name | Value | Mandatory? | Comments |
|---|---|---|---|
Authorization |
Bearer <user_token> |
Yes | A valid user token, obtained after a successful login. |
The body of the POST should contain the following fields:
| Field | Mandatory? | Comments |
|---|---|---|
service_instance_uuid |
Yes | The UUID of the service instance. |
request_type |
Yes | This field should contain the value (a string) 'TERMINATE'. |
Using a tool such as curl, the following request can be made:
$ curl -X POST \
> -H "Authorization:Bearer <valid user token>" \
> -d '{"service_instance_uuid":<service instance uuid>, "request_type":"TERMINATE"}' \
> https://<service platform url>/api/v2/requests
Results of the above call can be one of the following:
| HTTP code | Headers | Data | Comments |
|---|---|---|---|
| 201 |
|
Created entity (see Examples section, below) | Note the "status":"NEW" field. |
| 400 |
|
{"error": {"code": 400, "message": "No request was created"}} |
Whenever an access is tried with a missing or invalid parameter. |
| 401 |
|
|
Whenever an access is tried with a missing or out-of-date user token. |
Preconditions:
- there is a registered user with a valid token (
ACCESS_TOKEN); - there is a service instance running, with a known service instance uuid (
SIUUID);
Under these pre-conditions, the command to stop the service instance is:
$ curl -X POST \
> -H "Authorization:Bearer $ACCESS_TOKEN" \
> -d '{"service_instance_uuid":"'"$SIUUID"'","request_type":"TERMINATE"}' \
> https://<service platform url>/api/v2/requests
This command results in (after some format has been added):
{
"created_at": "2017-08-18T12:24:20.938Z",
"egress": null,
"id": "b487d5ef-6104-40af-9963-614f4fb49080",
"ingress": null,
"request_type": "TERMINATE",
"service_instance_uuid": "e4129125-09bb-450f-9224-01d7e7bc41d0",
"service_uuid": "69ec1135-e556-4223-bd3b-ce8d7a289656",
"status": "NEW",
"updated_at": "2017-08-18T12:24:20.938Z"
}