Reclaim Your Deleted Resources With the Reclamation Controller
Accidentally deleting valuable resources can be frustrating, but the Reclamation Controller offers an effortless solution: reclaiming deleted resources is made easy.
Join the DZone community and get the full member experience.
Join For FreeHave you ever found yourself in a situation where you accidentally deleted a valuable resource, only to realize later that you still needed it? Perhaps you mistakenly deleted an important file from your cloud storage, or you removed a critical database entry without intending to. These situations can be frustrating and time-consuming to resolve, but with the Reclamation Controller, you can reclaim your deleted resources effortlessly.
How Does Reclamation Work?
Imagine you're working on a cloud platform where you manage various resources such as files, databases, or virtual machines. The Reclamation Controller acts as a safety net for these resources. When you delete a resource, whether intentionally or accidentally, the Reclamation Controller kicks in and initiates a grace period before permanently removing the resource from the system. During this grace period, you have the opportunity to restore your resource, preventing irreversible data loss.
Enabling Reclamation for Your Service
Enabling reclamation for your service is a straightforward process:
- Ensure your system or platform supports reclamation functionality. This may involve checking if there's a toggle or setting to enable reclamation for your resources.
- Use the system's interface or API to access the list of deleted resources that are still recoverable. This list provides you with the necessary information to identify and reclaim the resources you need.
Taking Action: Reclaim or Restore
Once you've identified the resource you want to manage, you have two options:
- Reclaim state: If you're certain you no longer need the resource, you can initiate the reclaim action. This permanently deletes the resource from the system, freeing up storage space and resources.
- Restore state: If you realize that you still need the resource, you can restore it from the deleted items list. This action reinstates the resource to its previous state, ensuring you don't lose any valuable data or functionality.
Real-Life Use Case: Cloud Storage
Consider a scenario where you accidentally delete an important file from your cloud storage. Without reclamation functionality, this action could lead to permanent data loss. However, with the Reclamation Controller enabled, you have a safety net. You can quickly access the list of deleted files, identify the one you need, and restore it with a simple click. This ensures that even in the face of human error, your data remains safe and accessible.
Let's look at an example of using the reclamation controller in IBM Cloud.
Reclamation is an important feature of IBM Cloud that helps you recover deleted instances if you accidentally delete them or change your mind about deleting them. Reclamation works by enabling and disabling the "enabled" flag in the Cloudant document. The reclamation controller waits for 7 days before deleting the instance permanently from IBM Cloud. But you still have a chance to restore your instance if you want it back within those 7 days. If you want to enable reclamation for your service, follow these steps:
- Make sure that your Cloudant document has a key-value pair named “enabled” with the value as true or false. You can update this value through the GET API call to retrieve all reclaimable instances.
- Use the GET API call to fetch all reclaimable instances. The response will list deleted instances that have not been permanently deleted yet. Once you find the instance you want to reclaim, note down its ID.
Enabling Reclamation for Your Service
Call the GET API call to get the deleted instances. Your deleted instance will be listed in the response of the API call.
- API call:
https://resource-controller.test.cloud.ibm.com/v1/reclamations?account_id={account_id}
- Example:
https://resource-controller.test.cloud.ibm.com/v1/reclamations?account_id=e7f84207f02a401784384cc02a128387
Once the deleted instances are listed, find your resource_instance_id. Now, you can either reclaim or restore this instance as per your need.
To perform the reclaim operation:
- Call the POST RC API:
https://resource-controller.test.cloud.ibm.com/v1/reclamations/{id}/actions/reclaim
(Note: Here, the id is not the instance_id or the resource_instance_id but the id obtained from the RC API call for that particular instance). - This API call toggles the enabled state of the instance to true in the Cloudant, and this ensures that the instance is deleted forever.
- Example:
https://resource-controller.test.cloud.ibm.com/v1/reclamations/74abfc91-d1e4-4100-ad10-213a880e5f75/actions/reclaim
Response of the API call:
{
"id": "74abfc91-d1e4-4100-ad10-213a880e5f75",
"entity_id": "4dc92300-73cd-11ec-8e70-df67665eaed2",
"entity_type_id": "system-default-entity-type-resource-instance",
"entity_crn": "crn:v1:staging:public:privileged-access-gateway:us-south:a/e7f84207f02a401784384cc02a128387:db12e671-c7f5-49cc-907b-eb82bb487548::",
"resource_instance_id": "db12e671-c7f5-49cc-907b-eb82bb487548",
"resource_group_id": "965b86e441464e2abf8461439c08f4bc",
"account_id": "e7f84207f02a401784384cc02a128387",
"policy_id": "system-default-policy-7-days",
"state": "RECLAIMING",
"target_time": "2023-09-14T06:32:10Z",
"location": "dal13",
"request_source": "RC",
"retry_times": 0,
"created_at": "2023-09-07T06:32:10.344714213Z",
"created_by": "iam-ServiceId-9ee41cf7-84a0-443d-b1f6-82481ce83e59",
"updated_at": "2023-09-07T06:34:38.339682147Z",
"updated_by": "IBMid-6670002JET"
}
Here, you can see that the state of the instance is "RECLAIMING."
To perform the restore operation:
Call the POST RC API: https://resource-controller.test.cloud.ibm.com/v1/reclamations/{id}/actions/restore
This API call toggles the enabled state and the active state of the instance to true in the Cloudant.
Example: https://resource-controller.test.cloud.ibm.com/v1/reclamations/74abfc91-d1e4-4100-ad10-213a880e5f75/actions/restore
Response of the API call:
{
"id": "ec4bdddc-0cc6-417c-bf36-8628916b8fae",
"entity_id": "4dc92300-73cd-11ec-8e70-df67665eaed2",
"entity_type_id": "system-default-entity-type-resource-instance",
"entity_crn": "crn:v1:staging:public:privileged-access-gateway:us-south:a/e7f84207f02a401784384cc02a128387:db12e671-c7f5-49cc-907b-eb82bb487548::",
"resource_instance_id": "db12e671-c7f5-49cc-907b-eb82bb487548",
"resource_group_id": "965b86e441464e2abf8461439c08f4bc",
"account_id": "e7f84207f02a401784384cc02a128387",
"policy_id": "system-default-policy-7-days",
"state": "RESTORING",
"target_time": "2023-09-14T06:15:26Z",
"location": "wdc07",
"request_source": "RC",
"retry_times": 0,
"created_at": "2023-09-07T06:15:26.164931467Z",
"created_by": "iam-ServiceId-9ee41cf7-84a0-443d-b1f6-82481ce83e59",
"updated_at": "2023-09-07T06:29:13.517413296Z",
"updated_by": "IBMid-6670002JET"
}
Here, you can see that the state of the instance is "RESTORING."
Enhanced Security and Compliance
Beyond its utility in data recovery, the Reclamation Controller also enhances security and compliance measures. By providing a mechanism for controlled deletion and restoration of resources, organizations can better adhere to data retention policies and regulatory requirements. This ensures that sensitive information is handled responsibly and follows industry standards.
Conclusion: Simplify Resource Recovery With Reclamation
Whether you're managing files, databases, virtual machines, or any other resources, the Reclamation Controller provides peace of mind. By integrating reclamation functionality into your systems and platforms, you can mitigate the risk of data loss and streamline the process of resource recovery. Don't let accidental deletions derail your workflow — reclaim your resources effortlessly with the Reclamation Controller.
Opinions expressed by DZone contributors are their own.
Comments