Deleting Components in Bulk
The components to be deleted simultaneously from the eG Enterprise system should be included in a CSV file that is created exclusively for this purpose.
Such a CSV file should contain entries of the following format:
Element,action
Component,delete
componenttype,hostip/hostname,componentname,port
<Component1 to be deleted>
<Component2 to be deleted>
.
.
.
For example, if you want to delete an Oracle and an MS SQL server together using their respective host IPs, then your CSV file should include the following entries:
Element,action
Component,delete
componenttype,hostip,componentname,port,sid
Oracle database,192.168.10.96,ora96,1521,egora
Microsoft SQL,192.168.10.173,sql173,1433,
If you want to delete an Oracle and an MS SQL server together using their respective host names, then your CSV file should include the following entries:
Element,action
Component,delete
componenttype,hostname,componentname,port,sid
Oracle database,egurkha25,ora96,1521,egora
Microsoft SQL,egurkha26,sql173,1433,
As already stated, if an Oracle database server is added with multiple SIDs, then the eG Enterprise system will monitor each SID as a different Oracle server. Therefore, while removing an Oracle database server that supports multiple SIDs, each SID should be treated as a different Oracle server, and a separate specification for each SID should be included in the CSV file. For example, say, an Oracle database server has been added with the following SIDs: egdemo,egora. To remove this Oracle server completely, your CSV file should contain the following entries:
Element,action
Component,delete
componenttype,hostip,componentname,port,sid
Oracle database,192.168.10.96,ora96,1521,egora
Oracle database,192.168.10.96,ora96,1521,egdemo
Note:
Components included in a zone, segment, or service cannot be deleted.
Once the CSV file (let's say, the name of the file is deletecomponent.csv) is created on the eG manager, invoke the URL command mentioned below from the eG REST API Client to update the eG manager with all the modifications contained in the CSV file.
URL: http://<eG manager IP:port>/api/eg/orchestration/deletecomponent/bulk
Method: POST
Content-Type: multipart/form-data
Parameters | Key values | Example |
---|---|---|
Headers |
managerurl: Base URL of the eG Manager i.e., http://<IP address of the eG console:Port> user: eG username or domain/eG username pwd: Base64 encoded password |
{ "file": G:\deletecomponent.csv } |
Body |
Default: { "file" : "Full path to the CSV file" } |
Type | Code | Content |
---|---|---|
JSON |
200 |
{ "Succeed": "Component has been removed successfully." } |
Type | Code | Content |
---|---|---|
JSON |
401 UNAUTHORIZED |
{ "Error": "Following component(s) could not be deleted.", "Description": [ "The selected component does not exist. Component type :<Component Type>,Component name :<nick name of the component>", "The selected component does not exist. Component type :<Component Type>,Component name :<nick name of the component>", . . . ] } |
Figure 1 : Deleting Components in bulk using Postman REST Client
Deleting Components in Bulk using cURL
To delete components in bulk through the REST API using cURL, the command should be specified in the following format:
curl --location --request POST "http://<eG Manager IP:Port>/api/eg/orchestration/deletecomponent/bulk" -H "managerurl:http://<eG Manager IP:Port>" -H "user:<eG username or domain/eG username>" -H "pwd:Base64 encoded password" -H "Content-Type: multipart/form-data" --form "file=@ Full path to the CSV file"
Figure 2 shows an example of deleting components in bulk using cURL.