DatabasesApi

DatabasesApi

All URIs are relative to https://api.ionos.com/databases/postgresql

Method
HTTP request
Description

DELETE /clusters/{clusterId}/databases/{databasename}

Delete database

GET /clusters/{clusterId}/databases/{databasename}

Get database

GET /clusters/{clusterId}/databases

List databases

POST /clusters/{clusterId}/databases

Create a database

databasesDelete

databasesDelete(clusterId, databasename)

Delete database

Deletes a single database

Example

// Import classes:
import com.ionoscloud.dbaaspostgres.ApiClient;
import com.ionoscloud.dbaaspostgres.ApiException;
import com.ionoscloud.dbaaspostgres.Configuration;
import com.ionoscloud.dbaaspostgres.auth.*;
import com.ionoscloud.dbaaspostgres.model.*;
import com.ionoscloud.dbaaspostgres.api.DatabasesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuthentication = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuthentication.setUsername("YOUR USERNAME");
    basicAuthentication.setPassword("YOUR PASSWORD");


    DatabasesApi apiInstance = new DatabasesApi(defaultClient);
    String clusterId = "498ae72f-411f-11eb-9d07-046c59cc737e"; // String | The unique ID of the cluster.
    String databasename = "benjamindb"; // String | The database name.
    try {
      apiInstance.databasesDelete(clusterId, databasename);
    } catch (ApiException e) {
      System.err.println("Exception when calling DatabasesApi#databasesDelete");
      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.

Parameters

Name
Type
Description
Notes

clusterId

String

The unique ID of the cluster.

databasename

String

The database name.

Return type

null (empty response body)

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

databasesGet

DatabaseResource databasesGet(clusterId, databasename)

Get database

Retrieves a single database

Example

// Import classes:
import com.ionoscloud.dbaaspostgres.ApiClient;
import com.ionoscloud.dbaaspostgres.ApiException;
import com.ionoscloud.dbaaspostgres.Configuration;
import com.ionoscloud.dbaaspostgres.auth.*;
import com.ionoscloud.dbaaspostgres.model.*;
import com.ionoscloud.dbaaspostgres.api.DatabasesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuthentication = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuthentication.setUsername("YOUR USERNAME");
    basicAuthentication.setPassword("YOUR PASSWORD");


    DatabasesApi apiInstance = new DatabasesApi(defaultClient);
    String clusterId = "498ae72f-411f-11eb-9d07-046c59cc737e"; // String | The unique ID of the cluster.
    String databasename = "benjamindb"; // String | The database name.
    try {
      DatabaseResource result = apiInstance.databasesGet(clusterId, databasename);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DatabasesApi#databasesGet");
      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.

Parameters

Name
Type
Description
Notes

clusterId

String

The unique ID of the cluster.

databasename

String

The database name.

Return type

DatabaseResource

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

databasesList

DatabaseList databasesList(clusterId, limit, offset)

List databases

Retrieves a list of databases

Example

// Import classes:
import com.ionoscloud.dbaaspostgres.ApiClient;
import com.ionoscloud.dbaaspostgres.ApiException;
import com.ionoscloud.dbaaspostgres.Configuration;
import com.ionoscloud.dbaaspostgres.auth.*;
import com.ionoscloud.dbaaspostgres.model.*;
import com.ionoscloud.dbaaspostgres.api.DatabasesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuthentication = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuthentication.setUsername("YOUR USERNAME");
    basicAuthentication.setPassword("YOUR PASSWORD");


    DatabasesApi apiInstance = new DatabasesApi(defaultClient);
    String clusterId = "498ae72f-411f-11eb-9d07-046c59cc737e"; // String | The unique ID of the cluster.
    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.
    try {
      DatabaseList result = apiInstance.databasesList(clusterId, limit, offset);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DatabasesApi#databasesList");
      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.

Parameters

Name
Type
Description
Notes

clusterId

String

The unique ID of the cluster.

limit

Integer

The maximum number of elements to return. Use together with 'offset' for pagination.

[optional] [default to 100]

offset

Integer

The first element to return. Use together with 'limit' for pagination.

[optional] [default to 0]

Return type

DatabaseList

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

databasesPost

DatabaseResource databasesPost(clusterId, database)

Create a database

Create a new database

Example

// Import classes:
import com.ionoscloud.dbaaspostgres.ApiClient;
import com.ionoscloud.dbaaspostgres.ApiException;
import com.ionoscloud.dbaaspostgres.Configuration;
import com.ionoscloud.dbaaspostgres.auth.*;
import com.ionoscloud.dbaaspostgres.model.*;
import com.ionoscloud.dbaaspostgres.api.DatabasesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    
    // Configure HTTP basic authorization: basicAuth
    HttpBasicAuth basicAuthentication = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
    basicAuthentication.setUsername("YOUR USERNAME");
    basicAuthentication.setPassword("YOUR PASSWORD");


    DatabasesApi apiInstance = new DatabasesApi(defaultClient);
    String clusterId = "498ae72f-411f-11eb-9d07-046c59cc737e"; // String | The unique ID of the cluster.
    Database database = new Database(); // Database | a database to create
    try {
      DatabaseResource result = apiInstance.databasesPost(clusterId, database);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DatabasesApi#databasesPost");
      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.

Parameters

Name
Type
Description
Notes

clusterId

String

The unique ID of the cluster.

database

a database to create

Return type

DatabaseResource

HTTP request headers

  • Content-Type: application/json

  • Accept: application/json

Last updated