'Python sdk OCI : Remove backup policy of boot volume

How do we remove the assigned backup policy of boot volume attached to an instance using python sdk OCI package

Didn't find with UpdateBootVolume

https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/BootVolume/UpdateBootVolume



Solution 1:[1]

Here is how you can accomplish this:

  1. Call this method from the OCI SDK to get BackupPolicyAssignment:

https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/api/core/client/oci.core.BlockstorageClient.html?highlight=Get_Volume#oci.core.BlockstorageClient.get_volume

  1. Call this method to check if its the right volume for the above backup policy:

https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/api/core/client/oci.core.BlockstorageClient.html?highlight=Get_Volume#oci.core.BlockstorageClient.get_volume_backup_policy

  1. Delete it to remove attachment policy to volume:

https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/api/core/client/oci.core.BlockstorageClient.html#oci.core.BlockstorageClient.delete_volume_backup_policy_assignment

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman