An enterprise-grade Database is provided as a Service (DBaaS) solution that can be managed through a browser-based "Data Center Designer" (DCD) tool or via an easy to use API.
The API allows you to create additional database clusters or modify existing ones. It is designed to allow users to leverage the same power and flexibility found within the DCD visual tool. Both tools are consistent with their concepts and lend well to making the experience smooth and intuitive.
Include the Ruby code directly using -I as follows:
4. Install from RubyGems
Just add this to the Gemfile:
After installing please run the following code:
Authentication
The username and password or the authentication token can be manually specified when initializing the SDK client:
Environment variables can also be used for initialization. For example:
Warning: Make sure to follow the Information Security Best Practices when using credentials within your code or storing them in a file.
Changing the base URL
Base URL for the HTTP operation can be changed in the following way:
Feature Reference
The IONOS Cloud SDK for Ruby aims to offer access to all resources in the IONOS Cloud API and also offers some additional features that make the integration easier:
Pure SDKs are automatically generated using OpenAPI Generator and don’t support manual changes. If you need changes please open an issue and we’ll try to take care of it.
# Load the gem
require 'ionoscloud-dbaas-postgres'
# Setup authorization
IonoscloudDbaasPostgres.configure do |config|
# Configure HTTP basic authorization: Basic Authentication
config.username = 'YOUR_USERNAME'
config.password = 'YOUR_PASSWORD'
# Configure API key authorization: Token Authentication
config.api_key['Authorization'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Authorization'] = 'Bearer'
end
api_instance = IonoscloudDbaasPostgres::DefaultApi.new
opts = {
pretty: true, # Boolean | Controls whether response is pretty-printed (with indentation and new lines)
depth: 56, # Integer | Controls the details depth of response objects. Eg. GET /datacenters/[ID] - depth=0: only direct properties are included. Children (servers etc.) are not included - depth=1: direct properties and children references are included - depth=2: direct properties and children properties are included - depth=3: direct properties and children properties and children's children are included - depth=... and so on
x_contract_number: 56 # Integer | Users having more than 1 contract need to provide contract number, against which all API requests should be executed
}
begin
#Display API information
result = api_instance.api_info_get(opts)
p result
rescue IonoscloudDbaasPostgres::ApiError => e
puts "Exception when calling DefaultApi->api_info_get: #{e}"
end
IonoscloudDbaasPostgres.configure do |config|
# Configure HTTP basic authorization: Basic Authentication
config.username = 'YOUR_USERNAME'
config.password = 'YOUR_PASSWORD'
# Configure API key authorization: Token Authentication
config.api_key['Authorization'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Authorization'] = 'Bearer'
end
IonoscloudDbaasPostgres.configure do |config|
config.username = ENV['IONOS_USERNAME']
config.password = ENV['IONOS_PASSWORD']
config.api_key['Authorization'] = ENV['IONOS_TOKEN']
end
IonoscloudDbaasPostgres.configure do |config|
config.username = ENV['IONOS_USERNAME']
config.password = ENV['IONOS_PASSWORD']
# Configure the url used by the SDK
config.host = 'https://api.ionos.com/databases/postgresql'
# This must be set as well because of the way the API works, otherwise the set url will not be used
condif.server_index = nil
end