oci-java-sdk
oci-java-sdk copied to clipboard
Not all OCI resources returned by ResourceSearchClient
I am trying to load the list of all resources that are present in specific OCI deployment:
AuthenticationDetailsProvider provider = SimpleAuthenticationDetailsProvider.builder()
.tenantId(credentials.getTenantId())
.userId(credentials.getUserId())
.fingerprint(credentials.getFingerprint())
.privateKeySupplier(new StringPrivateKeySupplier(credentials.getPrivateKey()))
.region(Region.valueOf(credentials.getRegion()))
.build();
@Cleanup ResourceSearchClient searchClient = ResourceSearchClient.builder().build(provider);
String query = "query all resources";
SearchResourcesRequest request = SearchResourcesRequest.builder()
.searchDetails(
StructuredSearchDetails.builder()
.query(query)
.build()
)
.build();
SearchResourcesResponse response = searchClient.searchResources(request);
for (ResourceSummary resourceSummary : response.getResourceSummaryCollection().getItems()) {
the response contains a lot of resources from the OCI, but not all of them, because I fail to match some resources I can see in UI to the list of records from API. I wasn't yet able to define if there's any pattern between resources that are not retrieved from API
Please try if pagination works. API reference - https://docs.oracle.com/en-us/iaas/api/#/en/search/20180409/ResourceSummary/SearchResources Pagination example - https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/PaginationExample.java