I need to fetch all the instances (authorized) in the tenancy. In Oracle Cloud documentation, I have seen fetching the instances by compartment ID(ListInstances API). So in order to fetch all instances, I need all the compartments.
Any inputs? Or Is there a way of fetching all instances irrespective of compartments?
You want ListCompartments, under the IAM section of the docs, here https://docs.cloud.oracle.com/iaas/api/#/en/identity/20160918/Compartment/ListCompartments
You need to give it the parent compartment, which would be the root compartment for the first-level compartments.