Skip to content

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.

Input data

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

Results of the above call can be one of the following:

HTTP code Headers Data Comments
201
  • Content-Type: application/json
  • Content-Length: 313
Created entity (see Examples section, below) Note the "status":"NEW" field.
400
  • Content-Type: application/json
  • Content-Length: 57
{"error": {"code": 400, "message": "No request was created"}} Whenever an access is tried with a missing or invalid parameter.
401
  • Content-Type: application/json
  • Content-Length: 77
  • {"error": {"code": 401, "message": "Unauthorized: missing authorization header"}}
  • { "error": { "code": 401, "message": "Unauthorized: token eyJhbGciO...jlDQ is not active"}}
Whenever an access is tried with a missing or out-of-date user token.

Examples

Terminating a service instance

Preconditions:

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"
}

See also

Clone this wiki locally