Set VM retirement date from API


#1

Do we have API to set VM/Instance retirement date?


#2

Hi @psachin

You can use same queries as for services. There is example for set retirement date for cloud instance:

{
    "action" : "retire",
    "resource" : { "date" : "06/24/2017", "warn" : "7"  }
}

And related responce for this POST:

{
     "success": true,
     "message": "VM id:563 name:'server01' retiring on 06/24/2017",
     "href": "https://manageiq/api/vms/563"
}

http://manageiq.org/docs/reference/latest/api/examples/retire_service


#3

Thanks @igortiunov

Works pretty well

HTTP/1.1 200 OK
Date: Fri, 23 Jun 2017 07:46:52 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_auth_kerb/5.4
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: origin, content-type, authorization, x-auth-token
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
Content-Type: application/json; charset=utf-8
Content-Security-Policy: default-src 'self'; connect-src 'self'; frame-src 'self'; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'; report-uri /dashboard/csp_report
Strict-Transport-Security: max-age=631152000
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
ETag: W/"9d1560804e3fa72e76709401d4598413"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 4a155128-98c7-44f4-92af-d1828d8854d4
X-Runtime: 0.147215
Transfer-Encoding: chunked

{"success":true,"message":"VM id:21000000000145 name:'psachin-vm-with-2-nics-from-template' retiring on 06/26/2017","href":"https://cfme.com/api/vms/21000000000145"}