Deleting a Service Instance

You can delete an Oracle Java Cloud Service instance using the REST API, as described in the following procedure.

Note:

  • The cURL commands and request parameters used in this use case are applicable only to Oracle Cloud Machine.

  • The cURL command examples use the URL structure https://rest_server_url/resource-path, where rest_server_url is the REST server to contact for your identity domain. See Send Requests.

To delete an Oracle Java Cloud Service instance:

  1. Before deleting an Oracle Java Cloud Service instance, review the service instances that currently exist to confirm the name of the service instance that you want to delete.
    curl -i -X GET -u username:userPassword1! -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain
    

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output. This option is optional.

    • -X option to indicate the type of request (GET).

    • -u option to specify the user name and password for the Oracle Java Cloud Service account for authentication.

    • -H to define a custom header, X-ID-TENANT-NAME, to identify the identity domain ID.

    For more information, see View All Service Instances.

    The following shows an example of the response body. In this example, there are three service instances, ExampleInstance, My12cServer, and My11gServer.

    {
        "uri":"https:\/\rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain",
        "service_type":"jaas",
        "implementation_version":"1.0",
        "services" : [
        {
            "service_name":"ExampleInstance",
            "version":"12cR3",
            "wlsVersion":"12.1.3.0.x",
            "status":"Running",
            "error_status_desc": "",
            "compliance_status": "",
            "compliance_status_desc": "",
            "auto_update": "true",
            "description":"WebLogicEnterprise",
            "identity_domain":"ExampleIdentityDomain",
            "creation_time" : "Thu Jun 3 8:19:30 UTC 2014",
            "last_modified_time" : "Thu Jun 26 22:19:26 UTC 2014",
            "created_by":"username",
            "service_uri":"https:\/\/rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/ExampleInstance"
        },
        {
            "service_name":"My12cServer",
            "version":"12cR3",
            "wlsVersion":"12.1.3.0.x",
            "status":"Running",
            "error_status_desc": "",
            "compliance_status": "",
            "compliance_status_desc": "",
            "auto_update": "true",
            "description":"WebLogicEnterprise",
            "identity_domain":"ExampleIdentityDomain",
            "creation_time":"Wed May 28 15:36:57 GMT 2014",
            "last_modified_time":"Thu May 29 09:15:57 GMT 2014",
            "created_by":"username",
            "service_uri":"https:\/\/rest_server_url\/paas/\service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/My12cServer"
        },
        {
            "service_name":"My11gServer",
            "version":"11g",
            "wlsVersion":"10.3.6.0.xx",
            "status":"Running",
            "error_status_desc": "",
            "compliance_status": "",
            "compliance_status_desc": "",
            "auto_update": "true",
            "description":"",
            "identity_domain":"ExampleIdentityDomain",
            "creation_time":"Tue May 27 18:11:41 GMT 2014",
            "last_modified_time":"Wed May 28 00:35:11 GMT 2014",
            "created_by":"username",
            "service_uri":"https:\/\/rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/My11gServer"
        }]
    }
    
  2. Create a JSON document, delete.json. Enable the forceDelete flag to force the removal of the service instance regardless of whether there are processes running.

    Provide the user name of the database administrator, and the database administrator password that was specified when the Database Cloud Service database deployment was created.

    The following shows an example of the request document.

    {
        "dbaName": "SYS",
        "dbaPassword": "MyPassword1!",
        "forceDelete": true
    }
    

    For more information about the request attributes, see Delete a Service Instance.

  3. Delete the service instance, ExampleInstance, passing the JSON document defined in step 2.
    curl -i -X PUT -u username:userPassword1! -d @delete.json -H "Content-Type:application/vnd.com.oracle.oracloud.provisioning.Service+json" -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain/ExampleInstance
    

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output. This option is optional.

    • -X option to indicate the type of request (PUT).

    • -u option to specify the user name and password for the Oracle Java Cloud Service account for authentication.

    • -d option to identify the request document, in JSON format, on the local machine (delete.json).

    • -H to identify the content type as application/vnd.com.oracle.oracloud.provisioning.Service+json and define a custom header, X-ID-TENANT-NAME, to identify the identity domain ID.

    For more information, see Delete a Service Instance.

    The following shows an example of the response header and body.

    HTTP/1.1 202 Accepted
    Date: Wed, 24 Jun 2015 19:52:03 GMT
    Location: https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain/status/delete/job/11
    ...
    {
        "service_name":"ExampleInstance", 
        "version":"12cR3",
        "wlsVersion":"12.1.3.0.x",
        "status":"Terminating",
        "error_status_desc":"",
        "compliance_status":"",
        "compliance_status_desc":"",
        "auto_update":"true",
        "description":"ExampleInstance",
        "identity_domain":"ExampleIdentityDomain",
        "creation_time":"Wed May 13 0:27:30 UTC 2015",
        "last_modified_time":"Sat Jun 13 16:10:26 UTC 2015",
        "created_by":"username",
        "service_uri":"https:\/\/rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/ExampleInstance"
    }
  4. Check the status of the delete operation using the resource URI returned in the Location header.
    curl -i -X GET -u username:userPassword1! -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain/status/delete/job/11
    

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output. This option is optional.

    • -X option to indicate the type of request (GET).

    • -u option to specify the user name and password for the Oracle Java Cloud Service account for authentication.

    • -H to define a custom header, X-ID-TENANT-NAME, to identify the identity domain ID.

    For more information, see View the Status of a Service Instance Lifecycle Operation.

    The following example shows the contents of the response body, including the status messages:

    {
        "service_name": "ExampleInstance",
        "version": "12cR3",
        "wlsVersion": "12.1.3.0.x",
        "status": "Terminating",
        "error_status_desc": "",
        "compliance_status": "",
        "compliance_status_desc": "",
        "auto_update": "true",
        "description": "ExampleInstance",
        "identity_domain": "ExampleIdentityDomain",
        "creation_time": "Wed May 13 0:27:30 UTC 2015",
        "last_modified_time": "Sat Jun 13 16:10:26 UTC 2015",
        "created_by": "username",
        "service_uri": "https:\/\/rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/ExampleInstance",
      "message": [
        "Successfully terminated the backup service...",
        "Stopping Compute resources..."
      ]
    }
    
  5. Once the service instance is deleted, review the service instances that currently exist to confirm the deletion.
    curl -i -X GET -u username:userPassword1! -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain
    

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output. This option is optional.

    • -X option to indicate the type of request (GET).

    • -u option to specify the user name and password for the Oracle Java Cloud Service account for authentication.

    • -H to define a custom header, X-ID-TENANT-NAME, to identify the identity domain ID.

    The following shows an example of the response body. In this example, there are two service instances, My12cServer and My11gServer. ExampleInstance has been deleted successfully.

    {
        "uri":"https:\/\rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain",
        "service_type":"jaas",
        "implementation_version":"1.0",
        "services" : [    
        {
            "service_name":"My12cServer",
            "version":"12cR3",
            "wlsVersion":"12.1.3.0.x",
            "status":"Running",
            "error_status_desc": "",
            "compliance_status": "",
            "compliance_status_desc": "",
            "auto_update": "true",
            "description":"WebLogicEnterprise",
            "identity_domain":"ExampleIdentityDomain",
            "creation_time":"Wed May 28 15:36:57 GMT 2014",
            "last_modified_time":"Thu May 29 09:15:57 GMT 2014",
            "created_by":"username",
            "service_uri":"https:\/\/rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/My12cServer"
        },
        {
            "service_name":"My11gServer",
            "version":"11g",
            "wlsVersion":"10.3.6.0.xx",
            "status":"Running",
            "error_status_desc": "",
            "compliance_status": "",
            "compliance_status_desc": "",
            "auto_update": "true",
            "description":"",
            "identity_domain":"ExampleIdentityDomain",
            "creation_time":"Tue May 27 18:11:41 GMT 2014",
            "last_modified_time":"Wed May 28 00:35:11 GMT 2014",
            "created_by":"username",
            "service_uri":"https:\/\/rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/My11gServer"
        }]
    }

    If the service instance used IP reservations, the IP reservations associated with the Managed Server nodes – and load balancer nodes, if applicable – are released but not deleted. The released IP addresses are returned to the pool of pre-allocated IP reservations with the status of UNUSED.