You can retrieve a PostgreSQL cluster by using its ID. This value can be found in the response body when a PostgreSQL cluster is created or when you GET a list of PostgreSQL clusters.
Example
// Import classes:importcom.ionoscloud.dbaaspostgres.ApiClient;importcom.ionoscloud.dbaaspostgres.ApiException;importcom.ionoscloud.dbaaspostgres.Configuration;importcom.ionoscloud.dbaaspostgres.auth.*;importcom.ionoscloud.dbaaspostgres.model.*;importcom.ionoscloud.dbaaspostgres.api.ClustersApi;publicclassExample {publicstaticvoidmain(String[] args) {ApiClient defaultClient =Configuration.getDefaultApiClient();// Configure HTTP basic authorization: basicAuthHttpBasicAuth basicAuthentication = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");basicAuthentication.setUsername("YOUR USERNAME");basicAuthentication.setPassword("YOUR PASSWORD");ClustersApi apiInstance =newClustersApi(defaultClient);String clusterId ="498ae72f-411f-11eb-9d07-046c59cc737e"; // String | The unique ID of the cluster.try {ClusterResponse result =apiInstance.clustersFindById(clusterId);System.out.println(result); } catch (ApiException e) {System.err.println("Exception when calling ClustersApi#clustersFindById");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace(); } }}
⚠️ Note: for the example above, you need to provide all parameters to the method call. Null values will resolve to the API defaults.
// Import classes:importcom.ionoscloud.dbaaspostgres.ApiClient;importcom.ionoscloud.dbaaspostgres.ApiException;importcom.ionoscloud.dbaaspostgres.Configuration;importcom.ionoscloud.dbaaspostgres.auth.*;importcom.ionoscloud.dbaaspostgres.model.*;importcom.ionoscloud.dbaaspostgres.api.ClustersApi;publicclassExample {publicstaticvoidmain(String[] args) {ApiClient defaultClient =Configuration.getDefaultApiClient();// Configure HTTP basic authorization: basicAuthHttpBasicAuth basicAuthentication = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");basicAuthentication.setUsername("YOUR USERNAME");basicAuthentication.setPassword("YOUR PASSWORD");ClustersApi apiInstance =newClustersApi(defaultClient); Integer limit = 100; // Integer | The maximum number of elements to return. Use together with 'offset' for pagination.
Integer offset =0; // Integer | The first element to return. Use together with 'limit' for pagination. String filterName = "filterName_example"; // String | Response filter to list only the PostgreSQL clusters that contain the specified name. The value is case insensitive and matched on the 'displayName' field.
try {ClusterList result =apiInstance.clustersGet(limit, offset, filterName);System.out.println(result); } catch (ApiException e) {System.err.println("Exception when calling ClustersApi#clustersGet");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace(); } }}
⚠️ Note: for the example above, you need to provide all parameters to the method call. Null values will resolve to the API defaults.