DBaaS Mongo
With IONOS Cloud Database as a Service, you have the ability to quickly set up and manage a MongoDB database. You can also delete clusters, manage backups and users via the API.
MongoDB is an open source, cross-platform, document-oriented database program. Classified as a NoSQL database program, it uses JSON-like documents with optional schemas.
The MongoDB API allows you to create additional database clusters or modify existing ones. Both tools, the Data Center Designer (DCD) and the API use the same concepts consistently and are well suited for smooth and intuitive use.
Overview
The IONOS Cloud SDK for GO provides you with access to the IONOS Cloud API. The client library supports both simple and complex requests. It is designed for developers who are building applications in GO . The SDK for GO wraps the IONOS Cloud API. All API operations are performed over SSL and authenticated using your IONOS Cloud portal credentials. The API can be accessed within an instance running in IONOS Cloud or directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.
Installing
Use go get to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies.
To update the SDK use go get -u to retrieve the latest version of the SDK.
Go Modules
If you are using Go modules, your go get will default to the latest tagged release version of the SDK. To get a specific release version of the SDK use @ in your go get command.
To get the latest SDK repository, use @latest.
Environment Variables
⚠️ Note: To overwrite the api endpoint - api.ionos.com
, the environment variable $IONOS_API_URL
can be set, and used with NewConfigurationFromEnv()
function.
Examples
Examples for creating resources using the Go SDK can be found here
Authentication
Basic Authentication
Type: HTTP basic authentication
Example
Token Authentication
There are 2 ways to generate your token:
Generate token using sdk for auth:
Generate token using ionosctl:
Install ionosctl as explained here Run commands to login and generate your token.
Save the generated token and use it to authenticate:
Certificate pinning:
You can enable certificate pinning if you want to bypass the normal certificate checking procedure, by doing the following:
Set env variable IONOS_PINNED_CERT=<insert_sha256_public_fingerprint_here>
You can get the sha256 fingerprint most easily from the browser by inspecting the certificate.
Depth
Many of the List or Get operations will accept an optional depth argument. Setting this to a value between 0 and 5 affects the amount of data that is returned. The details returned vary depending on the resource being queried, but it generally follows this pattern. By default, the SDK sets the depth argument to the maximum value.
Changing the base URL
Base URL for the HTTP operation can be changed by using the following function:
Debugging
You can now inject any logger that implements Printf as a logger instead of using the default sdk logger. There are now Loglevels that you can set: Off
, Debug
and Trace
. Off
- does not show any logs Debug
- regular logs, no sensitive information Trace
- we recommend you only set this field for debugging purposes. Disable it in your production environments because it can log sensitive data. It logs the full request and response without encryption, even for an HTTPS call. Verbose request and response logging can also significantly impact your application's performance.
Documentation for API Endpoints
All URIs are relative to https://api.ionos.com/databases/mongodb
Documentation For Models
All URIs are relative to https://api.ionos.com/databases/mongodb
Last updated